# Development ## Prerequisites - Node.js 20+ - Docker + Docker Compose Install dependencies: ```bash npm install npx playwright install chromium # first time only ``` Copy `.env.example` to `.env` and fill in the required values before running. ### Environment variables | Variable | Default | Description | |---|---|---| | `PORT` | `3000` | HTTP port | | `KEYS_DIR` | `keys` | Directory containing `*.json` key descriptors | | `DB_PATH` | `data/sessions.db` | SQLite database file | | `PLAYWRIGHT_CHROMIUM_EXECUTABLE_PATH` | _(Playwright default)_ | Path to Chromium binary. Set automatically in Docker (`/usr/bin/chromium`). | --- ## Starting the application **Development** (watch mode, restarts on file changes): ```bash npm run start:dev ``` **Production build, then start**: ```bash npm run build npm run start:prod ``` The application listens on port **3000** by default. --- ## Running tests ```bash npm run test ``` Run a single spec file: ```bash npm run test -- --no-coverage test/scenario.controller.spec.ts ``` Watch mode: ```bash npm run test:watch ``` Enable verbose NestJS log output during tests: ```bash npm run test:debug ``` --- ## Formatting code [Prettier](https://prettier.io/) is used to format all TypeScript source and test files: ```bash npm run format ``` This rewrites `src/**/*.ts` and `test/**/*.ts` in place. --- ## Linting [ESLint](https://eslint.org/) with `typescript-eslint` and `eslint-config-prettier` is used: ```bash # report issues npm run lint # report and auto-fix where possible npm run lint:fix ``` The project targets zero errors. Run lint before committing. --- ## Building the container ```bash docker compose build ``` To rebuild without the layer cache: ```bash docker compose build --no-cache ``` --- ## Running with Docker Compose Start (detached): ```bash docker compose up -d ``` Build and start in one step: ```bash docker compose up -d --build ``` The application is exposed at **http://localhost:13000**. SQLite data is persisted in `./data/` and key files are mounted from `./keys/` — both directories are volume-mounted into the container. Stop and remove containers: ```bash docker compose down ``` View logs: ```bash docker compose logs -f ```