# Copilot instructions — Node.js TypeScript API

- Node 22, ESM only (`"type": "module"`), TypeScript `strict`.
- HTTP layer: Hono. Validate params/body with zod via `@hono/zod-validator`.
- Structure: `src/routes` → `src/services` → `src/db` (Drizzle ORM). Routes don't touch the DB directly.
- Errors: throw typed `AppError(status, code, message)`; one global error handler formats JSON responses.
- Config read once in `src/config.ts` and validated with zod; crash on startup if invalid.
- Use `async/await`, never mix with `.then` chains. Always `await` or explicitly `void` promises.
- Tests with Vitest; mock network with `msw`. New routes need tests.
- No `console.log` in committed code; use the `pino` logger.
