# Clinic Queue

> A queue and appointment app for Indonesian clinics: bookings and walk-ins in one fair line, live on the waiting-room TV and each patient's phone, with honest wait ranges.

Wait nearby. Come in when it is your turn.

- URL: https://weaveward.com/work/clinic-queue-appointments
- Year: 2026
- Industry: Healthcare
- Capabilities: Web apps, Business systems
- Technologies: TypeScript, Hono, Node.js, React, Vite, SQLite, Server-Sent Events, Web Speech API, fast-check

## The challenge

At Indonesian clinics, patients often wait for hours 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 want online booking, a live queue on the waiting-room TV and on each patient's phone, honest wait estimates and fewer no-shows, without putting patient details on a public screen.

## What we built

Clinic Queue is one installable web app with four views: booking and live status on the patient's phone, a front-desk console, a doctor console and the waiting-room TV.

- **Bookings and walk-ins in one line.** One installation serves many clinics, each with its own doctors, rooms, schedules and slots. Patients book online, walk-ins check in by scanning a QR code at the front desk, and both join the same queue
- **A fair, explainable order.** A booking keeps its priority within a grace window around its time, walk-ins are served first come, first served, and configurable flags such as elderly or urgent move a patient forward with a recorded reason
- **Consoles for the desk and the doctor.** Doctors call the next patient from their console, and staff can recall, skip, transfer a patient to another room, mark a visit done or record a no-show. Every action is written to an audit log of who did what
- **A TV the whole room can follow.** The queue display uses type large enough to read from five metres, then plays a chime and announces each call in Indonesian, such as "Nomor antrean A-012, silakan ke Ruang 2"
- **Live status on the patient's phone.** A signed status link shows the patient's place in line and a wait range. Notifications such as "you are third in line" or "please come to Room 2" are WhatsApp-style messages composed behind a notification adapter, so the delivery provider can change without touching the queue
- **Overbooking advice from no-show history.** No-show rates are tracked per slot type, and each session gets a modest overbooking recommendation for the front desk
- **Privacy by design.** Public screens show only ticket numbers and initials, status links are signed and expire, and every query is scoped to one clinic

## How it works

### Book or check in

A patient books a slot from the phone, or arrives as a walk-in and scans the QR code at the front desk. Either way the patient gets a ticket number and a signed link to a live status page.

### Every action becomes an event

Check-ins, calls, recalls, skips, transfers, completions and no-shows are appended to an event log, and a pure reducer derives the queue from it. The same log is the audit trail, and replaying it rebuilds the queue as it stood at any moment.

### Live updates over SSE

The API fans each change out over Server-Sent Events, per clinic and per room, so the TV, both consoles and every patient's status page move as soon as the queue does.

### Wait ranges, not minutes

The estimate comes from each doctor's recent consultation durations, kept as rolling quantiles. The status page shows a range from the median (P50) to the 90th percentile (P90) instead of one falsely precise minute.

## Engineering insights

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

- **The queue is a pure fold over events.** Every queue action is stored as an event, and the queue state is derived rather than updated in place. Because the reducer is pure, replaying the same events always yields the same queue, so the audit log doubles as a way to rebuild any past state
- **Invariants hold under random sequences.** Property tests built with fast-check generate random sequences of queue actions and check that no ticket appears twice, that every ticket ends in exactly one terminal state and that the ordering policy holds
- **Tenancy in every query.** Storage sits behind a thin repository layer over SQLite with migrations, and every query in it is scoped by clinic. Tests check that one clinic can never read another clinic's data
- **Links that expire.** A patient's status page opens from a signed token with an expiry rather than a guessable ID, and tests cover both the signing and the expiry
- **Overbooking advised, never imposed.** No-show rates are tracked per slot type rather than per patient. A newsvendor-style calculation, which weighs an idle slot against an overfull session, recommends a modest number of extra bookings, and the front desk decides whether to use them

## Design system

Calm care is a reassuring, legible design language for anxious and often elderly patients, who read a TV across a crowded waiting room or a phone while they wait outside.

- **Colour.** Clinic teal and ink on mist and white keep every screen quiet. Coral appears only when it is your turn, and amber only for delays
- **Typography.** Inter throughout, with ticket numbers in very large tabular numerals, so the board does not shift as A-012 becomes A-013
- **Components.** The TV queue display, the patient status card, the front-desk console and the doctor console are built from one set of design tokens, so a ticket looks the same on every screen
- **Accessibility.** Text contrast is at least 4.5:1 everywhere and 7:1 on the TV, and every call is shown, chimed and spoken, so no patient depends on sight or hearing alone

## Where this fits

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