How shubh-debug/restaurant-pos-system works
Project type and purpose
• This is a full-stack MERN (MongoDB, Express, React, Node.js) Point-of-Sale (POS) system for restaurants.
• The README describes features such as real-time analytics, table management, order processing, billing/invoicing, KOT generation and Razorpay integration.
• The entire stack is containerized via Docker Compose, with separate frontend and backend services.
File structure
• Top-level directories:
• backend/ – Node.js + Express REST API
• frontend/ – React single-page application, Redux Toolkit, TanStack Query
• docker-compose.yml – orchestrates frontend, backend, database containers
• backend/ substructure:
• config/ – database and environment configuration
• controllers/ – MVC controllers for orders, payments, tables, users
• models/ – Mongoose schemas for orders, payments, tables, users, KOTs, counters
• routes/ – Express routes wired to controllers
• middlewares/ – global error handler, JWT verification
• server.js – entry point
• frontend/ substructure:
• public/ + index.html – host container for app
• src/ – React components organized by feature (auth, dashboard, home, menu, kitchen, etc.), pages, hooks, https layer, Redux slices, store
• nginx.conf – to serve built assets via NGINX in production
• vite.config.js – build config
• docker-compose.yml:
• Defines services for frontend, backend, MongoDB, possibly NGINX as reverse proxy
• Networks and volumes for data persistence
Additional insights from README
• Architecture highlights: RESTful API, JWT auth, containerized services, real-time state via React + TanStack Query, Redux for global state, Framer Motion, Tailwind CSS.
• Emphasis on production readiness and DevOps best practices (Docker, Docker Compose).
Main components & interactions
a. Frontend (React SPA)
• State management: Redux Toolkit + TanStack Query
• HTTP client: axios wrapper toward backend API
• Pages and feature components rendering UI, collecting user input
b. Backend API (Node.js + Express)
• Authentication middleware (JWT)
• Controllers implementing business logic for orders, payments, tables, users
• Models (Mongoose) interacting with MongoDB
• Global error handler
c. Database (MongoDB)
• Stores collections: users, tables, orders, payments, KOTs, counters
d. External Service: Razorpay
• Online payment processing via backend integration
e. KOT Printer or Kitchen subsystem
• Backend triggers KOT creation which can be sent to a printer service/subsystem
f. DevOps containers
• Docker Compose orchestrating frontend container (Node + NGINX), backend container (Node), MongoDB container
Architectural patterns & design principles
• Backend follows MVC: routes → controllers → models
• Frontend follows component-driven architecture with feature folders and centralized state management
• Separation of concerns: UI layer, API layer, data persistence
• Secure stateless auth with JWT
• Containerized micro-services pattern: each major service in its own Docker container
• Labels for each service, database, and external system
• Notes on ports or network (e.g., backend: 5000, frontend: 3000, MongoDB: 27017)