A complete, runnable queue management system for solo student demo. Built with Node.js, Express, React, and WebSocket.
# 1. Install all dependencies
npm run install-all
# 2. Seed the database
npm run seed
# 3. Start both server and client
npm run devThe app will open automatically on http://localhost:5173
The simplest production setup is to deploy the server/ folder as a single web service. The backend serves the built React app from client/dist when it is present.
- Create a new Web Service and point it at the
server/folder. - Set the build command to
npm run build. - Set the start command to
npm start. - Keep
PORTandJWT_SECRETin the service environment variables.
If you deploy the frontend separately, set these client variables during the build:
VITE_API_BASE_URL=https://your-backend.example.com/api
VITE_WS_URL=wss://your-backend.example.comFor local development, no extra client env vars are required.
- Service Management: Multiple service types (Loan, Cash, Support)
- Counter Management: Multiple counters per service
- Token System: Auto-generated tokens (A-001, B-002, etc.)
- Auto-Assignment: System automatically assigns tokens to available counters
- Real-time Updates: WebSocket broadcasts queue status to display boards
- Staff Dashboard: Simple interface to start/complete services
- Kiosk: Customer-facing page to generate tokens
- Display Board: Real-time queue status display
- Admin Dashboard: View stats and system status
1. Open Kiosk (http://localhost:5173/kiosk)
- Select a service
- Get a token (e.g., A-001)
- See your position in queue
2. Login as Staff (http://localhost:5173/login)
- Email:
staff1@demo.comorstaff2@demo.com - Password:
staff123 - Select "Staff" tab
3. Staff Dashboard (http://localhost:5173/staff)
- Automatically shows next token when available
- Click "Start Service" β "Complete Service"
- Next token auto-assigns to counter
4. Open Display Board (http://localhost:5173/display)
- Real-time updates via WebSocket
- Shows "Now Serving" and "Next in Queue"
5. Admin Dashboard (http://localhost:5173/admin)
- Email:
admin@demo.com - Password:
admin123 - View services, counters, and stats
- Models: Admin, Service, Counter, Token, Staff
- QueueManager: FIFO queue logic + auto-assignment
- WebSocket: Real-time broadcast of queue updates
- SQLite: Single database file (
db.sqlite)
- Pages: Kiosk, Display, Staff, Admin, Login
- Real-time: WebSocket connection to display board
- Styling: Tailwind CSS
- One Queue Per Service: Each service has its own FIFO queue
- Auto-Assignment: When counter is AVAILABLE, next token is automatically assigned
- Token Lifecycle: WAITING β CALLED β IN_PROGRESS β COMPLETED
- Multiple Counters: Many counters can serve same service
- Real-time Broadcast: All updates pushed to display boards via WebSocket
prjt/
βββ server/
β βββ models/
β β βββ index.js (connections)
β β βββ Admin.js
β β βββ Service.js
β β βββ Counter.js
β β βββ Token.js
β β βββ Staff.js
β βββ routes/
β β βββ auth.js
β β βββ services.js
β β βββ counters.js
β β βββ tokens.js
β β βββ staff.js
β β βββ admin.js
β βββ middleware/
β β βββ auth.js
β βββ QueueManager.js
β βββ websocket.js
β βββ server.js
βββ client/
β βββ src/
β β βββ pages/
β β β βββ Login.jsx
β β β βββ Kiosk.jsx
β β β βββ Display.jsx
β β β βββ Staff.jsx
β β β βββ Admin.jsx
β β βββ App.jsx
β β βββ main.jsx
β β βββ api.js
β βββ index.html
β βββ vite.config.js
β βββ package.json
βββ seed.js
βββ package.json
βββ README.md
- Email:
admin@demo.com - Password:
admin123
- Email:
staff1@demo.com - Password:
staff123 - Counter: #1 (Loan Services)
- Email:
staff2@demo.com - Password:
staff123 - Counter: #2 (Cash Withdrawal)
Backend
- Node.js + Express
- Sequelize ORM
- SQLite
- WebSocket (ws)
- JWT + bcryptjs
- dotenv
Frontend
- React + Vite
- Tailwind CSS
- Axios
- React Router v6
POST /api/auth/admin/loginPOST /api/auth/staff/login
GET /api/servicesPOST /api/services(admin)
GET /api/countersPOST /api/counters(admin)PATCH /api/counters/:id(admin)
POST /api/tokens/generateGET /api/tokens/:serviceIdGET /api/tokens/:serviceId/queuePATCH /api/tokens/:id/start(staff)PATCH /api/tokens/:id/complete(staff)
GET /api/admin/dashboard
GET /api/staff
Connect to ws://localhost:5000 and receive real-time updates:
{
"nowServing": [
{ "counterNo": 1, "tokenNo": "A-001" }
],
"waiting": [
{ "tokenNo": "A-002" },
{ "tokenNo": "A-003" }
]
}cd server
npm install
npm run devcd client
npm install
npm run devβ Complete working system (no TODOs or stubs) β Real-time queue management β Auto-assignment of tokens β Responsive, mobile-friendly UI β Simple but clean code logic β Single SQLite database (no setup needed) β Pre-seeded data β Clear demo flow
Enjoy your Queue Management System! π