PROJECT STUDY

Clinic Queue

Wait nearby. Come in when it is your turn.

A queue and appointment app for Indonesian clinics: online booking, QR check-in and one fair line shared by the front desk, doctors, a talking waiting-room TV and each patient's phone, with honest wait ranges.

Explore the build
Clinic queue illustration: a waiting-room TV calls ticket A-012 to Ruang 2 and lists the next tickets with initials only, beside a phone that shows the patient's own ticket, place in line and wait range.
Original interface illustration · Synthetic demo data.View larger

At a glance

Industry
Healthcare
Capabilities
8
Technologies
13
Year
2026

The challenge

At small Indonesian clinics, patients can wait a long time in a crowded room without knowing when they will be called.

The front desk juggles walk-ins and appointments by hand, doctors run late, and a patient who steps outside can miss their turn.

Clinics need booking, check-in and calling in one place, a queue order that staff can explain to anyone who asks, wait estimates that do not overpromise, and public screens that never show who is waiting.

What we built

Clinic Queue is one installable web app with screens for patients, the front desk, doctors, the clinic admin and the waiting-room TV, all working from the same live queue. One installation serves several clinics, each with its own doctors, rooms, weekly sessions and staff.

Booking without an account

Patients pick a doctor and a free slot on their phone with a name, phone number and birth year, then receive a booking code and a signed status link through which they can also cancel. A unique index allows one active booking per room and slot

Booking without an account

Patients pick a doctor and a free slot on their phone with a name, phone number and birth year, then receive a booking code and a signed status link through which they can also cancel. A unique index allows one active booking per room and slot

Check-in at the desk or by QR

The desk checks in bookings and registers walk-ins. Patients can also scan a QR code on the desk screen that changes every minute: a booked patient enters the booking code and the last four digits of their phone number, and a walk-in fills in their details and picks a room

A written ordering policy

Bookings keep their slot within a 10 minute grace window, walk-ins take the next unbooked slot in arrival order, and an elderly, pregnant, disability or urgent flag moves a patient forward by a fixed offset with a recorded reason. Every row shows staff why a patient sits where they do

Consoles for the desk and the doctor

Doctors open their room, call the next patient, and start and finish a visit with one tap, while staff can also recall, skip, move a patient to another room, cancel or record a no-show. A refused action says why, for example when a room already has a patient called

A waiting-room TV that speaks

The TV shows the called ticket in large type with its room, each room's next two tickets with initials only and the recent calls. It plays a chime, announces every call in Indonesian, such as "Nomor antrean, A, dua belas. Silakan ke Ruang dua.", keeps the screen awake and hides the cursor

Live status on the patient's phone

The status page shows the patient's ticket, place in line and a wait range, then changes colour and vibrates the phone when it is their turn

WhatsApp-style messages through an outbox

Checked-in, almost-your-turn, called, recalled and moved messages, booking confirmations and day-before reminders are written to an outbox in the same transaction as the queue change, only for patients who agreed to messages. A notifier port delivers them: the built-in adapter logs each message, and the desk reads them in its Pesan WhatsApp tab

Insights, audit and replay

The clinic admin sees no-show rates per slot type with overbooking advice, consultation lengths per doctor, an audit log of who did what and when, and a replay of the day's queue at any earlier moment

How it works

  1. Book or check in

    A patient books a slot or checks in through the QR code, or the desk registers a walk-in. Each patient gets a status link signed for that clinic, service day and booking or ticket, valid until the end of that day, and every ticket number carries the room's prefix letter.

  2. Decide, then append

    Every action goes through a pure decide function that returns either new events or a refusal code, without reading a clock or a database. One SQLite transaction appends the events, updates the read models, writes the outbox and records the audit row, and a writer that lost a race for the same sequence number reloads the log and decides again.

  3. Stream every change

    After each commit the API pushes a full snapshot over Server-Sent Events to every open stream: the TV view with initials only, each patient's own ticket, and the staff view with masked phone numbers. Because every message is complete, a missed one is harmless.

  4. Simulate the wait

    Each patient's wait is simulated 1,000 times from the doctor's recent consultation lengths, conditioned on how long the current visit has already run. The page shows the 50th to the 90th percentile rounded to five minutes, with the basis written underneath, and shows no estimate at all while the doctor has not started.

Engineering insights

The queue is built so that every place in line can be explained, replayed and tested.

Stack by layer

