docs: document the /api prefix and the Dokploy deployment

Update AGENTS.md and README.md for the same-origin `/api` routing and
the Docker Compose deployment: no hosted CI, how the images and nginx
proxy fit together, and the required env vars.
This commit is contained in:
Jose Selesan
2026-10-16 15:44:31 -03:00
parent f87d46c975
commit fbd6942a6e
2 changed files with 45 additions and 11 deletions

View File

@@ -46,15 +46,36 @@ bun run typecheck # tsc
bun run test # bun test (api) / vitest (web, shared)
```
CI (`.github/workflows/ci.yml`) runs `db:generate` → `lint:ci` → `typecheck` → `test` → `build` on every push
to `main` and every pull request.
There is no hosted CI: run these locally (in that order) before pushing. `bun run lint:ci` runs the exact
same Biome check as `biome ci` would.
## Deployment (Dokploy)
`docker-compose.yml` at the repo root defines the two runtime services — `api` (Bun + nginx-free Hono server)
and `web` (static build behind nginx, proxying `/api/*` to the API). The database is external (provided by
Dokploy), and both services join the external `dokploy-network` so Traefik can reach them.
- One public domain: nginx serves the SPA and proxies `/api/*` → `http://api:4100`. All API routes are
mounted under `/api` for that reason — never mount a route at the root of the API.
- Env vars are interpolated from the Dokploy service env (`docker-compose.yml` marks `DATABASE_URL`,
`BETTER_AUTH_SECRET`, `BETTER_AUTH_URL`, `CORS_ORIGIN` and `WEB_APP_URL` as required). See `.env.example`.
- Point the domain in Dokploy's **Domains** UI at the `web` service, container port `80` (the compose file
publishes no host ports on purpose).
- Migrations run automatically on API startup (`prisma migrate deploy` before `bun run start`).
Local smoke test of the same setup:
```bash
docker network create dokploy-network # once, mimics Dokploy's network
docker compose up --build
```
## Useful scripts
| Command | Effect |
| --------------------- | ------------------------------------------------------------------- |
| `bun run lint:fix` | Apply Biome fixes: lint, formatting and import sorting (whole repo) |
| `bun run lint:ci` | `biome ci` — check the whole repo exactly as CI does |
| `bun run lint:ci` | `biome ci` — whole-repo check, stricter than `lint` |
| `bun run format` | Format with Biome (`format:check` to verify only) |
| `bun run db:generate` | Regenerate the Prisma client into `apps/api/src/generated` |
| `bun run db:migrate` | Create and apply a migration (development) |