Queue Cure is a modern, real-time queue management system built to eliminate paper token slips and verbal shouting in healthcare clinics. It consists of a dual-screen experience: a Receptionist Dashboard to manage consultations and a mobile-friendly Patient Waiting Screen that updates instantly.
Over 76% of India's 1.5 million clinics still run on manual paper token slips. Patients wait hours with no visibility into their appointment time, while receptionists and doctors struggle to manage queues from memory.
**Queue Cure ** solves this by providing:
- Real-Time Synchronized Displays: Immediate client updates via WebSockets when the queue moves.
- Accurate Estimated Wait Times: Dynamically computed waiting metrics based on actual queue position.
- Professional Clinic-Style Interface: Stripe/Linear-inspired visual layout that prioritizes readability and reliability.
- Patient Intake: Quick registration form that auto-focuses and submits on
Enter. - Queue Controller: High-contrast controls to "Call Next" and "Skip Token" (for when a called patient is not present).
- Intelligent Double-Click Protection: Thread-safe concurrency lock on both client and server to ignore rapid, duplicate click events.
- Clinic Statistics & Intelligence:
- Current Token: The active token number.
- Patients Waiting: Count of waiting room patients.
- Smart Avg Consult Time: Computes a rolling average of the last 5 completed consultations, filtering out invalid durations (< 10 seconds or > 2 hours). Automatically falls back to manual settings when no data is available.
- Approx. Queue End: Dynamic calculation of overall queue duration based on the active smart average.
- Total Served Today: Analytics row displaying the count of processed queue entries (COMPLETED + SKIPPED) today.
- Recently Served History: Displays a table of the last 5 processed patient entries with their final status (COMPLETED, SKIPPED, or CALLED) and transition time.
- Success Feedback Panel: Provides the issued token number and a direct copyable link (e.g.
http://localhost:3000/patient/5) immediately upon registration.
- Large Digital Board: Massive, high-visibility "Currently Serving" display readable from across a waiting room.
- Queue Status Cards: High-contrast details showing the patient's own token, exact count of patients ahead, and estimated wait time in minutes computed from the smart average.
- Polished Status Section: Detailed statuses (CALLED / SKIPPED / WAITING) with alert indicators to guide the patient. If skipped, shows a custom rose-colored banner.
- Invalid Token Recovery: Handles arbitrary routes (like
/patient/999) by displaying a professional "Token Not Found" screen instead of breaking.
- Frontend: Next.js (App Router, Tailwind CSS, TypeScript)
- Backend: Custom HTTP Node Server integrating Next.js and Socket.IO
- Database: PostgreSQL (hosted on Supabase)
- ORM: Prisma Client v5
+-----------------------------------------+
| Client Browser |
| (Receptionist Dashboard / Patient App) |
+--------------------+--------------------+
|
Socket.IO Events | (Bi-directional)
v
+--------------------+--------------------+
| Custom HTTP Server |
| (server.ts) |
+--------------------+--------------------+
|
Prisma Client | (ORM Queries)
v
+--------------------+--------------------+
| PostgreSQL Database |
| (Supabase) |
+-----------------------------------------+
request_queue: Queries and returns the list of waiting tokens.request_patient_status: Validates a specific patient's token and returns its active state.queue_updated: Broadcasts a database snapshot to all clients upon any queue modification (includes queue, currentTokenNumber, avgConsultationTime, smartAvgTime, isSmart, totalServedToday, recentlyServed).patient_added: Sends acknowledgment with the newly created token URL back to the receptionist.skip_patient: Emitted by the receptionist to skip the currently called patient. Sets their status toSKIPPED, calls the next patient in queue (if any), and broadcasts updated state.
Ensure you have Node.js installed on your machine.
Clone the repository and install dependencies:
npm installConfigure your environment variables. Create a .env file in the root directory and add your Supabase connection strings:
DATABASE_URL="postgresql://postgres:[password]@db.supabase.co:5432/postgres?schema=public"
DIRECT_URL="postgresql://postgres:[password]@db.supabase.co:5432/postgres?schema=public"Push the schema to your database and run the seed script to initialize settings:
npx prisma db push
npx prisma db seedStart the custom server:
npm run devOpen http://localhost:3000 in your browser.
- Navigate to
/receptionistto access the receptionist dashboard. - Navigate to
/patient/[tokenNumber]to view individual patient waiting screens.