Skip to content

prajwalscodestack/ginforge

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

20 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

GinForge

GinForge is an architecture-aware CLI toolkit for building, analyzing, and maintaining production-ready applications built with the Gin framework.

Instead of manually creating project structures, modules, and architectural boilerplate, GinForge provides project scaffolding, module generation, route discovery, and architecture validation for Gin applications.


πŸš€ Features

⚑ Project Scaffolding

Generate production-ready Gin projects using popular architecture patterns with interactive support.

ginforge new myapp --architecture layered
ginforge new myapp --architecture hexagonal
ginforge new

🧩 Module Generation

Generate modules with architecture-aware boilerplate inside existing projects.

ginforge generate module user
ginforge generate module

πŸ” Route Discovery

Analyze Gin applications and discover routes automatically using Go AST parsing.

ginforge routes

Supports:

  • Route groups
  • Nested route groups
  • Named handlers
  • Method handlers
  • Inline handlers

πŸ“€ Route Export

Export discovered routes in multiple formats for debugging and documentation.

ginforge routes --json
ginforge routes --csv
ginforge routes --md

πŸ§ͺ Architecture Validation (Doctor)

Validate project structure, architecture rules, and detect issues in your Gin project.

ginforge doctor
ginforge doctor --strict

Checks include:

  • Architecture detection
  • Structure validation
  • Duplicate route detection (with file-level details)
  • Layered architecture dependency validation
  • Hexagonal architecture dependency validation

πŸ— Supported Architectures

Layered Architecture

internal/
β”œβ”€β”€ handler/
β”œβ”€β”€ service/
β”œβ”€β”€ repository/
β”œβ”€β”€ model/
└── routes/

Hexagonal Architecture

internal/
β”œβ”€β”€ domain/
β”œβ”€β”€ application/
└── adapters/
    β”œβ”€β”€ http/
    β”œβ”€β”€ persistence/
    └── external/

πŸ“¦ Installation

Using Go Install

go install github.com/prajwalscodestack/ginforge@latest

Verify Installation

ginforge --help

πŸ›  Commands

Create Project

ginforge new myapp --architecture layered
ginforge new myapp --architecture hexagonal
ginforge new

Generate Module

ginforge generate module user
ginforge generate module

Discover Routes

ginforge routes

Export Routes

ginforge routes --json
ginforge routes --csv
ginforge routes --md

Validate Project

ginforge doctor
ginforge doctor --strict

🧠 Doctor Validation Rules

Layered Architecture

Allowed:

handler -> service
service -> repository

Forbidden:

service -> handler
repository -> service
repository -> handler
model -> service
model -> repository

Hexagonal Architecture

Forbidden:

domain -> gin
domain -> database/sql
application -> adapters

πŸ“Š Example Workflow

ginforge new ecommerce-api --architecture layered

cd ecommerce-api

ginforge generate module user

ginforge routes

ginforge doctor --strict

πŸ—Ί Roadmap

  • OpenAPI generation from routes
  • Swagger integration
  • CI pipeline integration
  • Custom architecture templates
  • Plugin system for custom checks
  • Doctor auto-fix suggestions

🀝 Contributing

Contributions, issues, and feature requests are welcome.

If you find a bug or have an idea for improvement, feel free to open an issue or submit a pull request.


πŸ“„ License

MIT License

About

Generate, scaffold, and maintain Gin projects using clean architectural patterns and code generation.

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors