ADR 0003: Exactly Two Architecture Presets (Flat API and MVC)
- Status: Accepted
- Date: 2026-09-22
- Context: Scaffolding tools often offer many layout options (clean architecture, hexagonal, DDD layers, micro-kernel...). Each additional preset multiplies the template matrix that must be tested, documented and kept working across every database and feature combination.
Decision
FGOTHS generates projects in exactly two structural patterns:
- Flat API (default for
--preset=api):main.go+handlers/+ optionalinternal/feature packages. Zero ceremony; readable in a minute. - MVC (the
--preset=webapp):handlers/(controllers),models/,views/(Templ + HTMX SSR),middleware/,internal/database/.
Everything else is an opt-in feature (metrics, openapi, grpc, jwt-auth, mtls, otel, flatbuffers, database), not a new layout.
Rationale
- Depth over breadth: two layouts can be tuned end-to-end — scaffolding, tests,
FROM scratchcontainer, docs. Five layouts would each be half-polished. - Test matrix control: the repository tests representative generated projects and exercises database/feature configuration paths. It does not compile every preset × database × feature combination. Adding a third architecture still increases the combinations that must be maintained.
- The two patterns cover the real split: JSON APIs/services (flat) and server-rendered apps (MVC). Hybrid needs are served by MVC, whose handlers also serve JSON.
- Escape hatch: users who need a different layout can restructure after generation — the generated code is plain Go with no framework magic binding it to the scaffold.
Consequences
- Positive: a smaller template surface and simpler docs and onboarding; representative generated projects are compiled by integration tests.
- Negative: users wanting clean/hexagonal scaffolding out of the box must restructure manually. This is a deliberate trade: FGOTHS optimizes for the 80% case and stays out of the way for the rest.