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.
ฤรขy lร mแปt hแป thแปng quแบฃn lรฝ nhร hร ng hoร n chแปnh hแป trแปฃ:
- ฤแบท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
- 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
- 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
- API RESTful vร GraphQL
- Authentication vแปi Clerk
- Real-time updates vแปi WebSocket
- Tรญch hแปฃp payment gateways
- Background jobs cho reports
๐ข Organizations โ Restaurant Chains โ Restaurants
โโโ ๐ฅ Users & Staff Management
โโโ ๐ช Tables & Reservations
โโโ ๐ฝ๏ธ Menus & Items
โโโ ๐ Orders & Payments
โโโ ๐ช Inventory & Recipes
โโโ ๐ Analytics & Reports
โโโ ๐๏ธ Vouchers & Promotions
- โ 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แปฅ
# 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.tscd applications/server
npm run dev
# Server runs on http://localhost:3001cd applications/admin
npm install
npm run dev
# Admin panel: http://localhost:3000cd applications/mobile
npm install
npx expo start
# Use Expo Go app to scan QR codeCreate .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"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
โโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโ
โ 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 โ โ
โ โโโโโโโโโโโโโโโโโโโ โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโ
- Mobile: React Native + Expo
- Web: Next.js 14 + TypeScript
- UI: Tailwind CSS + shadcn/ui
- State: React Query + Zustand
- Server: Express.js + TypeScript
- Database: PostgreSQL (Supabase)
- ORM: Prisma
- Auth: Clerk
- API: REST + GraphQL (Apollo)
- Database: Prisma migrations
- Testing: Jest + Testing Library
- Linting: ESLint + Prettier
- Type Safety: TypeScript strict mode
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
- Create new Supabase project
- Run Prisma migrations:
npx prisma db push - Execute setup script:
restaurant_management_setup.sql - Seed demo data:
npx tsx prisma/seed.ts
# Build and deploy
npm run build
npm start# Build Next.js apps
npm run build
npm run start# Build for iOS/Android
npx eas build --platform all
npx eas submit- โ Composite indexes cho queries phแป biแบฟn
- โ Triggers tแปฑ ฤแปng cho revenue reports
- โ Partitioning theo restaurant_id
- โ Connection pooling
- โ GraphQL DataLoader cho N+1 queries
- โ Redis caching cho menu items
- โ Background jobs cho heavy operations
- โ Rate limiting vร security headers
- โ Code splitting vแปi dynamic imports
- โ Image optimization vแปi Next.js
- โ React Query cho data caching
- โ Virtual scrolling cho long lists
- Core database design
- Basic CRUD operations
- Authentication setup
- Mobile app foundation
- Real-time order tracking
- Payment gateway integration
- Push notifications
- Advanced analytics
- Multi-language support
- Delivery management
- Customer loyalty program
- AI-powered recommendations
- Fork the repository
- Create feature branch:
git checkout -b feature/amazing-feature - Commit changes:
git commit -m 'Add amazing feature' - Push to branch:
git push origin feature/amazing-feature - Open Pull Request
This project is licensed under the MIT License - see LICENSE.md for details.
- ๐ง Email: support@restaurant-system.com
- ๐ Documentation: Detailed docs
- ๐ Issues: GitHub Issues
- ๐ฌ Discussions: GitHub Discussions
Made with โค๏ธ for Vietnamese restaurants worldwide ๐ป๐ณ