Skip to content

A service for baking bun microservices with openapi, swagger, jwt setup for deploying on railway.app

Notifications You must be signed in to change notification settings

traagel/bun-baker

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Microservice Generator

A tool to scaffold new microservices for bun/openapi/jwt following the established architectural patterns.

Repository: https://github.com/traagel/bun-baker

Features

  • 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)

Requirements

  • Python 3.6 or higher
  • Optional: Jinja2 for advanced template rendering (pip install jinja2)
  • Optional: Git for repository initialization

Installation

Clone this repository or copy the files to your project:

git clone https://github.com/traagel/bun-baker
cd bun-baker

Usage

python main.py <service-name> [options]

Arguments

  • service_name: The name of the microservice to generate (required)

Options

  • --output-dir, -o: Directory where the microservice should be created (default: current directory)
  • --skip-git: Skip Git repository initialization
  • --verbose, -v: Enable verbose output

Examples

# 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-git

Directory Structure

The 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

Customizing Templates

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 name
  • service_name_uppercase: The service name in uppercase
  • service_name_capitalized: The service name with the first letter capitalized

License

MIT

About

A service for baking bun microservices with openapi, swagger, jwt setup for deploying on railway.app

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published