Eye hospital booking platform
What happens when two patients try to book the same 10:30 slot?
Booking platform for a multi-branch eye hospital, built so one appointment slot can only ever go to one patient, even when many people book at once.
- What it is
- Client work
- My role
- Technical lead
- Year
- 2026
- Next.js
- Node.js
- Express
- MongoDB
- Redis
- Cloudinary
The problem
Patients booked by phone during working hours. With several branches and busy doctors, the same slot could be offered to two people at once.
How I solved it
- The slot is held the moment a patient picks it. Nobody else can take it while they fill in their details.
- If they leave halfway, the hold expires on its own and the slot goes back on the board.
- Confirmation and a reminder reach the patient on SMS, WhatsApp and email.
System design
- Frontend: Next.js with server-side rendering, so branch and doctor pages load fast and show up in search.
- API: Node.js and Express REST endpoints, with MongoDB as the source of truth for appointments.
- Concurrency: slot holds are short-lived keys in Redis with an expiry, so simultaneous requests for one slot resolve to a single winner and abandoned holds clean themselves up.
- Notifications: confirmation and reminder fan-out over SMS, the WhatsApp Business API and email.
- Media on Cloudinary.
Trade-offs
- Redis holds over locking rows in the database: fast, and they expire by themselves with no cleanup job. Cost: one more service to run, and the hold length has to fit a real patient’s pace.
- Server-side rendering over a client-only app: faster first load and pages search engines can read. Cost: every page view does server work.
- Three notification channels over one: patients actually see the reminder. Cost: three providers to integrate, and WhatsApp needs pre-approved message templates.