APInodeFree
Node.js: add a validated API endpoint
Endpoint with schema validation, errors and tests.
Cursor / coding agents, Claude Code, ChatGPT +1
Agent Templates / Node.js API
Express/Fastify/NestJS/Hono, TypeScript, Prisma/Drizzle. Files update live as you answer; download everything as a ZIP and drop it into your repo root.
What the app does and for whom.
Generated in your browser. Nothing is uploaded. Review before committing: these are starting points, not guarantees.
# AGENTS.md: my-app ## Stack Express on Node.js 22 (TypeScript), Prisma + PostgreSQL, tests with Vitest. ## Setup ```bash npm install cp .env.example .env ``` ## Commands - Install: `npm install` - Dev: `npm run dev` - Tests: `npm test` - Lint: `npm run lint` - Type check: `npm run typecheck` - Migrate: `npx prisma migrate dev` ## Project structure - src/routes (or src/modules): HTTP layer - src/services: business logic - src/db: database client and queries - src/lib: shared utilities - tests/: test files ## Code style - TypeScript strict mode; avoid `any`, prefer explicit return types on exported functions - Validate every request body/query with a schema (e.g. zod) at the route boundary - Keep route handlers thin; put logic in services - Use async/await; always handle promise rejections - Return consistent JSON error shapes with proper HTTP status codes - Framework: Express. Follow its idiomatic patterns (middleware/plugins/modules) ## Testing - Write Vitest tests for new behaviour - Test HTTP routes with an in-process request library; mock external services - Run `npm test` before finishing ## Security - Never trust client input; validate and sanitise - Use parameterised queries / ORM methods only - Set timeouts on outbound HTTP calls - Never log tokens, passwords or personal data ## Never - Commit secrets or .env files - Run destructive database commands without asking - Do not commit .env or credentials - Do not change the database schema without a migration - Do not add dependencies without explaining why ## Working agreement - Before editing, state a short plan and the files you will touch - Make the smallest change that solves the task; do not refactor unrelated code - If requirements are ambiguous, ask instead of guessing - When done, summarise what changed and how you verified it
Endpoint with schema validation, errors and tests.
Cursor / coding agents, Claude Code, ChatGPT +1
One error middleware, typed errors, no leaked stack traces.
Cursor / coding agents, Claude Code, ChatGPT +1
Row Level Security that is actually tested.
Cursor / coding agents, Claude Code, ChatGPT +1