Skip to main content
Ahmed Hassan·

Scaffolded an entire hexagonal Fastify service - Docker, health checks, the works

Generates a complete, opinionated project boilerplate with folder structure, configs, base classes, and starter files.

Production-Ready Project Boilerplate

You are a tech lead scaffolding a new production-ready {{project_type}} project. Create a complete boilerplate following industry best practices. ## Project Spec - Name: {{project_name}} - Language: {{programming_language}} - Framework: {{framework}} - Architecture: {{architecture_pattern}} (e.g., hexagonal, MVC, clean architecture) - Additional tools: {{additional_tools}} (e.g., Docker, Redis, Kafka) ## Deliverables (generate ALL files) 1. **Folder Structure** - ASCII tree diagram of the complete project layout 2. **Package Configuration** - package.json, requirements.txt, Cargo.toml, go.mod, etc. with all dependencies 3. **Entry Point** - Main application entry with configuration loading 4. **Configuration** - Environment-based config system (dev/staging/prod) 5. **Base Classes** - Abstract base classes for services, repositories, controllers 6. **Dependency Injection** - DI container setup or wiring 7. **Middleware** - Logging, error handling, auth, CORS, request ID 8. **Health Check** - /health endpoint with dependency checks 9. **Docker Setup** - Dockerfile, docker-compose.yml, .dockerignore 10. **Testing Setup** - Test configuration, example unit and integration tests 11. **README** - Setup instructions, development workflow, environment variables 12. **CI/CD** - GitHub Actions workflow for test and build Use the latest stable versions of all tools. Include proper .env.example and .gitignore files.

Ergebnisse

Production boilerplate for `billing-service`, a TypeScript + Fastify app in clean/hexagonal layout. ## Folder structure ``` billing-service/ ├── src/ │ ├── domain/ # entities, value objects — zero framework imports │ ├── application/ # use cases, ports (interfaces) │ ├── infrastructure/ # fastify, postgres, redis adapters │ ├── config/ # env-validated config (zod) │ └── main.ts # composition root ├── test/ ├── Dockerfile ├── docker-compose.yml └── package.json ``` ## Entry point + config ```typescript // src/config/index.ts — fail fast on bad env import { z } from "zod"; const Env = z.object({ NODE_ENV: z.enum(["dev", "staging", "prod"]), PORT: z.coerce.number().default(3000), DATABASE_URL: z.string().url(), }); export const env = Env.parse(process.env); ``` ## Health check `GET /health` pings Postgres and Redis, returns `200 {status:"ok"}` or `503` with the failing dependency named. **Included:** multi-stage `Dockerfile`, `docker-compose.yml` (app + postgres:16 + redis:7), request-id + pino logging middleware, `.env.example`, and a GitHub Actions test/build workflow. Use `npm run dev` to start.

Modell: Claude Sonnet 4

44 Likes10 SavesScore: 23

1 Kommentar

Luca Brunner·

Bookmarked — exactly the code generation approach I was missing.