Inflow
About
Inflow is the sample virtual payments app built as Modular Monolith, written in .NET 6.0. Each module is an independent vertical slice with its custom architecture, and the overall integration between the modules is mostly based on the event-driven approach to achieve greater autonomy between the modules. The shared components (such as cross-cutting concerns & abstractions) can be also found in a modular framework.
Starting the application
Start the infrastructure (only PostgreSQL) using Docker:
docker-compose up -d
Start API located under Bootstrapper project:
cd src/Bootstrapper/Inflow.Bootstrapper
dotnet run
Solution structure
Bootstrapper
Web application responsible for initializing and starting all the modules - loading configurations, running DB migrations, exposing public APIs etc.
Modules
Autonomous modules with the different set of responsibilities, highly decoupled from each other - there's no reference between the modules at all (such as shared projects for the common data contracts), and the synchronous communication & asynchronous integration (via events) is based on local contracts approach.
- Customers - managing the customers (create, complete, verify, browse).
- Payments - managing the money deposits & withdrawals (to/from actual bank account).
- Wallets -managing the virtual wallets & money transfers between them.
- Users - managing the users/identity (register, login, permissions etc.).
Each module contains its own HTTP requests definitions file (.rest
) using REST Client extension.
Saga
Sample Saga pattern implementation for transactional handling the business processes spanning across the distinct modules.
Shared
The set of shared components for the common abstractions & cross-cutting concerns. In order to achieve even better decoupling, it's split into the separate Abstractions and Infrastructure, where the former does contain public abstractions and the latter their implementation.
Microservices transition
The sample module to microservice transition along with the integration with the existing modular monolith application can be found on microservices
branch. The complete, microservices based solution can be found in Inflow-micro repository.
Additional resources
-
Modular Framework project containing the shared components for own usage.
-
Knowledge base with articles.
-
Mini-course about the fundamentals of the modular monolith based on sample NPay repository.
-
Building Modular Monolith series on YouTube
-
Comprehensive course about building the modular monoliths.