Scaffolds new container modules following ModuleImplementationGuide.md Section 3.1 standard structure. Creates directory layout, required files (Dockerfile, package.json, tsconfig.json, README.md, CHANGELOG.md), config files with schema validation, server.ts entry point, and OpenAPI spec. Use when creating a new microservice container, scaffolding module structure, or setting up a new service following the standard architecture.
Scaffolds new container modules following the standard structure from ModuleImplementationGuide.md Section 3.1.
Tenant-only: Use tenantId only; there is no organization. All routes, services, database queries, and events in the new module must use tenantId (e.g. request.user!.tenantId). Do not add organizationId to types, schemas, or APIs.
When creating a new container module:
Reference: ModuleImplementationGuide.md Section 3.1
containers/[module-name]/
├── Dockerfile
├── package.json
├── tsconfig.json
├── README.md
├── CHANGELOG.md
├── openapi.yaml
├── config/
│ ├── default.yaml
│ └── schema.json
├── src/
│ ├── server.ts
│ ├── config/
│ │ ├── index.ts
│ │ └── types.ts
│ ├── routes/
│ │ ├── index.ts
│ │ └── [resource].ts
│ ├── services/
│ │ └── [Service].ts
│ ├── types/
│ │ └── index.ts
│ └── utils/
│ └── logger.ts
└── tests/
├── unit/
├── integration/
└── fixtures/
FROM node:20-alpine AS builder
WORKDIR /app
COPY package*.json ./
COPY containers/shared/package*.json ./containers/shared/
RUN npm install
COPY containers/[module-name] ./containers/[module-name]
COPY containers/shared ./containers/shared
WORKDIR /app/containers/shared
RUN npm run build
WORKDIR /app/containers/[module-name]
RUN npm run build
FROM node:20-alpine
WORKDIR /app
COPY --from=builder /app/containers/[module-name]/dist ./dist
COPY --from=builder /app/containers/[module-name]/node_modules ./node_modules
COPY --from=builder /app/containers/[module-name]/package.json ./
EXPOSE 3XXX
CMD ["node", "dist/server.js"]
{
"name": "@coder/[module-name]",
"version": "1.0.0",
"description": "[Module Description]",
"main": "dist/server.js",
"type": "module",
"scripts": {
"dev": "tsx watch src/server.ts",
"build": "tsc",
"start": "node dist/server.js",
"test": "vitest run",
"test:watch": "vitest",
"test:coverage": "vitest run --coverage",
"lint": "eslint src --ext .ts"
},
"dependencies": {
"@coder/shared": "file:../shared",
"@fastify/swagger": "^9.1.0",
"@fastify/swagger-ui": "^5.0.0",
"fastify": "^5.1.0",
"js-yaml": "^4.1.0",
"zod": "^3.24.1"
},
"devDependencies": {
"@types/node": "^25.0.5",
"@vitest/coverage-v8": "^2.1.0",
"tsx": "^4.19.2",
"typescript": "^5.9.3",
"vitest": "^4.0.0"
}
}
{
"extends": "../../tsconfig.json",
"compilerOptions": {
"outDir": "./dist",
"rootDir": "./src",
"baseUrl": "./src",
"paths": {
"@/*": ["./*"]
}
},
"include": ["src/**/*"],
"exclude": ["node_modules", "dist", "tests"]
}
Reference: ModuleImplementationGuide.md Section 4.2