Busca en todas las páginas de la documentación
Fastify/Nest bootstrap with tests and Dockerfile - an Agent Skill for new Node.js 24 TypeScript services.
Produces an executable scaffold checklist: folder layout, package.json scripts, health endpoint, structured logging, graceful shutdown, Dockerfile, and GitHub Actions job stub aligned with team CI.
| Input | Why |
|---|---|
| Service name | Package name, log service field, Docker image tag |
| Framework ADR | Fastify 5 vs NestJS 11 vs Express 5 |
| Port default | 3000 or platform convention |
| Data dependencies | Postgres, Redis, none day one |
| Monorepo path | services/orders-api vs root repo |
src/, test/, Dockerfilepackage.json scripts: dev, build, start, typecheck, test/health and /ready routes (ready checks DB if configured).env.example with Zod-validated env module stub.github/workflows/pr-checks.yml excerpt using same scripts"type": "module" unless ADR mandates CommonJS..env.example only.console.log in production paths.SIGTERM closes server and DB pool.engines.node pinned to 24.18.0.Quick-reference recipe card - copy-paste ready.
# After skill output - verification sequence
cd services/billing-api
npm ci
npm run typecheck
npm test
npm run build
docker build -t billing-api:local .
docker run --rm -p 3000:3000 --env-file .env.example billing-api:local &
curl
# Expected tree (Fastify 5)
billing-api/
├── src/
│ ├── app.ts # buildApp() factory
│ ├── server.ts # listen + shutdown
│ ├── env.ts # Zod parse process.env
│ └── routes/
│ └── health.ts
├── test/
│ └── health.test.ts # node:test + inject
├── Dockerfile
├── package.json
├── tsconfig.json
└── .env.example// src/app.ts
import Fastify from "fastify";
import { healthRoutes } from "./routes/health.js";
export async function buildApp() {
const app = Fastify({
logger: { level: process.env.LOG_LEVEL ?? "info" },
});
await
// src/server.ts
import { buildApp } from "./app.js";
import { env } from "./env.js";
const app = await buildApp();
const close = async () => {
app.log.info({ event: "shutdown" });
# Dockerfile
FROM node:24.18.0-alpine AS build
WORKDIR /app
COPY package*.json ./
RUN npm ci
COPY . .
RUN npm run build
FROM node:24.18.0-alpine
WORKDIR /app
ENV NODE_ENV=production
COPY package*.json ./
RUN npm ci --omit=dev
When ADR selects NestJS 11:
@nestjs/cli scaffold with strict TSmain.ts with enableShutdownHooks()@nestjs/terminus health moduleinject for supertest against INestApplicationSee NestJS Basics for human-readable depth.
Use API Scaffold Skill for service "inventory-api":
- Fastify 5, port 3001
- Postgres via DATABASE_URL in .env.example
- Monorepo path: services/inventory-api
- Include GitHub Actions: npm ci, typecheck, test, auditFastify for small IO-bound APIs. Nest when the team needs DI, modules, and GraphQL guards at day one. Follow the org ADR - skill does not decide alone.
Only when input says ORM ADR accepted. Otherwise stub UserRepository interface and add ORM in a follow-up PR.
Stack versions: This page was written for Node.js 24.18.0 (Active LTS), npm 10+, TypeScript 5.6+, Express 5, Fastify 5, and NestJS 11.