SafeSpace
Business Context
SafeSpace was a hackathon project focused on building a working real-time safety system under strict time constraints. The objective was simple
match users with nearby volunteers and deliver live updates reliably.
Engineering Architecture
Efficient Geospatial Matching
Implemented the Haversine distance algorithm to compute proximity within a configurable radius (default 5km).
Real-Time Notification Layer
Integrated WebSocket-based realtime broadcasting to deliver buddy requests instantly. Used dual INSERT + UPDATE listeners to ensure sub-second delivery and automatic hiding of fulfilled requests.
Race Condition Handling
Designed first-come-first-served logic with status-based filtering to prevent multiple volunteers from accepting the same request simultaneously.
Persistent Live Location System
Stored timestamped coordinates with freshness thresholds (5-minute window) to maintain reliable proximity calculations even across server restarts.
Database-Level Isolation
Enforced Row-Level Security (RLS) in PostgreSQL to guarantee strict separation between users and volunteers without relying solely on application-layer filtering.
Key Trade-offs
Speed vs. Abstraction
Chose a direct Express + PostgreSQL architecture to ship quickly rather than introducing complex architectural layers.
Real-Time Performance vs. Simplicity
Used indexed queries and event-based filtering to ensure fast matching and near-instant notification delivery without overengineering the system.