mcwiekala / modular-monolith-restaurant

Modular Monolith with simple restaurant domain. Architecture is based on Onion Architecture. Modules are communicating with each other with EventBus.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Modular Monolith architecture status

...in Egg Restaurant

logo

Architecture

This project is an example of Modular Monolith with Onion Architecture. Communication between the modules is implemented with events and Event Bus. Onion Architecture is based on 3 layers:

  • domain - bussines requirement
  • application - frameworks, services, technology specific code
  • infrastructure - other systems like DB, JMS, REST API

Check Jeffrey Palermo's blog to learn more about Onion Architecture!

schema

Check also Robert C. Martin's blog post about clean architecture!

Domain is in the heart of software and with this approach we can achieve loosely coupling between modules. If the business is mature then the domain module will stay unchanged. So when the framework became rusty and the team decide to change technology it will have no impact on business code. The same perfomance/integration changes.

Monolith First!

The first step to deliver distributed system should be Modular Monolith, since Microservices requires much more infrastructure effort. Additionaly business domain must be stable because changes between the modules are difficult to implement.

Event Bus

Event Bus is a subset of Publish-Subscribe patterns. It's a combination of Observer and Mediator pattern. It's implementation can vary in other languages and frameworks, here's my Java example.

Event Bus is an architectural pattern it's used in distributed asynchronous architecture to create highly scalable reactive applications. It provides loosely coupling between different components.

schema

Check Microsoft page

Egg Domain...

schema

The domain is based on restaurant which serves eggs.

No Database

The project contains only InMemory Repository since it is used only for learning purposes.

Modules

├─┬ eggrestaurant
│ ├── commons
│ ├── cooking
│ ├── restaurant
│ └── wash

Contexts

Domain is based on 3 subdomains since egg means something else for different actors.

  • for customer egg means something to eat.
  • for cook it means an ingredient to make a meal.
  • for dishwasher it means nothing else but ugly slush to wash...

schema

Inspiration

Inspiration based on Wade Waldron's talk: "Domain Driven Design and Onion Architecture in Scala" on Scala Days 2016

About

Modular Monolith with simple restaurant domain. Architecture is based on Onion Architecture. Modules are communicating with each other with EventBus.

License:MIT License


Languages

Language:Java 77.5%Language:Groovy 22.5%