Skip to content

GoRestAPIGenerator — add architecture patterns #37

@mathieusouflis

Description

@mathieusouflis

Problem statement

The existing GoRestAPIGenerator only generates a flat main.go + routes/ structure (implicit MVC). Developers who want Clean Architecture or Hexagonal for their Go API cannot use dot.

Proposed solution

Extend GoRestAPIGenerator.Apply() to branch on spec.Config.Architecture:

  • "mvc" (default): current behavior (main.go, routes/, handlers/)
  • "clean": domain/, usecases/, interfaces/, infrastructure/
  • "hexagonal": core/ (domain + ports), adapters/ (primary: HTTP, secondary: DB)

Update the TUI survey to ask for architecture pattern when language = go and type = api.

Alternatives considered

Create separate generators per architecture (e.g. GoCleanAPIGenerator). Rejected — they share 80% of the code and would create confusing duplication in official-generators.md.

Area

Core

Additional context

Uses static composition with Go architecture generators based on spec.Config.Architecture. Depends on: Go architecture generators.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions