98 lines
1.9 KiB
Markdown
98 lines
1.9 KiB
Markdown
# KoolTap Remote Tab Control
|
|
|
|
A production-quality remote tab control system for venues. Allows bar staff to manage and close tabs remotely from a web dashboard, with commands delivered to bar terminals via a sync API.
|
|
|
|
## Architecture
|
|
|
|
- **Monorepo** managed with pnpm
|
|
- **NestJS** backend API with Prisma ORM on PostgreSQL
|
|
- **Next.js** dashboard with App Router, TanStack Query, and shadcn/ui
|
|
- **Shared** TypeScript types package
|
|
|
|
```
|
|
apps/
|
|
api/ # NestJS backend
|
|
dashboard/ # Next.js frontend
|
|
packages/
|
|
shared/ # Shared types & constants
|
|
scripts/
|
|
device-sync.ts # Device simulator
|
|
docs/
|
|
api.md # API documentation
|
|
architecture.md
|
|
architecture-decisions.md
|
|
local-development.md
|
|
testing.md
|
|
production.md
|
|
security.md
|
|
```
|
|
|
|
## Requirements
|
|
|
|
- Node.js >= 18
|
|
- pnpm >= 8
|
|
|
|
## Quick Start
|
|
|
|
```bash
|
|
# 1. Install dependencies
|
|
pnpm install
|
|
|
|
# 2. Generate Prisma client
|
|
cd apps/api
|
|
pnpm db:generate
|
|
|
|
# 3. Run migrations
|
|
pnpm db:migrate
|
|
|
|
# 4. Seed demo data
|
|
pnpm db:seed
|
|
cd ../..
|
|
|
|
# 5. Start both API and Dashboard in dev mode
|
|
pnpm dev
|
|
```
|
|
|
|
API runs on http://localhost:3001
|
|
Dashboard runs on http://localhost:3000
|
|
Swagger docs at http://localhost:3001/api/docs
|
|
|
|
## Demo Credentials
|
|
|
|
| Role | Email | Password |
|
|
|--------|--------------------|------------|
|
|
| Admin | admin@example.com | Admin123! |
|
|
| Viewer | viewer@example.com | Viewer123! |
|
|
|
|
## Device Simulator
|
|
|
|
```bash
|
|
# Run a full demo (register, sync, ack)
|
|
cd scripts
|
|
npx ts-node device-sync.ts demo <venueId> <registrationCode>
|
|
|
|
# Or step by step:
|
|
npx ts-node device-sync.ts register <venueId> "Bar Terminal 1" ABC123
|
|
npx ts-node device-sync.ts sync <deviceId> <token>
|
|
npx ts-node device-sync.ts ack <deviceId> <token> <commandId> completed
|
|
```
|
|
|
|
## Running Tests
|
|
|
|
```bash
|
|
# Unit tests
|
|
pnpm test
|
|
|
|
# E2E tests
|
|
pnpm test:e2e
|
|
```
|
|
|
|
## Docker
|
|
|
|
```bash
|
|
docker compose up
|
|
```
|
|
|
|
## Production Notes
|
|
|
|
See [docs/production.md](docs/production.md) for production deployment. |