Skip to content

Team-Detroit/Odoo-Hack

Repository files navigation

πŸͺ Odoo Cafe POS System

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


πŸ“‹ What This Does

  • 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

πŸ› οΈ Tech Stack

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

πŸš€ Quick Start

Prerequisites

  • Node.js 18+
  • PostgreSQL 12+
  • npm or yarn

1. Clone & Setup

# Backend setup
cd backend
cp .env.example .env
npm install

# Frontend setup
cd ../frontend
cp .env.example .env
npm install

2. Database Setup

cd backend

# Create migrations
npx prisma migrate dev --name init

# Seed sample data
npm run seed

3. Start Development Servers

# 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:5173

4. View Database (Optional)

cd backend
npx prisma studio   # Opens at http://localhost:5555

πŸ“ Project Structure

Odoo-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

πŸ“Š Database Schema

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.


πŸ” Authentication

  • 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

πŸ”„ API Routes (to be implemented)

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

πŸ“‘ Real-Time Events (Socket.IO)

// 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) => {});

πŸ“‹ Implementation Priority

Phase 1 (Hours 0-2): Foundation βœ… DONE

  • Database schema
  • Folder structure
  • Seed data
  • Starter files

Phase 2 (Hours 2-4): MVP Features

  • Auth module (login/register)
  • Products & Categories CRUD
  • Basic order creation

Phase 3 (Hours 4-8): Core Features

  • Orders with items & pricing
  • Kitchen display system
  • Payment processing

Phase 4 (Hours 8-12): Polish

  • Table management UI
  • Reports dashboard
  • Real-time updates

Phase 5 (Hours 12-15): Extra Features

  • Self-ordering (QR)
  • Promotions/coupons
  • Deploy

🎯 Hackathon Strategy

Philosophy: "Database first, then build."

  1. Schema is locked β†’ Everyone works from same data model
  2. Modules are independent β†’ Backend & frontend can work in parallel
  3. Socket.IO for real-time β†’ No polling, stay responsive
  4. Skip overengineering β†’ Focus on working features
  5. Deploy early β†’ Get something live ASAP

πŸ§ͺ Testing

# Backend: Run tests (once implemented)
npm test

# Frontend: Run tests
npm test

πŸ“¦ Environment Variables

See .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

🚒 Deployment

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


πŸ› Troubleshooting

Database connection error

# Check PostgreSQL is running
psql -U postgres -c "SELECT version();"

# Verify DATABASE_URL in .env
# Format: postgresql://user:password@localhost:5432/dbname

Port already in use

# Backend (5000)
lsof -ti:5000 | xargs kill -9

# Frontend (5173)
lsof -ti:5173 | xargs kill -9

Prisma migration error

# Reset database (clears all data)
npx prisma migrate reset

πŸ“š Documentation


πŸ‘₯ Team Roles

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

πŸ“ Notes

  • 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

πŸŽ“ Learning Resources


πŸ“„ License

MIT


Let's build something great! πŸš€

For questions, check IMPLEMENTATION_GUIDE.md first.

Releases

No releases published

Packages

 
 
 

Contributors

Languages