- TypeScript 93.9%
- JavaScript 2.1%
- Shell 1.9%
- Python 1.6%
- Dockerfile 0.5%
| Filename | Latest commit message | Latest commit date |
|---|---|---|
|
|
||
| .forgejo/workflows | ||
| .husky | ||
| docs | ||
| scripts | ||
| seed/demo | ||
| sql | ||
| src | ||
| test | ||
| .dockerignore | ||
| .env.example | ||
| .gitignore | ||
| .prettierrc | ||
| AGENTS.md | ||
| CHANGELOG.md | ||
| CLAUDE.md | ||
| Dockerfile | ||
| eslint.config.mjs | ||
| nest-cli.json | ||
| orval.config.mjs | ||
| package-lock.json | ||
| package.json | ||
| README.md | ||
| tsconfig.build.json | ||
| tsconfig.json | ||
Дубль — API
NestJS + TypeORM + PostgreSQL 18 + MinIO backend for «Дубль», an app for audio-ad agency staff:
clients, campaigns and spots (audio ads) with an approval workflow. It serves the mobile app and the
PWA from dubl-mobile; there is no separate web panel.
- Everything needs a JWT except
POST /auth/login,POST /auth/refreshandGET /health. Roles:admin,manager(manage the catalog and statuses),employee(read and listen); users and feature flags areadminonly. - Files are private. MinIO keys are stored in the DB; every response turns
artwork,audioUrl,scriptUrl,fileUrlinto signed links valid for 15 minutes. An unsigned request gets 403. - Spot approval:
draft → on_review → changes_requested | approved → on_air(PATCH /spots/{id}/status, a comment is optional; any other transition is 409). - No migrations: the schema is
sql/bootstrap.sql, applied on first start to an empty database, together with the first admin fromADMIN_USERNAME/ADMIN_PASSWORD.
The contract is dubl-docs/openAPI.yaml (Swagger UI at
https://docs.dubl.lightnode.ru); npm run gen:schemas generates the zod schemas in src/generated/.
Detailed docs (in Russian) are in docs/; agent rules in AGENTS.md.
Local stand
docker run -d --rm --name dubl-pg -e POSTGRES_USER=dubl -e POSTGRES_PASSWORD=dev -e POSTGRES_DB=dubl \
-p 55432:5432 postgres:18
docker run -d --rm --name dubl-s3 -e MINIO_ROOT_USER=dubladmin -e MINIO_ROOT_PASSWORD=devpass123 \
-p 59000:9000 docker.io/pgsty/silo:RELEASE.2026-10-26T00-00-00Z server /data
npm install
cp .env.example .env # point POSTGRES_* / MINIO_* at the containers above
npm run build
npm run seed # schema + demo catalog + accounts admin, manager, employee, employee2
npm run start:prod # http://localhost:3000
npm run seed recreates the whole stand: 5 fictional clients, 8 campaigns and 19 spots in all five
statuses, each with audio, cover and a PDF script (seed/demo/, regenerated by
scripts/make-demo-assets.py). Passwords come from SEED_<ROLE>_PASSWORD or are generated and
printed once.
Checks
npm run lint
npm test # Jest unit tests
npm run build # tsgo + tsc-alias
python3 scripts/smoke-api.py http://localhost:3000 admin <password> # live 401/403/409/signed-link smoke
npm run test:e2e is the unused NestJS template and is not part of the checks (see docs/debt.md).
Deployment
A v* tag runs .forgejo/workflows/release.yml: it checks the tag against package.json, waits
for CI, writes the env file on the server and runs scripts/vps-deploy.sh, which builds the image
and restarts dubl-backend.service behind Traefik at https://api.dubl.lightnode.ru. PostgreSQL,
PgBouncer, MinIO and Traefik are provisioned by dubl-infra;
the CI variables and secrets are listed in its docs/deploying-apps.md.
License
Private / UNLICENSED (see package.json).