Skip to content

Kride024/queue-app

Repository files navigation

NowServing — Queue Management App

A full-stack walk-in queue manager. A manager signs in, creates named queues, adds people as tokens, reorders or calls them, and watches wait-time analytics update on a dashboard — styled like a departures/dispatch board.

Built for the Rugas Team full-stack assignment.

Features

  • Manager auth — register / log in / log out (JWT in an HTTP-only cookie).
  • Queues — create any number of named queues (e.g. "Front Desk", "Pharmacy").
  • Tokens — add a person to a queue; each gets a sequential token number.
  • Live queue view — see everyone waiting, in order.
  • Reorder — move any waiting token up or down.
  • Call next — one click assigns the token at the top of the queue for service.
  • Serve / cancel — mark the token being served as done, or cancel any token.
  • Dashboard analytics — active queues, people waiting now, tokens added today, average wait time, a 14-day "tokens added" trend chart, average wait time per queue, and a recently-served log.

Tech stack

  • Next.js 14 (App Router) + TypeScript — one full-stack app (UI + API routes) instead of separate frontend/backend services.
  • SQLite via better-sqlite3 — a zero-config embedded database; the whole app runs with no external DB to install.
  • Tailwind CSS for styling; Recharts for the analytics charts.
  • jsonwebtoken + bcryptjs for auth.

Getting started

npm install
cp .env.example .env       # sets JWT_SECRET — edit the value before deploying
npm run dev                # http://localhost:3000

On first run the app creates data/app.db automatically (SQLite file, git-ignored) and sets up all tables — no migration step needed.

For a production build:

npm run build
npm run start

How the pieces fit together

app/
  login/, register/          Auth pages
  dashboard/                 Queue list + analytics (server component)
  queues/[id]/                Single queue: now-serving board, add token, reorder
  api/
    auth/{register,login,logout,me}
    queues/                  list/create queues
    queues/[id]/              queue detail, delete
    queues/[id]/tokens        add a token
    queues/[id]/serve-next    call the token at the top of the queue
    tokens/[id]               cancel a token
    tokens/[id]/move          reorder up/down
    tokens/[id]/complete      mark the currently-serving token as served
    analytics                 dashboard metrics
lib/
  db.ts                      SQLite connection + schema
  queries.ts                 all data access / business logic
  auth.ts                    JWT signing/verification, password hashing
components/                  UI building blocks (forms, token rows, charts, etc.)

Data model (three tables): managers, queues, tokens. A token's status moves through WAITING → SERVING → SERVED, or WAITING/SERVING → CANCELLED. position orders the waiting list; called_at / served_at timestamps feed the wait-time analytics.

Notes

  • Each manager only ever sees their own queues and tokens — every API route checks queue/token ownership against the logged-in session.
  • Only one token per queue can be in SERVING state at a time, matching how a single counter/desk actually works — "Call next" is disabled until the current token is marked served or cancelled.
  • Cancelled/served tokens are kept (not deleted) so the dashboard's wait-time and trend analytics have history to draw from.

Releases

Packages

Contributors

Languages