Skip to content

Fifty modules later: what a solo clean-architecture API taught me

ArchitectureTypeScriptNode.js

Ibenio's API is an Express + TypeScript service organized into 50+ modules — events, ticketing, organizations, venues, a coin-economy ledger, Stripe billing, real-time via Socket.IO. I built and maintain it alone. That's an unusual place to apply clean architecture, and it taught me where the discipline actually pays.

Where it pays rent

Boundaries are documentation. Every module ships a README stating its routes, DTOs, and authorization rules, and the code review gate keeps them in sync. When the web app calls the API, the README is the contract — I stopped reverse-engineering my own endpoints months ago.

Services stay testable. Controllers parse and authorize; services hold the rules; repositories touch the database. The middle layer tests without a running Postgres, which is what makes a big refactor safe on a solo project — there's no reviewer to catch what the tests don't.

Infrastructure stays swappable. Object storage went from S3 to Cloudflare R2 in an afternoon because nothing outside the storage adapter knew where bytes lived.

Where it's ceremony

A plain CRUD module doesn't need four layers. For a while I stamped them out anyway, and the extra indirection cost more than it protected. The rule I settled on: a module earns layers when it has rules — money, inventory, permissions, anything with an invariant. The coin ledger has real invariants; a settings endpoint doesn't.

The other trap is premature generics. Three modules doing similar-but-not-identical things beat one "flexible" abstraction that all three fight against.

Guardrails over willpower

Solo discipline decays, so the repo enforces itself: pre-commit hooks run lint, typecheck, and the tests scoped to what changed; a reminder fires when a module's source changes without its README; secrets patterns are blocked at commit time. None of that requires me to be at my best on a Tuesday night — which is exactly the point.

If I were starting again I'd keep the module boundaries and the README contract, halve the layer count for simple modules, and write the guardrails first, not last.