Full Modular Monolith Rails application with Domain-Driven Design approach. This is the Rails version of the .NET application.
This repository makes use of branches to organize different versions of the above-mentioned app. The branches with stable versions are prefixed with main-
and each of them will have their own README with the appropriate details.
This version of the app is a Rails monolith using packwerk to structure its domains into isolated components.
Components can communicate with each other in two different ways:
- Making use of events. This is accomplished using ActiveSupport::Notifications which is a pub/sub system integrated into Rails, that works in a synchronous fashion.
- Calling methods on the public API of another component. This would be analogous to performing an HTTP API call to another service in a microservices architecture.
This version of the app extends main-packwerk
to replace ActiveSupport::Notifications
for Kafka for sending and consuming events. This means that events are now processed asynchronously, and a step towards a microservices architecture.
It implements the Transactional Outbox pattern to guarantee delivery of all the events, and makes use of Kafka Connect to do the log tailing on the DB and pushing the events to Kafka
.
Kafka
is used through the Karafka gem which simplifies its usage.
The app and all the required services are dockerized to make it easy to work with.
This version of the app extends main-transactional-outbox
and splits the single database into multiple databases, one per domain. To achieve this, it uses Rails Multi DB support
This version of the app extends main-multi-dbs
and implements the Saga pattern to coordinate a transaction across the multiple DBs. It uses a Choreography-based Saga so that each local transaction publishes domain events that trigger local transactions in other domains.