@@ -1,102 +1,45 @@
|
||||
# KoolTap Remote Tab Control
|
||||
# KoolTap
|
||||
|
||||
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
|
||||
The backoffice for KoolTap, the bar till: bar terminals (a Flutter app) sync their tabs, sales and stock here, and the
|
||||
venue runs tabs, customers, reminders and stock from a web dashboard.
|
||||
|
||||
```
|
||||
apps/
|
||||
api/ # NestJS backend
|
||||
dashboard/ # Next.js frontend
|
||||
api/ NestJS API on PostgreSQL (Prisma)
|
||||
dashboard/ Next.js dashboard
|
||||
packages/
|
||||
shared/ # Shared types & constants
|
||||
shared/ The contract: zod schemas and types for the terminal protocol and the dashboard API
|
||||
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
|
||||
terminal-simulator.ts A terminal on the command line
|
||||
docs/ Architecture, terminal protocol, development, production, security, testing
|
||||
```
|
||||
|
||||
## Requirements
|
||||
## Quick start
|
||||
|
||||
- Node.js >= 18
|
||||
- pnpm >= 8
|
||||
|
||||
## Quick Start
|
||||
Needs Node.js 24, pnpm (`corepack enable`) and Docker for the database.
|
||||
|
||||
```bash
|
||||
# 1. Install dependencies
|
||||
pnpm install
|
||||
|
||||
# 2. Generate Prisma client
|
||||
cd apps/api
|
||||
pnpm db:generate
|
||||
|
||||
# 3. Run migrations
|
||||
docker compose up -d # PostgreSQL on localhost:5432
|
||||
cp .env.example apps/api/.env # and NEXT_PUBLIC_API_URL into apps/dashboard/.env.local
|
||||
pnpm install # also generates the Prisma client
|
||||
pnpm db:migrate
|
||||
|
||||
# 4. Seed demo data
|
||||
pnpm db:seed
|
||||
cd ../..
|
||||
|
||||
# 5. Start both API and Dashboard in dev mode
|
||||
pnpm dev
|
||||
pnpm dev # API on :3001, dashboard on :3000
|
||||
```
|
||||
|
||||
API runs on http://localhost:3001
|
||||
Dashboard runs on http://localhost:3000
|
||||
Swagger docs at http://localhost:3001/api/docs
|
||||
The seed prints the demo accounts (one per role) and a terminal token; `pnpm simulate` then plays a terminal against
|
||||
your local API.
|
||||
|
||||
## Demo Credentials
|
||||
|
||||
| Role | Email | Password |
|
||||
|--------|--------------------|------------|
|
||||
| Admin | admin@example.com | Admin123! |
|
||||
| Manager | viewer@example.com | Viewer123! |
|
||||
| Superadmin | superadmin@example.com | Super123! |
|
||||
|
||||
The seed also adds a second venue, KoolTap Festival Bar (festival@example.com / Admin123!). To make an existing
|
||||
user a superadmin elsewhere, run `pnpm --filter @kooltap/api run superadmin <email>` (`--revoke` makes them an admin again).
|
||||
|
||||
## Device Simulator
|
||||
## Tests
|
||||
|
||||
```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
|
||||
pnpm test # unit tests: the tab, stock and product rules, parsing, email templates, dashboard helpers
|
||||
pnpm test:e2e # the API against a real database (DATABASE_URL), terminal and dashboard together
|
||||
```
|
||||
|
||||
## Running Tests
|
||||
## More
|
||||
|
||||
```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.
|
||||
- [Architecture](docs/architecture.md) and the [decisions behind it](docs/architecture-decisions.md)
|
||||
- [Terminal protocol](docs/terminal-protocol.md), for the Flutter app
|
||||
- [Local development](docs/local-development.md), [testing](docs/testing.md)
|
||||
- [Production on Coolify](docs/production.md), [security](docs/security.md)
|
||||
|
||||
Reference in New Issue
Block a user