Home › Node.js / TypeScript › TypeScript Node.js API Copilot instructions
TypeScript Node.js API Copilot instructions
Copilot instructions for Node.js + TypeScript APIs with Hono/Express, zod and Vitest.
GitHub CopilotNode.js / TypeScript
How to use
Save this as .github/copilot-instructions.md in your repository root, commit it, and your agent will pick it up automatically. Edit the commands to match your project.
.github/copilot-instructions.mdDownload # 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.