Go with the Domain: Building Modern Business Software in Go
Go with the Domain: Building Modern Business Software in Go
Summary:
Introduction
The book «Go with the Domain: Building Modern Business Software in Go» (authors: Robert Laszczak, Miłosz Smółka, 2021, 298 pages) is not just another tutorial on Go syntax. It is a practical guide to applying Domain-Driven Design (DDD) and Clean Architecture principles in the Go ecosystem. At the time of its release, the book became one of the first to systematically connect the philosophy of domain-driven design with idiomatic Go, avoiding excessive abstraction and over-engineering. It is aimed at developers who already write in Go and want to move from «just working code» to maintainable, testable, and scalable business applications.
What this book is about
The book is built around a real-world example — an order management system. The authors consistently guide the reader through all stages: from identifying Bounded Contexts and modeling domain events to implementing repositories, services, and transport layers (HTTP, gRPC, message queues). Special attention is paid to code idiomaticity: the authors show how to use Go interfaces to define ports and adapters, how to avoid an «anemic model», and how to properly organize packages without breaking domain boundaries. Each chapter contains practical examples, diagrams, and comparisons of «bad» and «good» code.
Who this book is for
- Go developers with at least 1 year of experience who want to delve deeper into architecture.
- Software architects looking for specific patterns to implement DDD in Go.
- Tech leads and team leads responsible for designing microservices.
- Developers transitioning from other languages (Java, C#) to Go and wanting to apply DDD without «heavy frameworks».
What the reader will learn
- DDD fundamentals applied to Go: Entity, Value Object, Aggregate, Domain Event, Repository, Factory.
- Clean Architecture (hexagonal architecture) in Go: how to separate domain, application, and infrastructure.
- Testing domain logic without mocks, using table-driven tests and interfaces.
- Working with transactions and concurrency in the context of DDD (Unit of Work pattern).
- Integration with external systems via ports and adapters (HTTP, gRPC, Kafka).
- Code organization in monorepos and Go modules.
- Error handling in the domain: creating custom error types, contextual errors.
- Event Sourcing and CQRS — a basic introduction and implementation example.
Strengths
- Practical focus: the code from the book can be immediately adapted for your own projects.
- Idiomaticity: the authors do not impose a Java style, but show what DDD looks like «the Go way» (small interfaces, composition, explicit dependencies).
- Clear structure: each chapter ends with a summary and a «key takeaways» list.
- Emphasis on testing: a whole chapter is dedicated to testing the domain and infrastructure.
- Modernity: the book uses Go modules, context.Context, middleware, generics (although before Go 1.18 — but the authors provide adaptation tips).
Who should read it
The book is a must-read for anyone building complex business systems in Go (ERP, CRM, fintech, logistics, marketplaces). It will be useful both for those just starting to implement DDD and for experienced practitioners who want to see a «sweet spot» between pure DDD and Go pragmatism. If you are tired of «god services» and want to write code that is easy to change for new business requirements — this book is for you.