CupQuest

Find cafes, share reviews, and follow friends' picks.

CupQuest

Built the social and messaging layer for a coffee shop discovery app - friend requests, pending states, mutual acceptance, and an activity feed that surfaces friend reviews first on any shop page. The underlying app lets users find nearby cafes via Yelp and Google Maps data and post drink or venue reviews. My ownership covered those social features end to end, on a four-person team.

The friendship schema required more thought than a simple friends array. An early version could add the same user multiple times and had duplicated add/remove logic. The deeper issue was the race condition: two users sending each other friend requests simultaneously would create two separate pending documents with no way to resolve them to a mutual state. The fix was modeling friendships as directional relationship documents with a status field, then querying both directions before returning a user’s current friend status - so the system always resolves to one canonical state regardless of request order.

Private messaging was a stretch goal added in the final days. The Socket.io implementation stores connected users in a server-side map keyed by username. When a message arrives with a to property, the handler looks up the recipient’s socket from that map and emits directly to it - no broadcast, no rooms, just a targeted emit to the right connection. Typing indicators follow the same path as client-side events.

Mid-project, the backend was still a single flat route file, which meant multiple people working on different endpoints were constantly producing merge conflicts. Splitting routes into Express routers by resource type eliminated most of that friction immediately. It was a small structural decision with an outsized effect on how smoothly the team could work in parallel. The project shipped with 75%+ test coverage, with Jest and React Testing Library component tests covering the social and messaging features.