A tool to scaffold new microservices for bun/openapi/jwt following the established architectural patterns.
Repository: https://github.com/traagel/bun-baker
- Creates a complete TypeScript microservice structure with Fastify
- Includes JWT authentication, Swagger documentation, and error handling
- Sets up a PostgreSQL database connection
- Configures environment variables and logging
- Creates a Dockerfile for containerization
- Initializes a Git repository (optional)
- Python 3.6 or higher
- Optional: Jinja2 for advanced template rendering (
pip install jinja2) - Optional: Git for repository initialization
Clone this repository or copy the files to your project:
git clone https://github.com/traagel/bun-baker
cd bun-bakerpython main.py <service-name> [options]service_name: The name of the microservice to generate (required)
--output-dir,-o: Directory where the microservice should be created (default: current directory)--skip-git: Skip Git repository initialization--verbose,-v: Enable verbose output
# Generate a users service in the current directory
python main.py users
# Generate a payments service in a specific directory with verbose output
python main.py payments -o ./services -v
# Generate a notifications service without Git initialization
python main.py notifications --skip-gitThe generated microservice will have the following structure:
service-name/
├── docs/ # Documentation
├── scripts/ # Utility scripts
├── src/
│ ├── data-access/ # Database access layer
│ ├── db/
│ │ └── migrations/ # Database migrations
│ ├── models/ # Data models
│ ├── plugins/ # Fastify plugins
│ ├── routes/ # API routes
│ ├── schemas/ # Request/response schemas
│ └── utils/ # Utility functions
├── .gitignore
├── Dockerfile
├── package.json
└── tsconfig.json
You can customize the generated files by modifying the templates in the templates/ directory. All templates use Jinja2 syntax with variables like {{ service_name }}.
Available variables:
service_name: The provided service nameservice_name_uppercase: The service name in uppercaseservice_name_capitalized: The service name with the first letter capitalized
MIT