How utsoft7/pos-system works
1. System shape
- This is a classic 3-tier restaurant POS: a React frontend, an Express/Node API, and a MongoDB/Mongoose data layer.
- The app is containerized with Docker / Docker Compose, and the frontend includes an Nginx config for production serving.
2. Frontend boundary
- The frontend is a Vite React app organized by feature area: auth, dashboard, home, menu, kitchen, orders, tables, invoice, and shared UI.
- src/pages acts as the route-level shell, while src/components/* contains the domain screens and widgets.
3. Client state and server-state split
- Redux Toolkit is used for local/global app state: cart, customer, and user.
- Server interaction is handled separately through src/https (Axios wrapper) and src/hooks/useLoadData.js, suggesting cached/query-style fetching for backend data.
4. User-facing workflow
- The main operational flow is: authenticate → select table → build cart → place order → generate KOT/invoice → take payment.
- The frontend has dedicated UI pieces for each step: menu cart info, customer info, bill/invoice, kitchen ticket, table cards, and order cards.
5. Backend API layout
- The backend is structured conventionally: routes → controllers → models, with each business area separated into its own module.
- Routes exist for users, tables, orders, and payments, each mapped to a corresponding controller.
6. Domain model boundaries
- Mongo collections are represented by Mongoose models for users, tables, orders, payments, KOTs, and counters.
- The presence of a counter model suggests sequence generation for order/KOT/invoice numbering, which is important for POS-style records.
7. Authentication and request protection
- Authentication is JWT-based, with a dedicated token verification middleware guarding protected backend routes.
- User registration/login lives in the auth components on the frontend and user controller/route on the backend, with bcrypt implied by the README for password hashing.
8. Order, kitchen, and billing flow
- Orders are a central backend entity and appear to feed both kitchen tickets and billing/invoice generation.
- The separate KOT model indicates kitchen dispatch is treated as its own record, not just a UI artifact.
9. Payments
- Payment handling is isolated behind the payment route/controller and likely records transaction state in the database.
- The README indicates support for both cash and Razorpay online payments, so payment is a distinct integration boundary rather than being embedded in order creation.
10. Tables and occupancy management
- Table state is managed as first-class data, with the UI showing Booked vs Available status.
- This is likely updated by order lifecycle events and used to drive the floor/table selection experience.
11. Dashboard and analytics
- The dashboard aggregates operational metrics like earnings, recent orders, and daily performance.
- Frontend dashboard components suggest the API exposes summary endpoints or combined read operations for dashboard cards and recent activity lists.
12. Infrastructure and deployment
- The repository is designed to run as separate containers for frontend and backend, with Compose coordinating the stack.
- The frontend’s Nginx setup indicates production deployment behind a static web server, while the backend runs as an API service connected to MongoDB.
Main entry points: App.jsx App shell · axiosWrapper.js API client · server.js API server · orderModel.js Data models
Components 21
Frontend
React/Vite POS client
- App shell · Top-level client app and route composition
frontend/src/App.jsx - Pages · Route-level screens for auth, dashboard, home, menu, orders, tables, and more
frontend/src/pages/index.js - Auth UI · Login and registration flows
frontend/src/components/auth/Login.jsx - Dashboard · Metrics and recent order summaries
frontend/src/components/dashboard/Metrics.jsx - Home ops · Greeting, highlights, popular dishes, and recent activity
frontend/src/components/home/Greetings.jsx - Menu flow · Menu browsing, cart, customer info, and bill generation
frontend/src/components/menu/MenuContainer.jsx - Kitchen ticket · KOT-style kitchen dispatch view
frontend/src/components/kitchen/KitchenTicket.jsx - Tables · Table cards and occupancy selection
frontend/src/components/tables/TableCard.jsx - Orders · Order list and order cards
frontend/src/components/orders/OrderCard.jsx - Invoice · Invoice rendering and payment handoff
frontend/src/components/invoice/Invoice.jsx - Redux state · Cart, customer, and user slices
frontend/src/redux/store.js - API client · Axios wrapper and data loading hook
frontend/src/https/axiosWrapper.js
Backend
Express API and data layer
- API server · Server entrypoint wiring routes, middleware, and config
backend/server.js - Users · User registration, login, and protected session handling
backend/controllers/userController.js - Orders API · Order create/read/update flow
backend/controllers/orderController.js - Tables API · Table state and availability management
backend/controllers/tableController.js - Payments API · Cash and online payment processing
backend/controllers/paymentController.js - Data models · Users, tables, orders, payments, KOTs, and counters
backend/models/orderModel.js - Auth guard · Token verification and global error handling
backend/middlewares/tokenVerification.js
Infrastructure
Container and web serving setup
- Compose stack · Runs frontend, backend, and database containers together
docker-compose.yml - Nginx serving · Production frontend serving configuration
frontend/nginx.conf
Connections 33
- Pages → App shell: renders · Route pages are assembled by the app shell
- App shell → Auth UI: uses · Auth routes and screens
- App shell → Dashboard: uses · Dashboard screens
- App shell → Home ops: uses · Home and operations widgets
- App shell → Menu flow: uses · Menu, cart, customer, and bill workflow
- App shell → Kitchen ticket: uses · Kitchen ticket view
- App shell → Tables: uses · Table selection and occupancy UI
- App shell → Orders: uses · Order screens
- App shell → Invoice: uses · Invoice and billing screens
- Menu flow → Redux state: updates · Cart and customer state are managed locally
- Auth UI → Redux state: updates · Authenticated user state
- Dashboard → API client: loads · Fetches server summaries and metrics
- Home ops → API client: loads · Fetches operational lists and highlights
- Menu flow → API client: loads · Fetches menu and order-related data
- Orders → API client: loads · Fetches order records
- Tables → API client: loads · Fetches table state
- Invoice → API client: loads · Submits or reads billing data
- API client → API server: calls · HTTP API access
- API server → Auth guard: protects with · Token verification and error handling
- API server → Users: routes to · User API module
- API server → Orders API: routes to · Orders API module
- API server → Tables API: routes to · Tables API module
- API server → Payments API: routes to · Payments API module
- Users → Data models: reads/writes · User records and authentication data
- Orders API → Data models: reads/writes · Orders and KOT/counter records
- Tables API → Data models: reads/writes · Table occupancy and status
- Payments API → Data models: reads/writes · Payment transaction records
- Orders API → Payments API: triggers · Order settlement and payment handoff
- Orders API → Tables API: updates · Order lifecycle affects table availability
- Compose stack → API server: runs · Backend service container
- Compose stack → API client: connects · Frontend service container and API access
- Compose stack → Data models: provides db · MongoDB-backed persistence for the API
- Nginx serving → App shell: serves · Production static frontend hosting