How gflobo/fastify-initializr-ts works
fastify-initializr-ts is an interactive CLI that generates a Fastify/TypeScript API project. Its main workflow collects a project name and application/database settings, builds template variables, scaffolds the project, optionally installs dependencies, initializes Git, and starts the development server. The generated template also includes health, rate-limit, Swagger, and optional Prisma components. The CLI flow and generator relationships are supported by excerpts or the SOURCE INDEX; template internals were not excerpted, so their runtime wiring is not asserted.
Main entry points: index.ts CLI workflow · scaffold.ts Project scaffolder · types Configuration types · database.prompt.ts Database settings
Components 24
CLI orchestration
- CLI workflow
bin/index.ts - Welcome banner
bin/utils/banner.ts - Prompt cancellation
bin/utils/prompt-guard.ts
Project configuration
- Project location
bin/prompts/project-name.prompt.ts - Application settings
bin/prompts/app-config.prompt.ts - Database settings
bin/prompts/database.prompt.ts - Database presets
bin/constants/db-presets.ts - Configuration types
bin/types
Project generation
- Template variables
bin/core/template-vars.ts - Project scaffolder
bin/core/scaffold.ts - Template file operations
bin/utils/fs.ts - Dependency cleanup
bin/utils/package-json.ts - Prisma source generator
bin/utils/prisma.ts
Post-creation
- Dependency installation
bin/core/install.ts - Git initialization
bin/core/git.ts - Command processes
bin/utils/child-process.ts - Completion guidance
bin/core/output.ts
Generated API template
- Fastify server
fastify-ts/src/server.ts - Health controller
fastify-ts/src/controllers/healthController.ts - Rate limiting
fastify-ts/src/plugins/rate-limit.ts - Swagger integration
fastify-ts/src/plugins/swagger.ts - Prisma client
fastify-ts/lib/prisma.ts - Fastify instance types
fastify-ts/src/types/fastifyInstance.ts
Other components
- CLI user
Connections 26
- CLI user → CLI workflow: runs
bin/index.ts - CLI workflow → Welcome banner: prints
bin/index.ts - CLI workflow → Project location: requests location
bin/index.ts - CLI workflow → Application settings: requests settings
bin/index.ts - CLI workflow → Database settings: requests database
bin/index.ts - CLI workflow → Template variables: builds variables
bin/index.ts - CLI workflow → Project scaffolder: creates project
bin/index.ts - CLI workflow → Dependency installation: installs dependencies
bin/index.ts - CLI workflow → Git initialization: initializes Git
bin/index.ts - CLI workflow → Command processes: starts server
bin/index.ts - CLI workflow → Completion guidance: prints next steps
bin/index.ts - Project location → Prompt cancellation: checks cancellation
bin/prompts/project-name.prompt.ts - Application settings → Prompt cancellation: checks cancellation
bin/prompts/app-config.prompt.ts - Database settings → Prompt cancellation: checks cancellation
bin/prompts/database.prompt.ts - Database settings → Database presets: selects preset
bin/prompts/database.prompt.ts - Application settings → Configuration types: uses types
bin/prompts/app-config.prompt.ts - Database settings → Configuration types: uses types
bin/prompts/database.prompt.ts - Template variables → Configuration types: uses types
bin/core/template-vars.ts - Project scaffolder → Template file operations: copies template
bin/core/scaffold.ts - Project scaffolder → Dependency cleanup: strips Prisma dependencies
bin/core/scaffold.ts - Project scaffolder → Prisma source generator: generates Prisma source
bin/core/scaffold.ts - Project scaffolder → Configuration types: uses types
bin/core/scaffold.ts - Prisma source generator → Configuration types: uses preset type
bin/utils/prisma.ts - Git initialization → Command processes: checks and runs Git
bin/core/git.ts - Dependency installation → Command processes: runs install
bin/core/install.ts - Project scaffolder → Fastify server: copies template
bin/core/scaffold.ts