+19
-55
@@ -1,63 +1,27 @@
|
||||
# Local Development
|
||||
# Local development
|
||||
|
||||
## Prerequisites
|
||||
- Node.js >= 18
|
||||
- pnpm >= 8
|
||||
|
||||
## Setup
|
||||
Needs Node.js 24, pnpm (`corepack enable`) and Docker.
|
||||
|
||||
```bash
|
||||
# Clone the repository
|
||||
git clone <repo>
|
||||
cd kooltap_backoffice
|
||||
|
||||
# Install dependencies
|
||||
pnpm install
|
||||
|
||||
# Copy environment variables
|
||||
docker compose up -d # PostgreSQL on localhost:5432, with kooltap and kooltap_test
|
||||
cp .env.example apps/api/.env
|
||||
|
||||
# Generate Prisma client
|
||||
cd apps/api
|
||||
pnpm db:generate
|
||||
|
||||
# Run migrations
|
||||
pnpm db:migrate
|
||||
|
||||
# Seed demo data
|
||||
pnpm db:seed
|
||||
cd ../..
|
||||
echo 'NEXT_PUBLIC_API_URL=http://localhost:3001/api/v1' > apps/dashboard/.env.local
|
||||
pnpm install # also generates the Prisma client
|
||||
pnpm db:migrate # applies migrations; makes a new one when the schema changed
|
||||
pnpm db:seed # demo venues, a user per role, a terminal, products and tabs
|
||||
pnpm dev # API on :3001, dashboard on :3000
|
||||
```
|
||||
|
||||
## Running
|
||||
The seed prints the accounts to sign in with, and the demo terminal's token: `pnpm simulate` uses it to play a
|
||||
terminal.
|
||||
|
||||
```bash
|
||||
# Start both API and Dashboard
|
||||
pnpm dev
|
||||
```
|
||||
## Changing things
|
||||
|
||||
Or individually:
|
||||
```bash
|
||||
cd apps/api && pnpm dev
|
||||
cd apps/dashboard && pnpm dev
|
||||
```
|
||||
|
||||
## Database Commands
|
||||
|
||||
```bash
|
||||
pnpm db:generate # Generate Prisma client
|
||||
pnpm db:migrate # Run migrations
|
||||
pnpm db:seed # Seed demo data
|
||||
pnpm db:reset # Reset database and re-seed
|
||||
```
|
||||
|
||||
## Environment Variables
|
||||
|
||||
### API (`apps/api/.env`)
|
||||
- `DATABASE_URL` - PostgreSQL connection URL (`docker compose up postgres` starts one)
|
||||
- `JWT_SECRET` - JWT signing secret
|
||||
- `PORT` - API port (default: 3001)
|
||||
- `CORS_ORIGIN` - Allowed CORS origin (default: http://localhost:3000)
|
||||
|
||||
### Dashboard
|
||||
- `NEXT_PUBLIC_API_URL` - API base URL (default: http://localhost:3001/api/v1)
|
||||
- **The database:** edit `apps/api/prisma/schema.prisma`, then `pnpm db:migrate` names and writes a migration.
|
||||
`pnpm db:reset` starts over with the seed.
|
||||
- **The API or the terminal protocol:** change the schemas and types in `packages/shared/src` first; the API and the
|
||||
dashboard follow from the type errors. Protocol changes go in [terminal-protocol.md](terminal-protocol.md) too, and
|
||||
raise `MIN_APP_VERSION` when older apps can't keep up.
|
||||
- **Text on the dashboard:** `apps/dashboard/src/locales/en.json` and `nl.json` (a test checks both have every key).
|
||||
- **Emails:** `apps/api/templates/emails`, see its README.
|
||||
EOF
|
||||
|
||||
Reference in New Issue
Block a user