Docs / BananaQueue / Architecture

Architecture

How BananaQueue is built, why the queue rules live in the database, and how live updates stay private.

BananaQueue is a small number of well-understood parts. The important design choice is that the database is the source of truth for every rule, so every screen behaves the same and no app can bypass the queue.

BananaQueue architecture: phones, browsers and TVs talk to the BananaQueue back end, which holds sign-in, the database with the queue engine, live updates, file storage and server functions. Customer phonesWeb app or iPhone app Staff screensCounter, queue desk, dashboard Lobby TVsAny browser, private link Website hostingCloudflare Pages (static) BananaQueue back end (Supabase) Sign-inEmail, codes, social Server functionsStaff accounts, licences PostgreSQL database Queue engine: numbering, call next, capacity, limits Row-level security: every organization walled off Event log and audit log Live updatesNumbers and counters only,never names File storageLogos and brand assets

The parts#

Part Technology Role
Web app React, TypeScript, Vite; installable as a home-screen app Customer pages, staff app, counter console, TV display, administration
iPhone app Expo (React Native) Customer, counter and owner modes
Shared code TypeScript packages Queue rules mirror, English and Filipino text, design tokens, typed API client
Back end Supabase: PostgreSQL, Auth, Realtime, Storage, Edge Functions Data, rules, sign-in, live updates, files
Hosting Cloudflare Pages Serves the web app worldwide
Scheduled jobs pg_cron, inside the database Daily clean-up of expired personal data

Why the rules live in the database#

The queue engine is a set of database functions. Taking a number, booking a slot and calling the next person each run as a single transaction with row locks:

  • No duplicate or missing numbers, even when dozens of people join in the same second.
  • Nobody is served twice: two counters pressing Call next at once always get different people.
  • No overbooking: the last appointment slot can't be taken twice.
  • No back doors: the web app, the iPhone app and the TV all go through the same functions, and none of them can skip the checks.

The shared TypeScript code mirrors the rules so screens can show hints instantly, but the database always decides. The rules are covered by automated tests, including the TypeScript mirror at 100% coverage and database tests for every guarantee above.

Multi-tenancy#

Every organization's records carry its company. Row-level security on every table lets a signed-in person see and change only the companies their role reaches. This is enforced by the database itself, not just by the app, so even a hand-crafted request can't read another organization's data. Automated tests confirm that reads across organizations return nothing and actions across organizations are refused.

Live updates without leaking data#

  • Staff screens receive changes to tickets through row-level security, so they only ever see their own organization.
  • Customer ticket pages and TVs are anonymous. They receive a tiny broadcast carrying only the ticket number, status and counter, then ask the database for the details their private link allows. That broadcast never contains a name, email or mobile number.
  • If a live update is ever missed, the screen catches up on the next refresh. The queue itself never depends on the broadcast.

One code base, every edition#

BananaQueue Cloud, private-cloud copies and the on-premise edition run the same code and the same database structure. A single settings row marks an installation as cloud or private. Only the database owner can change it, and the app reads it to decide whether to accept a licence and a custom brand.

Ready for what's next#

The data model already has places for upcoming features:

  • Payments: provider accounts and invoices, ready for GCash, Maya and QR Ph.
  • Notifications: an outbox of messages, ready for an SMS or email provider.
  • Forecasting: every ticket change is kept in an event log with timestamps, the basis for future busy-hour predictions and staffing suggestions.

Last updated 4 December 2026 · BananaQueue 0.2.0