QUEUELESS
A high-concurrency virtual queue platform eliminating physical waiting lines through dynamic QR check-ins, atomic position locking, and dual-layer real-time synchronization.
Double-Assignment Race Conditions & Tenant Leakage
When dozens of customers simultaneously scan venue QR codes to join busy clinic or retail queues, naive read-and-increment operations produce duplicate queue numbers. Additionally, multi-business platforms without strict tenant isolation risk exposing customer queue data across store accounts.
Atomic SQL Row Locking & Row-Level Security (RLS)
Implemented serialized position assignment using PostgreSQL row locking (SELECT ... FOR UPDATE) wrapped within ACID transactions. Multi-tenant boundaries are enforced at the database engine level through Supabase Row-Level Security (RLS), paired with dual-layer Supabase Realtime WebSockets and 5-second polling fallback.
Atomic Position Assignment Under Surge Load
How the platform eliminates double-allocation race conditions during simultaneous joins:
Customer opens browser via venue QR code. Payload is validated with Zod schemas including device fingerprinting.
Inside a Prisma transaction, the active queue row is locked at the SQL layer. Subsequent joins block until position number is committed.
Position dispatched over Supabase Realtime channel. Hermes-Relay sends automated SMS alert with customer turn updates.
Zero chance of duplicate position numbers regardless of burst traffic. All queue transitions (JOINED → CALLED → SERVING → COMPLETED) execute as atomic state machine mutations.
Dual-Layer Position Tracking Engine
Mobile connections in retail stores and clinics are notoriously unstable. QueueLess uses a resilient hybrid connection strategy:
Persistent WebSocket channel listening directly to PostgreSQL replication logs. When staff calls the next ticket, the customer mobile interface updates in sub-100ms without page refreshes.
If the mobile browser sleeps in the background or drops cellular signal, the client transparently activates lightweight 5-second polling to ensure tickets are never missed.
Row-Level Security (RLS) Boundaries
Strict isolation ensures businesses cannot inspect or interfere with competing queues:
All queries filter by authenticated business tenant ID automatically enforced in PostgreSQL.
Staff members can only invoke call, transfer, or complete mutations for their assigned venue desks.
Every queue state transition records staff timestamp, counter ID, and wait time metrics.
Architectural Stack & Decisions
| LAYER | TECHNOLOGY | TECHNICAL RATIONALE |
|---|---|---|
| Framework | Next.js 16 (App Router) | High-performance edge rendering, QR landing pages, server actions. |
| Database & RLS | Supabase PostgreSQL + Prisma ORM | Row-Level Security for multi-tenancy + ACID row locking for concurrency. |
| Real-Time | Supabase Realtime WebSockets | Low-latency database change broadcasting with heartbeat fallback. |
| SMS Dispatch | Hermes-Relay Gateway + Twilio | Automated SMS alerts for turn notifications and position updates. |
| QR Generation | Base64 Dynamic Canvas PNG | Zero-dependency dynamic QR generation for store check-in stations. |