Go Fiber Generator
A comprehensive, configuration-driven code generator for Go Fiber backends. This toolset leverages Python and Jinja2 templates to produce a fully-featured, production-ready Go backend scaffold based on a declarative YAML configuration.
It handles everything from routing, controllers, and database models to authentication, RBAC, WebSockets, and Flutter client APIs.
🚀 Key Features
- App Scaffolding: Generates the core foundation (config, database connectivity, main application entry point, routing skeleton, and infrastructure files like Dockerfile and Makefiles).
- Database & Models: Auto-generates Models, Repositories, DTOs, and Controllers from your schema configuration.
- Authentication & Security: Supports generating endpoints and logic for JWT authentication, Email/Password login, Social Login (OAuth), and Web auth.
- RBAC (Role-Based Access Control): Completely scaffolded authorization logic.
- Real-time & Communication: Built-in generators for WebSockets (chat), IMAP (email integration), and Notifications.
- Client Generation: Need to interact with your API? Generate a complete client API SDK.
- AI-Assisted Configuration: Use the included
AI_YML_GENERATOR_PROMPT.mdto have an LLM automatically write complexmaster_config.yamlfiles for your domain.
📋 Prerequisites
- Python 3.8+
- Go 1.20+ (For compiling and running the generated application)
- Optional: Docker (if you want to build and deploy via containers)
🛠️ Installation & Setup
- Install from Source (Recommended):
This command installs the core dependencies (Jinja2, PyYAML) and registers the global
gofiber-genandgofiber-guicommands on your computer.pip install -e .
🏁 Quickstart
Once installed, the gofiber-gen command is available globally.
-
Review/Edit your configuration: Open
master_config.yamland define your project's models, routes, and settings. -
Run the generator:
gofiber-gen --config master_config.yaml --output ./generated
-
Format the generated Go code:
# Formatter is also available via the package python -m generators.format_generated_code ./generated
-
Run your new Go backend:
cd generated go mod tidy go run ./cmd/server/main.go # Or using the generated makefile: make run
🧰 Individual Generators
You don't have to generate the entire project at once. The system is modular, allowing you to update specific components individually. All generators typically accept --config, --templates (pointing to ./tool/templates), and --output.
-
App Scaffold (
app_generate.py)
Generates configuration loaders, database setup, caching architecture, and fundamental structure. -
Domain Models (
model_generator.py)
Maps YAML schema to Go structs for GORM models ininternal/domain. -
DTOs & Responses (
dto_generator.py)
Generates data transfer objects and standardized API response structures. -
Repositories (
repository_generator.py)
Generates GORM-based repository logic for database interaction. -
Controllers (
controller_generator.py)
Generates REST API handlers and endpoint logic. -
Web Handlers (
web_handler_generator.py)
Generates HTML/Web-based handlers and integrates with templates. -
Authentication (
auth_generate.py)
Generates authentication routes, middleware, and credential processing logic. -
Role-Based Access Control (
rbac_generate.py)
Generates roles, permission mappings, and access enforcement code logic. -
WebSockets & Chat (
chat_websocket_genrator.py)
Scaffolds WebSocket handlers and connections for real-time messaging. -
Routes & Documentation (
routes.py)
Consolidates API endpoints from your configs and generates a structured view or routing file. -
Client API Generator (
api_client_generator.py)
Generates frontend-ready SDKs (like Flutter API clients) based on the current backend specification.
🖥️ Native Visual Launcher (GUI)
If you prefer a visual approach over the CLI, we provide a robust Native Desktop Control Panel. This launcher allows you to select your YAML configuration files via a file picker, open the developer prompts, and use checkboxes to natively toggle which generator scripts run.
gofiber-gui
(Alternatively, run python launcher.py directly if you skipped global installation).
This tool provides a user-friendly way to validate configs and trigger specific Python generation scripts visually.
🗂️ Templates and Customization
The Go files are generated using Jinja2 templates located in the tool/templates/ directory.
- To change the pattern of generated handlers, edit
tool/templates/pkg/controller/controller.go.j2. - To adjust infrastructure (Docker, Makefile), edit
tool/templates/infra/. - Variables injected into these templates align exactly with the schema inside
master_config.yaml.
🤝 Contributing
- Extend or fix the Jinja2 templates inside
tool/templates/. - Add new functionalities by creating a focused
*_generate.pyscript and integrating it intogenerator.py. - If changing template structure requirements, update
master_config.yamlto prevent breaking generation. - Keep the code generation decoupled and domain-agnostic.
📜 License
MIT License.
Metadata
Release files for gofiber-generator 0.2.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| gofiber_generator-0.2.3.tar.gz | 85.4 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| gofiber_generator-0.2.3-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 180.4 kB
Release files / gofiber_generator-0.2.3.tar.gz
| Download URL | gofiber_generator-0.2.3.tar.gz |
|---|---|
| Size | 85.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
1c6bede168629be68a7fa59f3a0fb068464ecc0fed2df72633e6dc71bf9c79ef
|
|
BLAKE2b-256 checksum How to use checksums |
d8e78513c260e424a42950e15f6efb5b482d53ccb4fb45a4939ea087c8146ad8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.3
|
Release files / gofiber_generator-0.2.3-py3-none-any.whl
| Download URL | gofiber_generator-0.2.3-py3-none-any.whl |
|---|---|
| Size | 95.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
505c00d83622c8911ec5d99a96f850157c7ce9c721b2f524618aeea8882ed8a4
|
|
BLAKE2b-256 checksum How to use checksums |
764afe1adc405386e9f97b4e87a38e30477df4dce0149dc2fd4e65e5de81a362
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.3
|