TicketBox is an end-to-end concert ticketing platform with an audience web app, an administration console, a NestJS backend/worker, and a Flutter gate scanner.
The implemented workflow covers concert discovery, seat locking, mock payment, ticket and QR issuance, email delivery, online/offline gate scanning, and one-time check-in enforcement.
| Project | Purpose | Documentation |
|---|---|---|
backend-core |
NestJS API, Prisma/PostgreSQL, Redis, worker, QR, email, PDF/CSV processing | Backend README |
web-client |
React audience site for events, seats, checkout, and personal tickets | Client README |
web-admin |
React administration console for events, artists, imports, tickets, devices, and statistics | Admin README |
mobile-gate/mobile_gate |
Flutter QR scanner with online and offline check-in | Mobile README |
blueprint |
System blueprint and implementation documentation | Blueprint README |
Required for the web/backend system:
- Node.js 20 or newer
- npm 10 or newer
- Docker Desktop with Docker Compose
- Git
- A Gemini API key for automatic artist PDF processing
- Optional SMTP credentials for real email delivery
Additional mobile requirements:
- Flutter SDK compatible with Dart
^3.12.1 - Java 17
- Android Studio with Android SDK 36
- Xcode and CocoaPods for iOS builds (macOS only)
Check installed tools:
node --version
npm --version
docker compose version
flutter doctorFlutter is optional when only running the backend and web applications.
From the repository root:
cd backend-core
npm install
docker compose up -d
Copy-Item .env.example .envOpen backend-core/.env and provide:
JWT_SECRETJWT_REFRESH_SECRETPAYMENT_WEBHOOK_SECRETGEMINI_API_KEY- The three generated
QR_*values
Generate QR signing and encryption values:
npm run keys:generateCopy the printed values into .env. Use long, different random strings for the
JWT and payment secrets. For development without SMTP, use:
NOTIFICATION_PROVIDER=logPrepare and seed the database:
npm run prisma:generate
npm run prisma:migrate:dev
npm run prisma:seedThe seed is intended for local demonstration data and recreates a populated system with Vietnamese artists, concerts, seating, users, purchases, tickets, check-in history, and dashboard statistics.
Run once for each application you intend to use:
cd web-client
npm install
cd ..\web-admin
npm install
cd ..\mobile-gate\mobile_gate
flutter pub getUse separate terminals from the repository root.
cd backend-core
npm run start:devcd backend-core
npm run workerThe worker is required for order expiry, email/outbox delivery, VIP CSV imports, Gemini artist PDF processing, reminders, and queue processing.
cd web-client
npm run devNormally available at http://127.0.0.1:5173.
cd web-admin
npm run devVite normally uses 5174 when the audience app already occupies 5173.
cd mobile-gate\mobile_gate
flutter devices
flutter runAndroid emulators use http://10.0.2.2:3000/api. A physical phone must use
http://<computer-LAN-IP>:3000/api and be able to reach port 3000.
| Service | URL |
|---|---|
| Backend API | http://localhost:3000/api |
| Swagger | http://localhost:3000/docs |
| Health check | http://localhost:3000/api/health |
| Audience web | http://127.0.0.1:5173 |
| Admin web | URL printed by Vite, commonly http://localhost:5174 |
| Prisma Studio (optional) | Run npm run db:studio in backend-core |
All seeded demo accounts use Password123!.
| Role | |
|---|---|
| Admin | admin@ticketbox.local |
| Organizer | organizer@ticketbox.local |
| Gate staff | staff@ticketbox.local |
| Audience | audience@demo.local |
- Sign in and select a concert.
- Choose exact VIP/SVIP seats or a standing-ticket quantity.
- Create the order and temporarily lock inventory.
- Complete the mock payment.
- Receive issued QR tickets and optional email delivery.
- Open
Vé của tôito display the ticket.
- Sign in to the Flutter app as staff.
- Select a concert and download its offline package.
- Scan the ticket online or offline.
- Sync queued scans after reconnecting.
- Already checked-in tickets are rejected on subsequent scans.
- Manage concerts, ticket types, seating, and check-in devices.
- Automatically create/reuse artists from PDF and link them to events.
- Import VIP guests from CSV.
- Review tickets, sales, check-in data, and dashboard charts.
- Delete only concerts without paid purchases and artists without event links.
Backend:
cd backend-core
npm run buildWeb applications:
cd web-client
npm run build
cd ..\web-admin
npm run buildMobile Android builds:
cd mobile-gate\mobile_gate
flutter build apk --debug
flutter build appbundle --release --dart-define=API_BASE_URL=https://your-api.example.com/apiProduction deployment should use HTTPS, production PostgreSQL/Redis, strong secrets, explicit CORS origins, a reverse proxy, and a real Android signing key.
# Backend
cd backend-core
npm run prisma:validate
npm test
npm run build
# Client web
cd ..\web-client
npm run build
# Admin web
cd ..\web-admin
npm run build
# Mobile
cd ..\mobile-gate\mobile_gate
flutter analyze
flutter test- Backend fails at startup: compare
.envwith.env.exampleand fill every required secret. - Prisma cannot connect: run
docker compose psinsidebackend-coreand wait for PostgreSQL to become healthy. - PDF or CSV jobs remain pending: start the backend worker.
- Browser reports CORS/network errors: confirm the API base, backend port, and
CORS_ORIGIN. - Android emulator cannot connect to
localhost: use10.0.2.2. - Physical phone cannot connect: use the computer's LAN IP and check firewall and Wi-Fi client isolation.
For endpoint details, see backend-core/docs/api.md.