Skip to content

Repository files navigation

RiverBooks

Sample application for Modular Monolith Courses on Dometrain. Use 'ARDALIS' for 20% off individual courses!

📚 View Full Documentation

Architecture Overview

View the interactive dependency diagram

Project Dependencies

Updates

2025 December Updated to .NET 10 and replaced MediatR with Mediator.SourceGen. 2025 July Removed FluentAssertions and replaced with Shoudly.

EF Migration Scripts

dotnet tool install --global dotnet-ef
dotnet tool update --global dotnet-ef

dotnet add package Microsoft.EntityFrameworkCore.Design

dotnet ef migrations add Initial -c BookDbContext -p ../RiverBooks.Books/RiverBooks.Books.csproj -s RiverBooks.Web.csproj -o Data/Migrations

dotnet ef database update -c BookDbContext

-- You may need to specify projects
dotnet ef database update -c BookDbContext -p .\RiverBooks.Books.csproj --startup-project ..\RiverBooks.Web\RiverBooks.Web.csproj

-- for tests to work
dotnet ef database update -c BookDbContext -p .\RiverBooks.Books.csproj --startup-project ..\RiverBooks.Web\RiverBooks.Web.csproj -- --environment Testing

Watch out for <InvariantGlobalization>true</InvariantGlobalization> in your Web API project.

Once you have multiple modules you need so specify the context every time:

-- in RiverBooks.Users folder:
dotnet ef migrations add CartItemDescription -c UsersDbContext -p ..\RiverBooks.Users\RiverBooks.Users.csproj -s .\RiverBooks.Web.csproj -o Data/Migrations

dotnet ef database update -c UsersDbContext -p .\RiverBooks.Users.csproj -s ..\RiverBooks.Web\RiverBooks.Web.csproj

For Order Processing:

-- in RiverBooks.OrderProcessing folder:
dotnet ef migrations add Initial_OrderProcessing -c OrderProcessingDbContext -p ..\RiverBooks.OrderProcessing\RiverBooks.OrderProcessing.csproj -s .\RiverBooks.Web.csproj -o Data/Migrations

dotnet ef database update -c OrderProcessingDbContext -p RiverBooks.OrderProcessing.csproj -s ..\RiverBooks.Web\RiverBooks.Web.csproj

Adding Addresses to Users:

-- in RiverBooks.Users folder:
dotnet ef migrations add UserAddresses -c UsersDbContext -p ..\RiverBooks.Users\RiverBooks.Users.csproj -s .\RiverBooks.Web.csproj -o Data/Migrations

dotnet ef database update -c UsersDbContext -p ..\RiverBooks.Users\RiverBooks.Users.csproj -s .\RiverBooks.Web.csproj

Local Tools and Slopwatch

Restore the repo-local .NET tools before running repository tooling:

dotnet tool restore

Run Slopwatch to detect newly introduced disabled tests, warning suppressions, empty catch blocks, and similar shortcut-style changes:

dotnet tool run slopwatch analyze -d . --fail-on warning

If Slopwatch reports that the baseline is missing, initialize it once and commit the generated file:

dotnet tool run slopwatch init

Docker Commands

Dev Container

This repository now includes a Docker Compose-based devcontainer in .devcontainer/.

When opened in VS Code using Dev Containers: Reopen in Container, it starts:

  • SQL Server (sqlserver)
  • Redis (redis)
  • MongoDB (mongodb)
  • Papercut SMTP + web UI (papercut)

The devcontainer service injects the expected app configuration via environment variables (ConnectionStrings__*, MongoDB__ConnectionString, Redis__ConnectionString, and Email__*), so running RiverBooks.Web from inside the container can connect to these dependencies directly.

On first container creation, .devcontainer/post-create.sh runs:

dotnet tool restore
cd src && dotnet restore RiverBooks.slnx

Papercut web UI is available on port 37408.

Redis

docker run --name my-redis -p 6379:6379 -d redis

MongoDB

docker run --name mongodb -d -p 27017:27017 mongo

Papercut

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

About

Modular Monolith sample for Dometrain

Resources

Stars

128 stars

Watchers

5 watching

Forks

Releases

Packages

Used by

Contributors

Languages