Microservices: Sagas, CQRS, API Gateway & Event Sourcing
Learn microservice patterns one diagram at a time: decomposition, REST and messaging, sagas, event sourcing, CQRS, API gateways, testing, deployment, and strangling a monolith.
What you will learn
- Escaping monolithic hell
- Decomposition: capabilities and subdomains
- Interprocess communication: REST, gRPC, messaging
- Sagas instead of distributed transactions
- Aggregates and domain events
- Event sourcing
- Queries: API composition and CQRS
- API gateway, BFF, and GraphQL
- Testing: pyramid, doubles, and unit tests
- Testing: contracts, components, end-to-end
- Production-ready: security, config, observability
- Deploying: containers, Kubernetes, serverless
- Refactoring a monolith with the strangler
How it works
Twenty-seven visual chapters in twelve parts, organized like the microservice pattern language: decomposition, communication, data, testing, deployment and refactoring.
Lessons
- Escaping monolithic hell — Why monoliths become painful, what microservices fix, what they cost, and the signs that a team should, or should not, split.
- The pattern map: every problem, and the pattern that fixes it — An interactive map of 45 microservice patterns: the problem each one solves and the new problem it creates.
- Decomposition strategies: where to cut — Decompose by business capability or by DDD subdomain and bounded context, find service boundaries, and avoid the distributed monolith.
- Interprocess communication and synchronous APIs — Synchronous calls between services with REST and gRPC, service discovery, timeouts, retries and circuit breakers, and the cost of call chains.
- Asynchronous messaging and brokers — Commands, events and replies over a message broker, point-to-point vs publish-subscribe, ordering, and competing consumers.
- Database per service and the shared database — Why each microservice should own its data, what a shared database costs, and how to query and keep data consistent across services.
- API gateway and backends for frontends — What an API gateway does (routing, auth, rate limits, aggregation) and when separate backends for web and mobile frontends help.
- Testing strategy and unit tests — The test pyramid for microservices, unit tests for domain logic, and testing sagas and message handlers without a broker.
- Building your first microservices — Build two small services with Node.js, containerise them with Docker, connect them with HTTP and messaging, and run them with Compose.
- Designing business logic inside a service — Domain-driven design aggregates: consistency boundaries, referencing other aggregates by id, and publishing domain events from business logic.
- Transactional messaging and idempotent consumers — Save data and publish an event without losing either: the transactional outbox, polling vs log tailing, and idempotent consumers for duplicates.
- Domain events: design and schema evolution — What to put in a domain event, thin vs fat events, versioning, and evolving event schemas without breaking consumers.
- Managing transactions with sagas — Replace distributed transactions with sagas: local transactions plus compensations, choreography vs orchestration, and isolation countermeasures.
- Event sourcing: store what happened, not just where you ended up — Store every change as an event and rebuild state by replaying them: the event store, snapshots, versioning, and when event sourcing is not worth it.
- Queries: API composition and CQRS — Query data spread over services with API composition, or build a separate read model with CQRS, and the lag and complexity each brings.
- UI patterns: micro frontends and live updates — Split a frontend by team with micro frontends, compose them, and push live updates to the UI with WebSockets or server-sent events.
- Integration, contract and end-to-end tests — Integration tests, consumer-driven contract tests with tools like Pact, and keeping slow end-to-end tests to a few critical journeys.
- Security, configuration and the chassis — Pass identity between services with tokens, secure service-to-service calls, and externalise configuration and secrets per environment.
- Observability — Health checks, structured logs, metrics, distributed tracing with correlation ids, and exception tracking across many services.
- Resilience and stability patterns — Keep one slow service from taking down the rest: timeouts, retries with backoff, circuit breakers, bulkheads and fallbacks.
- Deployment patterns and Kubernetes — Deployment patterns from VMs to containers and Kubernetes, rolling and blue-green deploys, and service meshes.
- Serverless deployment — Run services as functions: when serverless fits, cold starts, limits, cost at scale, and wiring functions to queues and APIs.
- Continuous integration and delivery pipelines — One pipeline per service: build, test, publish images and deploy independently, with monorepo vs multi-repo trade-offs.
- Scaling microservices — Scale out stateless services, partition data and work, autoscale on the right metric, and find the real bottleneck first.
- Refactoring a monolith: the strangler application — Grow new services around a monolith and route traffic to them piece by piece until the old code can be removed, without a big-bang rewrite.
- Decomposing the database — Move tables out of a shared database step by step: split schema first or code first, sync data during the move, and replace joins.
- Teams and evolutionary architecture — How team structure shapes service boundaries, Conway's law in practice, and evolving an architecture as the organisation changes.
- FlixTube in production — Take an example video app to production: Kubernetes, CI/CD, monitoring, debugging and the problems that only appear under real load.
More courses
- Jobs, linked to lessons — Browse jobs where every requirement links to the chapter that teaches it. See how ready you are, how long the gap takes to close, and which listings look stale.
- Match a job post to courses — Paste a job post. Each skill is matched to a track here and put in learning order, foundations first.
- React patterns from open source — Patterns extracted from Material UI, Radix, React Aria, React Hook Form, Redux Toolkit, TanStack, and Next.js — not slides about hooks.
- Databases in depth — How a query becomes work. Indexes, isolation, locks, and the plans that explain why a page is slow — not an ORM tour.
- System Design — Core concepts first (SQL vs NoSQL, CAP, indexing, replication, sharding), then designs grouped by what carries them: the database, Redis, Kafka, or many services.
- NestJS: build a real API — One ticket-booking API, built in order: a plain Node server first, then NestJS modules, validation, a real database, and the features real clients lean on.
- Kafka — A beginner-to-senior path through event logs, reliable delivery, production operations, and disaster recovery.
- AI engineering for software engineers — Eight free reads, in order, for software engineers moving into AI: when to build an agent, how to build one, how to test it, and how the model works underneath.
- Frontend system design — How a UI is sliced when it is a product, not a page: ownership of state, cache, routes, and what happens when the network lies.
- TypeScript in depth — The type system as a design tool. Inference, narrowing, generics, and the errors that mean the model is wrong — not a catalog of utility types.
- CSS in depth — See the box, then the page. Visual chapters from the box model through Flexbox surprises, Grid, selectors, and units, then backgrounds, shapes, and visual effects, each with a playground.
- Accessibility — Foundations first (WCAG in plain words, semantic HTML, lists, alt text), then hands-on HTML labs, a full pass of WAI-ARIA 1.3, and a final fix-the-page challenge.
- Docker — What an image is, why layers cache, and how containers find each other on a network.
- Redis — Fifteen Redis patterns, one picture each: cache, session, lock, counter, rate limiter, queue, and when Redis is the wrong tool.
- Kubernetes — Kubernetes from zero to operators: why it exists, Pods, Deployments and Services, then configuration, networking, storage, scheduling, scaling and security.
- AWS — AWS networking in plain English. A VPC is a gated housing society: streets are subnets, the Internet Gateway is the main gate, and a route table is the signboard.
- Networking: the NetRoute game — NetRoute is a packet logistics game. You wire up computers, switches, routers, firewalls and gateways, set each device, and watch glowing packets travel. If a packet gets dropped, the game shows you which header field was wrong.