Skip to content

HexaGo

Generate production-ready Go applications with Hexagonal Architecture

HexaGo is an opinionated CLI tool to scaffold Go applications following the Hexagonal Architecture (Ports & Adapters) pattern. It helps developers maintain proper separation of concerns and build maintainable, testable applications from day one.

Go Version License


Features

  • 🚀 Project Generation


    One command creates a complete project with your chosen web framework, Docker support, graceful shutdown, configuration management, and observability built in.

    Quick Start

  • 🧩 Component Generation


    Add services, domain entities, value objects, and adapters to existing projects. Auto-detects your project conventions and generates consistent, context-aware code.

    Commands Reference

  • âš¡ High Value Features


    Generate background workers (queue, periodic, event-driven), database migrations with sequential numbering, and validate your architecture compliance.

    Architecture Guide

  • 🎨 Template Customization


    Modify generated code to match your team's style. Add company headers, enforce coding standards, and share templates across your organization via version control.

    Template Customization

  • 🤖 AI Assistant Integration


    Built-in MCP server lets Claude Code, Claude Desktop, VS Code, Cursor, Windsurf, and Zed scaffold projects without leaving the conversation. The --working-directory flag means no cd is ever required.

    hexago mcp


Quick Install

go install github.com/padiazg/hexago@latest
brew tap padiazg/hexago
brew install hexago
git clone https://github.com/padiazg/hexago.git
cd hexago
go build -o hexago

Get Started in 60 Seconds

# Create a new project with Echo framework
hexago init my-api --module github.com/user/my-api --framework echo

cd my-api

# Add domain entities
hexago add domain entity User --fields "id:string,name:string,email:string"

# Add business logic
hexago add service CreateUser

# Add HTTP handler
hexago add adapter primary http UserHandler

# Validate architecture
hexago validate

# Build and run
make run

Visit http://localhost:8080/health to see it working!

Get Started View Commands


Framework Support

HexaGo generates framework-specific code for:

Framework Handler Signature
stdlib http.Handler
Echo func(echo.Context) error
Gin func(*gin.Context)
Chi Standard library with chi router
Fiber func(*fiber.Ctx) error

Why Hexagonal Architecture?

Hexagonal Architecture separates your application into three distinct layers:

Adapters (HTTP, DB, Queue) → Services/UseCases → Domain
  • Domain — Pure business entities, zero external dependencies
  • Services — Application logic, orchestrates domain objects, defines port interfaces
  • Adapters — Implementations of ports (HTTP handlers, repositories, external services)

This structure makes your application testable, maintainable, and framework-agnostic.

Learn more about the architecture