Skip to content

ichibulup/restaurant-experiment-system

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

1 Commit
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐Ÿฝ๏ธ Restaurant Management System - Multi-Platform

Hแป‡ thแป‘ng quแบฃn lรฝ nhร  hร ng ฤ‘a nแปn tแบฃng vแป›i Mobile App (Expo), Web Admin/Staff (Next.js), vร  Express Server vแป›i cฦก sแปŸ dแปฏ liแป‡u ฤ‘ฦฐแปฃc tแป‘i ฦฐu hรณa cho Supabase.

๐ŸŽฏ Tแป•ng Quan Dแปฑ รn

ฤรขy lร  mแป™t hแป‡ thแป‘ng quแบฃn lรฝ nhร  hร ng hoร n chแป‰nh hแป— trแปฃ:

๐Ÿ“ฑ Mobile App (Expo - React Native)

  • ฤแบทt bร n trแปฑc tuyแบฟn
  • Quรฉt QR code ฤ‘แปƒ gแปi mรณn tแบกi bร n
  • Thanh toรกn qua vรญ ฤ‘iแป‡n tแปญ (MoMo, ZaloPay, VNPay, etc.)
  • Theo dรตi trแบกng thรกi ฤ‘ฦกn hร ng real-time
  • ฤรกnh giรก mรณn ฤƒn vร  dแป‹ch vแปฅ
  • Quแบฃn lรฝ lแป‹ch sแปญ ฤ‘ฦกn hร ng

๐Ÿ’ป Web Admin (Next.js)

  • Dashboard quแบฃn lรฝ tแป•ng quan
  • Quแบฃn lรฝ chuแป—i nhร  hร ng vร  chi nhรกnh
  • Bรกo cรกo doanh thu vร  thแป‘ng kรช chi tiแบฟt
  • Quแบฃn lรฝ menu, giรก cแบฃ vร  khuyแบฟn mรฃi
  • Quแบฃn lรฝ nhรขn viรชn vร  lแป‹ch lร m viแป‡c
  • Quแบฃn lรฝ kho nguyรชn liแป‡u

๐Ÿ‘จโ€๐Ÿณ Web Staff (Next.js)

  • Giao diแป‡n nhรขn viรชn nhร  hร ng
  • Nhแบญn vร  xแปญ lรฝ ฤ‘ฦกn hร ng
  • Cแบญp nhแบญt trแบกng thรกi chแบฟ biแบฟn mรณn ฤƒn
  • Quแบฃn lรฝ bร n ฤƒn vร  ฤ‘แบทt bร n
  • Chแบฅm cรดng vร  xem lแป‹ch lร m viแป‡c

๐Ÿ”ง Backend (Express.js + Prisma)

  • API RESTful vร  GraphQL
  • Authentication vแป›i Clerk
  • Real-time updates vแป›i WebSocket
  • Tรญch hแปฃp payment gateways
  • Background jobs cho reports

๐Ÿ—„๏ธ Cแบฅu Trรบc Database

Entities Chรญnh:

๐Ÿข Organizations โ†’ Restaurant Chains โ†’ Restaurants
โ”œโ”€โ”€ ๐Ÿ‘ฅ Users & Staff Management
โ”œโ”€โ”€ ๐Ÿช‘ Tables & Reservations  
โ”œโ”€โ”€ ๐Ÿฝ๏ธ Menus & Items
โ”œโ”€โ”€ ๐Ÿ›’ Orders & Payments
โ”œโ”€โ”€ ๐Ÿช Inventory & Recipes
โ”œโ”€โ”€ ๐Ÿ“Š Analytics & Reports
โ””โ”€โ”€ ๐ŸŽŸ๏ธ Vouchers & Promotions

Tรญnh Nฤƒng Nแป•i Bแบญt:

  • โœ… Multi-tenant: Hแป— trแปฃ nhiแปu tแป• chแปฉc/chuแป—i nhร  hร ng
  • โœ… Real-time: Cแบญp nhแบญt trแบกng thรกi ฤ‘ฦกn hร ng real-time
  • โœ… Payment Integration: Hแป— trแปฃ ฤ‘a dแบกng phฦฐฦกng thแปฉc thanh toรกn
  • โœ… Inventory Management: Quแบฃn lรฝ kho tแปฑ ฤ‘แป™ng vแป›i cแบฃnh bรกo
  • โœ… Staff Scheduling: Lแป‹ch lร m viแป‡c vร  chแบฅm cรดng
  • โœ… Analytics: Bรกo cรกo doanh thu vร  thแป‘ng kรช chi tiแบฟt
  • โœ… QR Code: Gแปi mรณn tแบกi bร n khรดng cแบงn app
  • โœ… Review System: ฤรกnh giรก mรณn ฤƒn vร  dแป‹ch vแปฅ

๐Ÿš€ Quick Start

1. Setup Database

# Clone repository
git clone <repository-url>
cd eindrucksvoll-lieblings-haustier

# Setup Supabase database
cd applications/server
npm install
npx prisma generate
npx prisma db push

# Run migration scripts
psql -d your-database < prisma/migrations/restaurant_management_setup.sql

# Seed demo data
npx tsx prisma/seed.ts

2. Run Backend Server

cd applications/server
npm run dev
# Server runs on http://localhost:3001

3. Run Admin Web App

cd applications/admin  
npm install
npm run dev
# Admin panel: http://localhost:3000

4. Run Mobile App

cd applications/mobile
npm install
npx expo start
# Use Expo Go app to scan QR code

5. Environment Variables

Create .env files in each application:

# applications/server/.env
EXPRESS_DATABASE_URL="postgresql://user:pass@host:port/db"
EXPRESS_DIRECT_URL="postgresql://user:pass@host:port/db"
CLERK_SECRET_KEY="your-clerk-secret"
JWT_SECRET="your-jwt-secret"

# applications/admin/.env.local
NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY="your-clerk-key"
CLERK_SECRET_KEY="your-clerk-secret"
NEXT_PUBLIC_API_URL="http://localhost:3001"

# applications/mobile/.env
EXPO_PUBLIC_CLERK_PUBLISHABLE_KEY="your-clerk-key"
EXPO_PUBLIC_API_URL="http://localhost:3001"

๐Ÿ“Š Demo Accounts

Sau khi chแบกy seed script, bแบกn cรณ thแปƒ ฤ‘ฤƒng nhแบญp vแป›i:

๐Ÿ”‘ Admin: admin@restaurant.demo / demo123456
๐Ÿ‘จโ€๐Ÿ’ผ Manager: manager@restaurant.demo / demo123456  
๐Ÿ‘ค Customer: customer@restaurant.demo / demo123456
๐Ÿ‘จโ€๐Ÿณ Staff: staff@restaurant.demo / demo123456

๐Ÿ—๏ธ Architecture

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”    โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”    โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚   Mobile App    โ”‚    โ”‚   Admin Web     โ”‚    โ”‚   Staff Web     โ”‚
โ”‚   (Expo RN)     โ”‚    โ”‚   (Next.js)     โ”‚    โ”‚   (Next.js)     โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜    โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜    โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
         โ”‚                       โ”‚                       โ”‚
         โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                                 โ”‚
                    โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
                    โ”‚    Express Server       โ”‚
                    โ”‚  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”    โ”‚
                    โ”‚  โ”‚  REST API       โ”‚    โ”‚
                    โ”‚  โ”‚  GraphQL API    โ”‚    โ”‚
                    โ”‚  โ”‚  WebSocket      โ”‚    โ”‚
                    โ”‚  โ”‚  Auth (Clerk)   โ”‚    โ”‚
                    โ”‚  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜    โ”‚
                    โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                                 โ”‚
                    โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
                    โ”‚   Supabase PostgreSQL   โ”‚
                    โ”‚  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”    โ”‚
                    โ”‚  โ”‚  Restaurant DB  โ”‚    โ”‚
                    โ”‚  โ”‚  Optimized      โ”‚    โ”‚
                    โ”‚  โ”‚  with Triggers  โ”‚    โ”‚
                    โ”‚  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜    โ”‚
                    โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

๐Ÿ”ง Tech Stack

Frontend

  • Mobile: React Native + Expo
  • Web: Next.js 14 + TypeScript
  • UI: Tailwind CSS + shadcn/ui
  • State: React Query + Zustand

Backend

  • Server: Express.js + TypeScript
  • Database: PostgreSQL (Supabase)
  • ORM: Prisma
  • Auth: Clerk
  • API: REST + GraphQL (Apollo)

