Skip to content
kc@kumarChandrachooda.com:~$ cd /blog/series/five-modules-one-database-each && read --section="top" 0%
Series

Five Modules, One Database Each

In reading order.

  • 15 parts
  • ≈ 102 min total
  • 15 published
Part 1 07 Jan 2026 7 min read

Four Architectures in One Solution

Inflow is a modular monolith whose modules agree on their boundaries and disagree about everything inside them - a four-project onion next to a single feature-sliced assembly. Part 1 of a series reading the money-moving half of the estate.

Part 2 08 Jan 2026 7 min read

The Wallet That Adds Itself Up

Inflow's Wallet has no balance column - the balance is a fold over the transfer ledger, computed the same way on the write side and the read side. It is the best decision in the module, and it costs more than it looks.

Part 3 08 Jan 2026 7 min read

A Million Is Where the Wallet Breaks

Inflow's Amount value object rejects anything above one million, and the wallet balance is an Amount. Two legal credits of six hundred thousand leave a wallet that can still take money in and can never be read or spent again.

Part 4 09 Jan 2026 7 min read

Two Aggregates, One Method

Wallet.TransferFunds mutates a second aggregate root inside the first one's method - the textbook DDD violation, committed for a good reason. The reason survives the domain layer and does not survive the handler.

Part 5 10 Jan 2026 7 min read

The Reference That Points at Itself

Each half of an Inflow transfer stores a referenceId in its metadata. On both legs that reference is the leg's own id - so the two halves of a transfer cannot be joined from the data they persist.

Part 6 10 Jan 2026 6 min read

A Setter on the Ledger

Inflow's Wallet guards its transfers behind a private HashSet and then exposes a public setter for it. Assigning an empty list zeroes any balance with no exception, no version bump and no trace - and Entity Framework never needed the setter.

Part 7 11 Jan 2026 7 min read

The Version That Counts to Two

Inflow's aggregate root increments its Version at most once per instance lifetime. As a concurrency token that is correct; as a version number it is a lie - and the one unit test that touches it documents the latch instead of catching it.

Part 8 12 Jan 2026 6 min read

Money Without a Currency

Inflow models money as an Amount that wraps a bare decimal and a Currency that lives beside it on the entity. The two never travel together, nothing rounds, and the column is unconstrained numeric.

Part 9 13 Jan 2026 6 min read

Onion Versus Folder

Wallets is four projects, Payments is one, and the same author wrote both in the same week. Three claims are usually made for the extra assemblies - one is true and verifiable in XML, one is weaker than it looks, and one is provably false.

Part 10 13 Jan 2026 7 min read

The Read Side the Layers Lost

Wallets abstracts its queries behind a storage interface that returns aggregates and maps in memory. Payments injects the DbContext and projects in SQL. On the read path the layered module is the slower and more coupled one.

Part 11 14 Jan 2026 6 min read

One Guid, Five Customers

A single Guid minted at sign-up becomes a user, a customer, a payments customer, a wallet owner and a saga id - four Postgres schemas, five field names, zero foreign keys and nothing that declares the equality.

Part 12 15 Jan 2026 7 min read

Lock the Customer, Half the Estate Notices

Locking a customer flips a flag in three of the four modules that hold one. Wallets has Lock and Unlock methods on its Owner entity and nothing in the estate ever calls them - so the module that moves money is the module that never hears.

Part 13 15 Jan 2026 7 min read

A Saga Held Together by a String

Inflow's withdrawal flow is a three-module round trip with a compensating branch and no saga class. The correlation between the halves is a magic string declared three times and a JSON blob written by hand on one side and deserialised on the other.

Part 14 16 Jan 2026 7 min read

Compensation That Cannot Fire

Inflow's one real saga has four compensation methods and no message that can ever trigger them. Its state lives in memory, its ordering rests on an undocumented property of a background service, and its failure mode is a denied bonus recorded as success.

Part 15 17 Jan 2026 8 min read

The Tests That Document the Bug

Inflow has nine tests, all in one module, and the most interesting one asserts a defect as if it were the specification. The honest retrospective on five modules, four architectures and what the estate actually teaches.