Skip to content

vbsantos/dotnet-modular-books-api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

30 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ModularMonolith Books

This is a learning project aimed at understanding the principles and implementation of Modular Monoliths in .NET 9.

Technologies & Packages

External Services

  • MongoDB: A NoSQL database - Used in the Outbox Pattern
  • MSSQL: A relational database- Used for the modules main databases
    • During the development of this project, I used the local MSSQL instance (localdb) for database operations.
  • Papercut: A Simple Desktop Email Server - Used for testing
  • Redis: An in-memory data structure store - Used for the Materialized View Pattern

Modules

Books

To create the Initial migration go to the Vini.ModularMonolith.Example.Web directory and this command:

dotnet ef migrations add Initial -c BooksDbContext -p ..\Vini.ModularMonolith.Example.Books\Vini.ModularMonolith.Example.Books.csproj -s .\Vini.ModularMonolith.Example.Web.csproj -o Data/Migrations

To run the migrations

dotnet ef database update --context BooksDbContext

Books.Tests

To run migrations for the appsettings.Testing.json file, run this command:

dotnet ef database update -c BooksDbContext -p Vini.ModularMonolith.Example.Web/Vini.ModularMonolith.Example.Web.csproj -- --environment Testing

Users

To create the Initial migration go to the Vini.ModularMonolith.Example.Web directory and this command:

dotnet ef migrations add Initial -c UsersDbContext -p ..\Vini.ModularMonolith.Example.Users\Vini.ModularMonolith.Example.Users.csproj -s .\Vini.ModularMonolith.Example.Web.csproj -o Data/Migrations

To run the migrations

dotnet ef database update --context UsersDbContext

OrderProcessing

To create the Initial migration go to the Vini.ModularMonolith.Example.Web directory and this command:

dotnet ef migrations add Initial -c OrderProcessingDbContext -p ..\Vini.ModularMonolith.Example.OrderProcessing\Vini.ModularMonolith.Example.OrderProcessing.csproj -s .\Vini.ModularMonolith.Example.Web.csproj -o Data/Migrations

To run the migrations

dotnet ef database update --context OrderProcessingDbContext

OrderProcessing.Tests

Has some architecture tests.

EmailSending

To run papercut as a container, run this command:

docker run --name modular-monolith-papercut -d -p 25:25 -p 37408:37408 jijiechen/papercut:latest

To run MongoDB as a container, run this command:

docker run --name modular-monolith-mongo -d -p 27017:27017 mongo

Reporting

This module has an event ingestion system that saves the necessary report data in a dedicated database.

Shared Kernel

This module houses cross-cutting concerns and shared functionalities used by multiple modules within the system, like:

  • MediatR Behaviors: These are pipeline behaviors that can encapsulate logic such as:
    • Logging: Using tools like Serilog to log request handling, performance metrics, or errors in a centralized manner.
    • Validation: Implementing validation logic using FluentValidation, ensuring requests are pre-validated before reaching their handlers.
  • Domain Events: These are events that are raised within the domain and can be handled by other modules (or external systems).

About

A ASP.NET Core 9 Books API project with modular implementation.

Topics

Resources

Stars

Watchers

Forks

Contributors

Languages