Relation of Microservices and DDD CQRS and ES

Relation of Microservices and DDD CQRS and ES

For the last couple of weeks I’ve been starting and trying to understand DDD CQRS, ES and Microservices.
I think I’ve understood them individually but not as a single unit so this is why I have some misunderstandings that I hope to clarify.
So first what is the relation between Microservices and DDD, can you do one without the other?
And secondly, does Bounded Contexts translate in the end into a microservice ?

Solutions/Answers:

Solution 1:

No relationship between Microservices and DDD… And yes you can definitely do one without the other.
Bounded context is domain level and microservice it’s an implementation/infrastructure/architecture whatsoever, they can be related if you want to…

Domain Driven Design is a set of tactical and strategical design principles introduced by Eric Evans in 2003… to tackle complexity in software

Microservices is an architecture for designing an app as suites of independently deployable services

CQRS and Event Sourcing are a way to implement a Domain Driven Design (could be seen as building block in DDD), but they could be used outside DDD like the other building blocks.

Solution 2:

Eventhough I agree with the answer from @rad Microsoft recently published an ebook about microservices and asp.net core in which they combine microservices and DDD successfully.

See https://www.microsoft.com/net/download/thank-you/microservices-architecture-ebook

Solution 3:

I think microservices and DDD have different origin but we need both. See how:

DDD says how to break and design your software around the business domain

Microservices says break and design your business domain in smaller sort of independent services to scale

Related:  Handling JWT and Refresh token flow

Now if you look closely both talk about break and design your software into smaller pieces, microservices in term of services(for scaling) and DDD in terms of Bounded Context(for design).

Also microservices need consistency which can be eventual only and DDD tactical strategy helps in designing eventual consistent system

To solve a big business problem we need both DDD and Microservices, and need to find a good cor-relation between them.

From my perspective no microservice can span a bounded context , also one bounded context may have multiple micorservice .And the dependecny between microservices is majorly governed by mapping between bounded context

References