ReactNode.jsSocket.IOReact QueryMongoDB
The Problem
Concurrent users selecting the same expert slot creates race conditions while all clients still expect instant availability updates.
The System
- React Query — Client cache
- Socket.IO — Live updates
- Express — Validated APIs
- MongoDB — Indexed bookings
The Build
- Race-condition-safe booking creation
- Duplicate booking prevention
- Live slot synchronization under one second
- Four-stage status tracking
- React Query cache invalidation
- Client and server validation
Engineering Notes
Note 001
Challenge. Preventing two users from reserving one slot.
Decision. Atomic database constraints plus server-confirmed socket events.
Tradeoff. Optimistic UI waits for authoritative confirmation.
Result
- <1s sync
- 4 stages
- 99.9% uptime