Modular monoliths
Keep one deployment while giving features real boundaries.
The problem and the pattern
A small team needs independent booking and billing models without operating a fleet of services. Organize modules around business capabilities, expose narrow contracts, and keep tables under module ownership. Enforce references so the billing module cannot reach into booking internals.
Follow the flow
Make it concrete
This excerpt isolates the concept. Connect it to the booking API as you work through the exercise.
public interface IBookingModule
{
Task<BookingReceipt> ReserveAsync(
ReserveBooking command, CancellationToken ct);
}
// Billing consumes the public contract, not booking tables.Trade-offs
- One deployment simplifies releases and local debugging.
- Boundaries still need automated dependency checks.
- A shared database is compatible with module ownership; cross-module SQL is a policy decision.
When to avoid it
Avoid using folders as evidence of modularity when the team cannot enforce data and dependency boundaries.
Your turn
Draw the allowed dependencies for booking and billing. Where should a shared customer ID live?
Reveal a worked answer
Treat the ID as a value passed across contracts. Keep customer behavior in its owning module; avoid a shared model library that makes every module depend on every change.