All You Can Eat Restaurant Management System - A comprehensive web-based solution designed for managing All You Can Eat restaurants in Thailand. This system empowers SMEs and small-scale restaurant entrepreneurs with tools for efficient table management, real-time order processing, and data-driven analytics.
This system addresses common challenges faced by All You Can Eat restaurants:
- Flexible Table Management: Easily adjust table layouts to accommodate peak hours
- Real-time Operations: Track dining times, manage customer flow, and handle orders efficiently
- Data-Driven Insights: Analytics dashboard for informed business decisions
- QR Code Ordering: Customers scan QR codes to browse menus and place orders directly from their phones
- Multi-role Access: Separate interfaces for customers, staff, and administrators
- Access menu via QR code (no login required)
- Browse menu items organized by categories
- Place orders directly from mobile devices
- View order history for current session
- Real-time dashboard with key metrics (sales, customer count, table status)
- View and manage all tables with occupancy status
- Assign seats to customers with tier selection
- Process customer orders and checkout requests
- Track active dining sessions with countdown timers
- All staff capabilities plus:
- Configure table layouts (add/remove/resize tables)
- Manage menu items (add, edit, enable/disable)
- Configure pricing tiers
- Analytics dashboard with:
- Revenue per customer trends
- Customer count over time
- Tier preference analysis
- Peak hour identification
- Top-selling menu items
- Payment method breakdown
- Frontend: Next.js 16, React 19, TypeScript, Tailwind CSS
- Backend: Next.js API Routes (Server-side rendering)
- Database: PostgreSQL 16
- Containerization: Docker & Docker Compose
- Session Management: Cookie-based authentication
- QR Code Generation: qrcode library
- Node.js 20 or higher
- Docker and Docker Compose
- npm or yarn package manager
git clone <repository-url>
cd AYCE-ManagementCreate a .env file in the root directory:
# Database Configuration
DB_USER=
DB_PASSWORD=
DB_HOST=
DB_PORT=
DB_NAME=
# Next.js Configuration
NEXTCALLBACK=http://localhost:3000Environment Variables Explained:
DB_USER: PostgreSQL database usernameDB_PASSWORD: PostgreSQL database passwordDB_HOST: Database host (usepostgresfor Docker,localhostfor local development)DB_PORT: PostgreSQL port (default: 5432)DB_NAME: Database nameNEXTCALLBACK: Base URL for the application (used for callbacks and redirects)
This method automatically sets up PostgreSQL and the Next.js application in containers.
# Start all services (database + web application)
docker-compose up -d
# Check container status
docker-compose ps
# View application logs
docker-compose logs -f web
# View database logs
docker-compose logs -f postgresThe application will be available at http://localhost:3000
Default Admin Account:
- Username:
admin - Password:
admin123
For development without Docker:
# Install dependencies
npm install
# Update .env file to use localhost for database
# DB_HOST=localhost
# Start PostgreSQL (must be running separately)
# Initialize database
npm run db:setup
# Start development server
npm run devAccess the application at http://localhost:3000
# Initialize database schema only
npm run db:init
# Initialize database with sample accounts and data
npm run db:setup
# Run database migrations
npm run db:migrate# Access PostgreSQL container
docker exec -it ayce-postgres psql -U ayce_user -d ayce_db
# Backup database
docker exec ayce-postgres pg_dump -U ayce_user ayce_db > backup.sql
# Restore database
docker exec -i ayce-postgres psql -U ayce_user -d ayce_db < backup.sql-
Update environment variables for production in
.env -
Build and deploy:
# Build production images
docker-compose build
# Start services in detached mode
docker-compose up -d
# Scale web service (optional)
docker-compose up -d --scale web=3- Set up reverse proxy (nginx recommended) to handle:
- SSL/TLS certificates
- Load balancing
- Static file caching
For deploying the Next.js application to cloud platforms:
-
Set up external PostgreSQL database (e.g., Railway, Supabase, AWS RDS)
-
Update environment variables with cloud database credentials
-
Deploy to Vercel:
# Install Vercel CLI
npm i -g vercel
# Deploy
vercel
# Set environment variables in Vercel dashboard- Initialize database:
# Connect to your cloud database and run init scripts
psql <connection-string> -f init-scripts/AYCE.sql
psql <connection-string> -f init-scripts/seed-accounts.sql- Navigate to
http://localhost:3000/staff/login - Enter credentials
- Access the dashboard
- Staff assigns a table to customers
- System generates a QR code
- Customers scan QR code to access menu
- Customers browse and place orders
- Staff processes orders and checkout
AYCE-Management/
βββ app/ # Next.js app directory
β βββ api/ # API routes
β β βββ accounts/ # Account management
β β βββ analytics/ # Analytics data
β β βββ auth/ # Authentication
β β βββ menu/ # Menu management
β β βββ orders/ # Order processing
β β βββ tables/ # Table management
β β βββ tiers/ # Tier management
β βββ components/ # Reusable components
β βββ menu/ # Customer menu interface
β βββ staff/ # Staff/admin pages
βββ init-scripts/ # Database initialization
βββ lib/ # Utility functions
β βββ auth.ts # Authentication logic
β βββ database.ts # Database queries
β βββ db.ts # Database connection
βββ docker-compose.yml # Docker configuration
βββ Dockerfile # Docker image definition
βββ package.json # Dependencies
- PROJECT_OVERVIEW.md - Detailed project requirements and features
- FEATURES_IMPLEMENTATION.md - Feature implementation details
- ACCOUNT_MANAGEMENT.md - Account and authentication system
- DATABASE_QUERIES.md - Complete query documentation
- Change default admin credentials immediately after deployment
- Use strong passwords for database and admin accounts
- Keep environment variables secure and never commit
.envto version control - Use HTTPS in production
- Regularly update dependencies
# Development
npm run dev # Start development server
# Production
npm run build # Build for production
npm start # Start production server
# Database
npm run db:init # Initialize database schema
npm run db:setup # Setup database with accounts
npm run db:migrate # Run migrations
# Code Quality
npm run lint # Run ESLintThis is a private project for educational/business purposes. For contributions or suggestions, please contact the project owner.
Proprietary - All rights reserved
# Check if PostgreSQL is running
docker-compose ps
# Restart database
docker-compose restart postgres
# Check database logs
docker-compose logs postgresIf port 3000 or 5432 is already in use, update docker-compose.yml to use different ports.
# Stop all services
docker-compose down
# Remove volumes (WARNING: deletes all data)
docker-compose down -v
# Restart services
docker-compose up -dBuilt with β€οΈ for All You Can Eat Restaurant Management