Ports, Adapters, and Services That Last.
The Go-native guide to building services that are easy to test, easy to change, and hard to break. No frameworks. No DI containers. Just interfaces and a main() function.
Kindle · Paperback · PDF · EPUB

“Your Go service's business logic should have zero knowledge of HTTP, databases, or message queues — and Go's implicit interfaces make this not just possible, but natural.”

Gabriel Anhaia
Senior Software Engineer · Berlin
Sound familiar?
This book fixes that — the Go way.
What's inside
From the pain of spaghetti code to a production-ready hexagonal service. Every chapter builds on the last. Every concept is backed by tested code in the companion repo.
3 chapters
The spaghetti service. Architecture buzzwords demystified. Why Go and hexagonal are a natural fit.
4 chapters
The domain at the center. Ports as Go interfaces. Adapters as the bridge. The dependency rule.
6 chapters
Project layout. Domain modeling. Port design. HTTP adapters. Outbound adapters. Wiring in main().
5 chapters
Testing at every layer. Error handling across boundaries. Transactions. Events. Observability.
4 chapters
When hexagonal is overkill. Migrating existing services. Splitting into multiple hexagons. The complete service.
After reading
Tested code, not toy examples
Every code example in the book lives in a public repo. A complete order processing service with domain, ports, adapters, tests, and working main(). Clone it. Run it. Break it. Learn from it.
github.com/gabrielanhaia/hexagonal-go-examples
About the author
Senior Software Engineer building production Go services every day at Monta in Berlin. 10+ years of experience scaling backend systems for fintechs and high-growth companies.
Also the author of The Complete Guide to Go Programming, Decoupled PHP — the same ports-and-adapters idea worked out in PHP — and creator of Hermes IDE, an open-source AI-native terminal.
Build services that last
22 chapters that take you from spaghetti to hexagonal. Every concept backed by tested Go code.
Kindle · Paperback · PDF · EPUB
Part of the Thinking in Go series
Learn the language first: The Complete Guide to Go Programming.
Work in PHP too? Decoupled PHP applies the same boundaries to Laravel and Symfony codebases.
Work in Python? Hexagonal Architecture in Python builds one async service five ways and measures them.