Frontend
  • React
  • TypeScript
  • Vite
  • React Router
  • TanStack Query
  • Tailwind CSS
  • qrcode.react
  • Web Speech API
  • Web Audio API
  • Screen Wake Lock API
  • Service worker (PWA)
Backend
  • Node.js
  • Hono
  • TypeScript
  • Zod
  • ts-pattern
  • Server-Sent Events
Data
  • SQLite (node:sqlite)
  • Append-only event log
Infrastructure
  • Node.js 24
  • Rolldown
  • Vitest
  • fast-check
  • Playwright
  • Biome
  1. Events record their decisions

    The queue is a pure decide and reduce engine over an append-only log per clinic and service day, with 16 event types. Each event stores the slot a walk-in received, the sort key after a skip and the offset a flag applied, so the reducer only copies values and a later policy change cannot alter what an earlier log means

  2. Properties checked on random days

    fast-check drives random sequences of bookings, walk-ins, flags, calls, skips, transfers, no-shows and day closes, 300 runs for each of three properties, and checks unique tickets, one patient per room, exactly one ending per ticket, and that replaying the log up to any earlier event rebuilds the state recorded at that moment

  3. Wait ranges simulated, not added up

    Percentiles of a sum are not the sum of percentiles, so the range comes from a Monte Carlo simulation, and a unit test pins the difference. The random seed comes from the clinic, room and event sequence, so the same queue always shows the same range. In the repository's benchmark, 1,000 runs for a line of 20 took a median of 2.6 to 3.1 ms across four runs (120 synthetic durations, Node.js 24.19 on an AMD Ryzen 9 4900H laptop while other builds were running)

  4. Overbooking advised, never applied

    No-show rates per slot type are shrunk toward the clinic rate with a Beta prior worth 20 bookings. A binomial newsvendor rule, which weighs an idle slot at 1 against an extra patient at 2, adds a booking while the chance of an empty slot stays above two thirds, capped at two per session and 15 percent of capacity, and staff see the overflow risk it accepts

  5. Privacy on every shared screen

    The TV shows ticket numbers and initials only, and staff views mask phone numbers. Tokens are signed with HMAC-SHA256 using a separate key per purpose and compared in constant time, staff routes and repository reads are scoped by clinic, and tests show that a session or a forged link from one clinic cannot reach another clinic's data

Design system

Calm care is a quiet, clinical design language for a stressful room: one loud colour for one message, large and steady numbers, and everything a patient needs readable from across the room or at a glance on a phone.

Colour palette

  • Clinic teal#0f766eBrand, primary buttons, selected states, the focus ring and the live dot
  • Mist#f0fdfaPage background
  • Ink#134e4aBody text and headings, and the TV background
  • Coral#e8505bYour turn: the call frame, rings, dots and the call pulse, plus the dot in the logo, and never text
  • Amber#b45309Delays, a doctor who has not started and reconnecting states
  • Danger#b42318Errors and the no-show and cancel buttons
  • White#ffffffCards, inputs and the TV spotlight card
  • Colour

    Teal and ink on a mist background carry the brand and every action. Coral means your turn and is never used for text, amber marks delays and a doctor who has not started, and red is kept for errors and destructive actions. The TV uses the ink colour as its background, so it feels like the same product in a dark room

  • Typography

    Inter Variable, self-hosted so that no page calls a font service. Ticket numbers are extra bold with tabular figures and a slashed zero, so the board never shifts and 0 is never read as O, and the TV takes its sizes from nine clamp() steps tied to the screen's height and width

  • Components

    In-house React components on native elements, styled with Tailwind CSS v4 tokens: buttons in five tones and four sizes up to 64 px for the doctor's main action, word badges for status, ordering basis and priority flags, a native modal dialog, a live indicator, and loading, empty and error states that show the request ID

  • Accessibility

    One test checks 43 text and background pairs at 4.5:1, and another renders the TV screen and checks every visible text at 7:1. Focus shows a 3 px teal outline, touch targets are at least 44 px, calls are announced through live regions, and motion runs only when the device allows it

Where this fits

Clinics, laboratories and other services with walk-in traffic can use the same pattern: one explainable line, live status on every screen and no patient details on public displays. Explore our web apps and business systems, see our healthcare work, or talk to us about your clinic.

talk to us about your clinic

Let’s connect the dots

Let's put these ideas to work.

Share a process, product, or problem you want to improve. We will work through the possibilities together.

Discuss your project