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.

Related rules

Laravel Copilot instructions

GitHub Copilot instructions for Laravel 11+ apps with Eloquent, Pest, and Form Requests.

GitHub CopilotLaravel

Ruby on Rails Copilot instructions

GitHub Copilot custom instructions for Rails 8 apps with Hotwire, RSpec and Rubocop.

GitHub CopilotRuby on Rails

Get new rules weekly

One email a week: fresh rule files, agent tips, and what's changing in Cursor, Claude Code and Copilot. Free, unsubscribe anytime.

Opens the Rulestack Newsletter on beehiiv in a new tab. Or subscribe directly on beehiiv.