Skip to content

PiyushNC/Digital_Queue_MIS

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

2 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Digital Queue Management System

A complete, runnable queue management system for solo student demo. Built with Node.js, Express, React, and WebSocket.

πŸš€ Quick Start

# 1. Install all dependencies
npm run install-all

# 2. Seed the database
npm run seed

# 3. Start both server and client
npm run dev

The app will open automatically on http://localhost:5173

πŸš€ Deployment

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.

Render example

  1. Create a new Web Service and point it at the server/ folder.
  2. Set the build command to npm run build.
  3. Set the start command to npm start.
  4. Keep PORT and JWT_SECRET in 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.com

For local development, no extra client env vars are required.

πŸ“‹ Features

  • 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

πŸ§ͺ Demo Flow

  • 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.com or staff2@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

πŸ“š System Architecture

Backend (Node.js + Express)

  • 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)

Frontend (React + Vite)

  • Pages: Kiosk, Display, Staff, Admin, Login
  • Real-time: WebSocket connection to display board
  • Styling: Tailwind CSS

πŸ”‘ Key Logic

  1. One Queue Per Service: Each service has its own FIFO queue
  2. Auto-Assignment: When counter is AVAILABLE, next token is automatically assigned
  3. Token Lifecycle: WAITING β†’ CALLED β†’ IN_PROGRESS β†’ COMPLETED
  4. Multiple Counters: Many counters can serve same service
  5. Real-time Broadcast: All updates pushed to display boards via WebSocket

πŸ“‚ Project Structure

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

πŸ” Login Credentials

Admin

  • Email: admin@demo.com
  • Password: admin123

Staff 1

  • Email: staff1@demo.com
  • Password: staff123
  • Counter: #1 (Loan Services)

Staff 2

  • Email: staff2@demo.com
  • Password: staff123
  • Counter: #2 (Cash Withdrawal)

πŸ› οΈ Tech Stack

Backend

  • Node.js + Express
  • Sequelize ORM
  • SQLite
  • WebSocket (ws)
  • JWT + bcryptjs
  • dotenv

Frontend

  • React + Vite
  • Tailwind CSS
  • Axios
  • React Router v6

πŸ“ Endpoints

Auth

  • POST /api/auth/admin/login
  • POST /api/auth/staff/login

Services

  • GET /api/services
  • POST /api/services (admin)

Counters

  • GET /api/counters
  • POST /api/counters (admin)
  • PATCH /api/counters/:id (admin)

Tokens

  • POST /api/tokens/generate
  • GET /api/tokens/:serviceId
  • GET /api/tokens/:serviceId/queue
  • PATCH /api/tokens/:id/start (staff)
  • PATCH /api/tokens/:id/complete (staff)

Admin

  • GET /api/admin/dashboard

Staff

  • GET /api/staff

🚦 WebSocket Events

Connect to ws://localhost:5000 and receive real-time updates:

{
  "nowServing": [
    { "counterNo": 1, "tokenNo": "A-001" }
  ],
  "waiting": [
    { "tokenNo": "A-002" },
    { "tokenNo": "A-003" }
  ]
}

βš™οΈ Running Individual Services

Server Only

cd server
npm install
npm run dev

Client Only

cd client
npm install
npm run dev

🎯 What Makes This Demo-Ready

βœ… 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! πŸŽ‰

About

Lab project for MIS sem 5

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors