Clinic Queue System
Real-time queue system for a dental clinic: patients scan a QR code for a number, while a public display and the receptionist desk update live.
- TypeScript
- React
- Node.js
- Express
- MongoDB
- Redis
- Socket.IO
- Vitest
- Docker
- GitHub Actions
A real-time, web-based queue management system for a dental clinic, built as a client-focused digital transformation case study for my degree. Patients join from their phone, a screen in the waiting room shows who is being served, and receptionists run the queue from a dashboard.
Features
Patients
- Scan a QR code and enter a name to get a ticket such as
A012. No account or app needed. - See live status: how many people are ahead, an estimated wait time, and which room to go to once called.
- Close the browser and come back later: the same ticket is restored from a secure cookie.
Waiting-room display
- Shows the numbers being served with their rooms, the next 50 waiting numbers and recently missed numbers.
- Shows ticket numbers only. Patient names never leave the server for the public screen.
Receptionists
- Call the next patient, assign a room, check the patient in when they arrive and check them out when done.
- Mark no-shows as missed, call a missed patient again, or remove a ticket.
- Pause the queue when the clinic is full. The pause resets by itself the next day.
- Add walk-in patients who don't have a phone.
Admins
- Manage staff accounts and roles, rooms, and settings such as the average service time and the auto-miss timeout.
- Today's statistics: totals by status and the average wait time.
Technical highlights
No duplicate numbers or double calls
- Ticket numbers come from a Redis
INCRcounter per day. Redis runs commands one at a time, so two patients joining at the same moment never get the same number, and numbers restart at A001 each day. - "Call next" takes a short Redis lock (
SET NXwith expiry), so two receptionists clicking at once can't call the same patient. The lock is released with a small Lua script that only deletes it if this request still owns it. - Rooms are claimed with a conditional MongoDB update that only succeeds if the room is free, so one room can't hold two patients.
Real-time updates
- Socket.IO with separate channels: the public display, the staff dashboard (only after the access token is verified) and a private channel for each patient's ticket.
- Patients called but not checked in within the configured time are moved to "missed" automatically. Every update is conditional, so a patient checked in at the same moment is never marked missed.
Security
- Staff passwords hashed with Argon2. Short-lived JWT access tokens plus refresh tokens that rotate on every use; refresh tokens are stored hashed in Redis so they can be revoked.
- Patients have no login: their ticket is tied to a random token in an httpOnly cookie.
- Role-based access for admin and receptionist, Zod validation on every request, and Helmet security headers.
- The first admin is created from environment variables, and the default password is refused in production.
Testing and delivery
- 35 backend API tests (Vitest, Supertest and an in-memory MongoDB) plus frontend component tests.
- GitHub Actions runs the backend tests on every push and pull request.
- Docker Compose starts MongoDB, Redis, the API and the frontend (served by Nginx) with one command.
Architecture
Express API in a routes → controllers → services → models structure, with MongoDB (Mongoose) for tickets, rooms, staff and settings, and Redis for counters, locks, the pause flag and refresh tokens. The React frontend is built with Vite and Tailwind CSS.