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

Angular 20 Copilot instructions

Copilot instructions for Angular 20 apps using standalone components, signals, and the new control flow.

GitHub CopilotAngular

Code review Copilot instructions

Copilot instructions focused on pull request review: what to flag, severity labels, and how to word comments.

GitHub CopilotAgent workflows

C# / .NET Copilot path instructions

Path-specific Copilot instructions for C# files on .NET 10: nullable types, async, records, and logging.

GitHub Copilot.NET / ASP.NET Core

Dockerfile Copilot path instructions

Path-specific Copilot instructions for Dockerfiles and compose files: multi-stage builds, non-root, and pinned images.

GitHub CopilotDocker

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.