A modern, production-ready QR code-based restaurant ordering system built with Node.js, React, and PostgreSQL.
- Full-Stack Application: Monorepo structure with integrated frontend/backend
- Backend: Node.js + Express.js + TypeScript
- Frontend: React + Vite + TypeScript + TailwindCSS
- Database: PostgreSQL 16 with Row-Level Security
- Multi-Tenancy: Complete tenant isolation with RLS policies
- Real-time: Server-Sent Events for live updates
- Node.js 18+
- npm 9+
- PostgreSQL 13+
- Clone the repository:
git clone <repository-url>
cd OrderHere- Install dependencies:
npm install- Set up environment variables:
cp .env.example .env
# Edit .env with your database credentials and other settings- Set up the database:
# Create database
createdb orderhere_dev
# Run migrations
psql -d orderhere_dev -f src/backend/src/database/schema.sql
# (Optional) Load sample data
psql -d orderhere_dev -f src/backend/src/database/seeds/001_sample_data.sql- Start development servers:
# Start both frontend and backend
npm run dev
# Or start individually:
# Backend only: npm run dev --workspace=@orderhere/backend
# Frontend only: npm run dev --workspace=@orderhere/frontendOrderHere/
├── src/
│ ├── backend/ # Node.js API server
│ │ ├── src/
│ │ │ ├── database/ # Database schema and migrations
│ │ │ │ ├── migrations/
│ │ │ │ ├── seeds/
│ │ │ │ ├── schema.sql
│ │ │ │ └── connection.ts
│ │ │ └── index.ts
│ │ ├── package.json
│ │ └── tsconfig.json
│ └── frontend/ # React frontend
│ ├── src/
│ │ ├── App.tsx
│ │ ├── main.tsx
│ │ └── index.css
│ ├── index.html
│ ├── package.json
│ ├── tsconfig.json
│ └── vite.config.ts
├── package.json # Root workspace configuration
├── .eslintrc.js # Shared ESLint configuration
├── .gitignore
├── .env.example
└── README.md
- Tenant Isolation: Complete data separation using PostgreSQL RLS
- User Management: GitLab-style user and team management
- Role-Based Access: Owner, Admin, Manager, Staff roles per tenant
- Email Invitations: Secure user invitation system
- Table-Specific QR Codes: Each table has unique QR code
- Real-Time Orders: Server-Sent Events for live order updates
- Order Management: Complete order lifecycle management
- Row-Level Security: Automatic tenant isolation
- Optimized Indexes: Performance-focused database design
- Audit Trail: Created/updated timestamps on all tables
tenants- Restaurant informationusers- Global user accountstenant_memberships- User-tenant relationships with rolesinvitations- Email invitation systemcategories- Menu categories per tenantmenu_items- Restaurant menu itemsqr_codes- Table-specific QR codesorders- Customer ordersorder_items- Individual order line items
- Row-Level Security policies ensure complete tenant isolation
- Users can only access data for tenants they belong to
- Automatic context setting for RLS policies
# Development
npm run dev # Start all workspaces
npm run dev --workspace=backend # Backend only
npm run dev --workspace=frontend # Frontend only
# Building
npm run build # Build all workspaces
npm run typecheck # Type check all workspaces
npm run lint # Lint all workspaces
# Testing
npm run test # Run tests in all workspacesKey environment variables (see .env.example):
DATABASE_URL- PostgreSQL connection stringJWT_SECRET- JWT signing secretSMTP_*- Email configuration for invitationsFRONTEND_URL- Frontend URL for CORS
# Upload deployment script to server
scp orderhere-manager.sh root@your-server:/root/
# Full deployment process
sudo ./orderhere-manager.sh update
sudo ./orderhere-manager.sh backup- 📋
orderhere-manager.sh- All-in-one management script - 📚
ORDERHERE_MANAGER_GUIDE.md- Complete deployment guide - 🗂️
huongdan.md- Vietnamese deployment manual
- ✅ Multi-tenant SaaS: Complete restaurant isolation
- ✅ QR Code Ordering: Table-specific ordering system
- ✅ Real-time Updates: Live order notifications via SSE
- ✅ Team Management: Owner/Administrator/Staff role system
- ✅ Menu Management: Full CRUD menu and item management
- ✅ Order Management: Complete order lifecycle
- ✅ Payment Integration: Table-based payment requests
- ✅ File Uploads: Logo and image management with S3
- ✅ Notifications: Real-time notification system
- ✅ Mobile Responsive: Optimized for all devices
MIT License - OrderHere Restaurant Ordering Platform