Skip to content

Architecture generators — Go #39

@mathieusouflis

Description

@mathieusouflis

Problem statement

There are no architecture pattern generators for Go. GoRestAPIGenerator can only produce a flat structure. Developers who want Clean Architecture or Hexagonal for their Go project cannot use dot.

Proposed solution

Implement three standalone architecture generators in generators/go/:

  • GoMVCGenerator (go-mvc) — handlers/, models/, routes/
  • GoCleanArchGenerator (go-clean-arch) — domain/, usecases/, interfaces/, infrastructure/
  • GoHexagonalGenerator (go-hexagonal) — core/ (domain + ports), adapters/ (primary + secondary)

Each generator:

  • Implements the full Generator interface
  • Apply() returns Create ops for the directory structure and base files (e.g. domain/entity.go stub)
  • Is registered independently in buildRegistry()
  • Is tested independently in generators/go/<pattern>_test.go

API generators compose these via static composition based on spec.Config.Architecture.

Alternatives considered

Fold architecture logic into each API generator. Rejected — duplication across Go, Node, Python generators. The composition model means architecture logic is written once per language.

Area

Core

Additional context

These generators are also usable standalone — a developer who wants just the folder structure without a specific framework can use dot init --module go-clean-arch.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions