Implement proper async patterns (avoid .then(), use async/await)
Add tests using Vitest or Jest.
6. Always Generate Docker Files
Every project MUST include these files:
Dockerfile (multi-stage build):
# Builder stage
FROM node:20-alpine AS builder
WORKDIR /app
COPY package*.json ./
RUN npm ci
COPY . .
RUN npm run build
# Runtime stage
FROM node:20-alpine
WORKDIR /app
COPY package*.json ./
RUN npm ci --omit=dev
COPY --from=builder /app/dist ./dist
EXPOSE 3000
CMD ["node", "dist/index.js"]
Pre-Delivery Checklist
Before delivering Node.js/TS code, verify:
tsc --noEmit passes
npm run lint catches no warnings
npm run test passes
No any types used in new code (use unknown or specific types)
Async functions properly awaited; no floating promises
Unhandled promise rejections properly caught
Centralized error handler catches routes errors
.env variables validated on startup (e.g. using Zod)
Quick Domain Reference
Domain
When to Search
pattern
Need a design pattern (repository, dependency injection)