DevOps & Tools

  • Database: Prisma migrations
  • Testing: Jest + Testing Library
  • Linting: ESLint + Prettier
  • Type Safety: TypeScript strict mode

๐Ÿ“ Project Structure

eindrucksvoll-lieblings-haustier/
โ”œโ”€โ”€ applications/
โ”‚   โ”œโ”€โ”€ mobile/          # Expo React Native app
โ”‚   โ”œโ”€โ”€ admin/           # Next.js admin web app  
โ”‚   โ”œโ”€โ”€ client/          # Next.js customer web app
โ”‚   โ”œโ”€โ”€ desktop/         # Desktop app (future)
โ”‚   โ””โ”€โ”€ server/          # Express.js backend
โ”‚       โ”œโ”€โ”€ app/         # Application logic
โ”‚       โ”œโ”€โ”€ controllers/ # API controllers
โ”‚       โ”œโ”€โ”€ middlewares/ # Custom middlewares
โ”‚       โ”œโ”€โ”€ models/      # Business models
โ”‚       โ”œโ”€โ”€ prisma/      # Database schema & migrations
โ”‚       โ”œโ”€โ”€ routes/      # API routes
โ”‚       โ””โ”€โ”€ utils/       # Helper utilities
โ”œโ”€โ”€ packages/            # Shared packages
โ”‚   โ”œโ”€โ”€ config/          # Shared configuration
โ”‚   โ”œโ”€โ”€ core/            # Core business logic
โ”‚   โ”œโ”€โ”€ services/        # Shared services
โ”‚   โ”œโ”€โ”€ state/           # State management
โ”‚   โ”œโ”€โ”€ types/           # TypeScript types
โ”‚   โ””โ”€โ”€ utils/           # Shared utilities
โ”œโ”€โ”€ DATABASE_ANALYSIS.md # Database design documentation
โ”œโ”€โ”€ API_ROUTES_EXAMPLES.md # API documentation
โ””โ”€โ”€ README.md           # This file

๐Ÿš€ Deployment

Database (Supabase)

  1. Create new Supabase project
  2. Run Prisma migrations: npx prisma db push
  3. Execute setup script: restaurant_management_setup.sql
  4. Seed demo data: npx tsx prisma/seed.ts

Backend (Railway/Vercel)

# Build and deploy
npm run build
npm start

Web Apps (Vercel)

# Build Next.js apps
npm run build
npm run start

Mobile App (EAS Build)

# Build for iOS/Android
npx eas build --platform all
npx eas submit

๐Ÿ“ˆ Performance Optimizations

Database

  • โœ… Composite indexes cho queries phแป• biแบฟn
  • โœ… Triggers tแปฑ ฤ‘แป™ng cho revenue reports
  • โœ… Partitioning theo restaurant_id
  • โœ… Connection pooling

API

  • โœ… GraphQL DataLoader cho N+1 queries
  • โœ… Redis caching cho menu items
  • โœ… Background jobs cho heavy operations
  • โœ… Rate limiting vร  security headers

Frontend

  • โœ… Code splitting vแป›i dynamic imports
  • โœ… Image optimization vแป›i Next.js
  • โœ… React Query cho data caching
  • โœ… Virtual scrolling cho long lists

๐Ÿ”ฎ Roadmap

Phase 1 (Current) โœ…

  • Core database design
  • Basic CRUD operations
  • Authentication setup
  • Mobile app foundation

Phase 2 (Next)

  • Real-time order tracking
  • Payment gateway integration
  • Push notifications
  • Advanced analytics

Phase 3 (Future)

  • Multi-language support
  • Delivery management
  • Customer loyalty program
  • AI-powered recommendations

๐Ÿค Contributing

  1. Fork the repository
  2. Create feature branch: git checkout -b feature/amazing-feature
  3. Commit changes: git commit -m 'Add amazing feature'
  4. Push to branch: git push origin feature/amazing-feature
  5. Open Pull Request

๐Ÿ“„ License

This project is licensed under the MIT License - see LICENSE.md for details.

๐Ÿ†˜ Support


Made with โค๏ธ for Vietnamese restaurants worldwide ๐Ÿ‡ป๐Ÿ‡ณ

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages