A production-inspired Point-of-Sale (POS) system for cafes built with Node.js + React + PostgreSQL during a 15-hour hackathon.
Status: π Foundation complete, ready for feature implementation
- Orders: Create, modify, and complete customer orders
- Kitchen Display: Real-time kitchen ticket system (KDS)
- Table Management: Track dining tables and customer status
- Payments: Process cash, card, and UPI payments
- Reports: Sales analytics by category, time period, employee
- Self-Ordering: QR-code-based table self-ordering
- Real-Time Updates: Socket.IO for live order and table status
| Layer | Technology | Purpose |
|---|---|---|
| Backend | Node.js + Express + TypeScript | REST API & Socket.IO server |
| Database | PostgreSQL + Prisma ORM | Data persistence with migrations |
| Frontend | React 18 + Vite + TypeScript | User interface |
| State | Zustand | Client-side state management |
| Real-Time | Socket.IO | Live updates (kitchen, tables) |
| Styling | Tailwind CSS + Shadcn UI | Component library |
| HTTP | Axios | API client with interceptors |
| Auth | JWT + bcrypt | Authentication & authorization |
- Node.js 18+
- PostgreSQL 12+
- npm or yarn
# Backend setup
cd backend
cp .env.example .env
npm install
# Frontend setup
cd ../frontend
cp .env.example .env
npm installcd backend
# Create migrations
npx prisma migrate dev --name init
# Seed sample data
npm run seed# Terminal 1: Backend
cd backend
npm run dev # Runs on http://localhost:5000
# Terminal 2: Frontend
cd frontend
npm run dev # Runs on http://localhost:5173cd backend
npx prisma studio # Opens at http://localhost:5555Odoo-Cafe/
βββ backend/ # Node.js + Express API
β βββ src/
β β βββ modules/ # Feature modules (auth, products, orders, etc.)
β β βββ database/ # Prisma ORM & migrations
β β βββ middleware/ # Express middleware
β β βββ shared/ # Enums, interfaces, validators
β β βββ app.ts # Express app setup
β β βββ server.ts # HTTP server + Socket.IO
β βββ package.json
β
βββ frontend/ # React + Vite
β βββ src/
β β βββ pages/ # Page components
β β βββ components/ # Reusable UI components
β β βββ services/ # API client & services
β β βββ store/ # Zustand state stores
β β βββ App.tsx # Root component
β β βββ main.tsx # Entry point
β βββ package.json
β
βββ docs/
β βββ database-schema.md # Full data model documentation
β βββ API_CONTRACTS.md # (to be created)
β
βββ IMPLEMENTATION_GUIDE.md # Team guide for hackathon
14 Models Total:
- Core: User, Session, Order, OrderItem, Table, Product, Category, Customer, Payment
- Supporting: Coupon, Promotion, KitchenTicket, SelfOrderToken, Floor
See database-schema.md for complete ERD and model definitions.
- Users have roles:
ADMIN,EMPLOYEE,KITCHEN - Login returns JWT token stored in localStorage
- Token automatically added to all API requests
- 401 responses redirect to login page
POST /api/auth/login # Login
POST /api/auth/register # Register
GET /api/auth/me # Current user
POST /api/auth/logout # Logout
GET /api/products # List products
POST /api/products # Create product
GET /api/categories # List categories
POST /api/orders # Create order
GET /api/orders/:id # Get order details
PUT /api/orders/:id # Update order
POST /api/payments # Process payment
GET /api/tables # List tables
PUT /api/tables/:id # Update table status
GET /api/kitchen/tickets # Get pending kitchen tickets
PUT /api/kitchen/tickets/:id # Update ticket status
GET /api/reports/sales # Sales summary
// Kitchen updates
socket.emit("kitchen:order-update", { orderId, status });
socket.on("kitchen:status-changed", (data) => {});
// Table updates
socket.emit("table:status-change", { tableId, status });
socket.on("table:updated", (data) => {});- Database schema
- Folder structure
- Seed data
- Starter files
- Auth module (login/register)
- Products & Categories CRUD
- Basic order creation
- Orders with items & pricing
- Kitchen display system
- Payment processing
- Table management UI
- Reports dashboard
- Real-time updates
- Self-ordering (QR)
- Promotions/coupons
- Deploy
Philosophy: "Database first, then build."
- Schema is locked β Everyone works from same data model
- Modules are independent β Backend & frontend can work in parallel
- Socket.IO for real-time β No polling, stay responsive
- Skip overengineering β Focus on working features
- Deploy early β Get something live ASAP
# Backend: Run tests (once implemented)
npm test
# Frontend: Run tests
npm testSee .env.example in both backend/ and frontend/ directories.
Critical for backend:
DATABASE_URL=postgresql://user:password@localhost:5432/odoo_cafe
JWT_SECRET=your_secret_key
PORT=5000
- Backend: Deploy to Heroku, Render, or Railway
- Frontend: Deploy to Vercel, Netlify, or Cloudflare Pages
- Database: Heroku PostgreSQL or Neon DB
See docs/DEPLOYMENT.md (to be created).
# Check PostgreSQL is running
psql -U postgres -c "SELECT version();"
# Verify DATABASE_URL in .env
# Format: postgresql://user:password@localhost:5432/dbname# Backend (5000)
lsof -ti:5000 | xargs kill -9
# Frontend (5173)
lsof -ti:5173 | xargs kill -9# Reset database (clears all data)
npx prisma migrate reset- Database Schema - Complete data model
- Implementation Guide - Team guide for hackathon
- API Contracts (coming soon)
- Deployment Guide (coming soon)
| Role | Responsibility |
|---|---|
| Backend Dev 1 | Auth module + core CRUD |
| Backend Dev 2 | Orders + payments + reports |
| Frontend Dev 1 | Auth UI + dashboard |
| Frontend Dev 2 | Orders + kitchen display |
- Database schema is immutable during hackathon (no changes without team discussion)
- Each module should have isolated tests
- Socket.IO events for real-time features (don't poll)
- Always validate user input on backend
- Use TypeScript for type safety
MIT
Let's build something great! π
For questions, check IMPLEMENTATION_GUIDE.md first.