Skip to main content

A complete configuration-driven generator for Go Fiber applications

Project description

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.md to have an LLM automatically write complex master_config.yaml files 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

  1. Install from PyPI (Recommended):

    pip install gofiber-generator
    
  2. Or install locally for development:

    pip install -e .
    

🏁 Quickstart

Once installed, the gofiber-gen command is available globally.

  1. Review/Edit your configuration: Open master_config.yaml and define your project's models, routes, and settings.

  2. Run the generator:

    gofiber-gen --config master_config.yaml --output ./generated
    
  3. Format the generated Go code:

    # Formatter is also available via the package
    python -m generators.format_generated_code ./generated
    
  4. 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.

  • Models, Repositories, DTOs & Controllers (repo_model_config_generate.py)
    The backbone of your domain logic. Maps YAML schema to Go structs and generates REST endpoints.

  • 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 GUI Builder

If you prefer a visual approach over the CLI, run the built-in GUI configuration and generation tool:

python native_vifber_gui.py

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

  1. Extend or fix the Jinja2 templates inside tool/templates/.
  2. Add new functionalities by creating a focused *_generate.py script and integrating it into generator.py.
  3. If changing template structure requirements, update master_config.yaml to prevent breaking generation.
  4. Keep the code generation decoupled and domain-agnostic.

📜 License

MIT License.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

gofiber_generator-0.1.0.tar.gz (327.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

gofiber_generator-0.1.0-py3-none-any.whl (77.7 kB view details)

Uploaded Python 3

File details

Details for the file gofiber_generator-0.1.0.tar.gz.

File metadata

  • Download URL: gofiber_generator-0.1.0.tar.gz
  • Upload date:
  • Size: 327.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for gofiber_generator-0.1.0.tar.gz
Algorithm Hash digest
SHA256 caa1af2477bc6262ab2ae757b03e745e8715ae90bfd00e4fdfe77e47843c306f
MD5 47c8142a346c6efacf22d9fd767620a9
BLAKE2b-256 495a6f2c408f90ebca9d192e14b3c1983429fa287c70f146d327dff46f091e34

See more details on using hashes here.

File details

Details for the file gofiber_generator-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for gofiber_generator-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 03ca88c9cecacab6dbae9c4ea9e791964eea36f71978dd42e036ec2ed0928ece
MD5 f37e217ecd4be4b5c8ced96f3e788bd4
BLAKE2b-256 58ab89fd6ac4bffda6b270dc73f848be5934b198530f75758c2fb647376c7936

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page