When I built Simple Todo on my own, I wanted two things that usually pull in opposite directions: ship fast, and don’t drown in my own code by month two. The answer was a modular monolith, organised by feature. It grew to 30 feature modules over 18 production releases.
Why not microservices
One developer, one database, one deploy. Microservices would add network calls, separate deploys and distributed debugging, with none of the team-scaling benefits they exist for. A monolith with strict internal boundaries gives you most of the design benefits at a fraction of the cost.
Feature-first layout
src/features/
tasks/
ui/ # React components
server/ # actions, queries, domain logic
db/ # schema + repository (Drizzle)
index.ts # the ONLY public surface
tasks.test.ts
notebook/
reminders/
sync/
...
Everything about one feature lives together. Deleting or rewriting a feature touches one folder.
Boundaries you can’t accidentally cross
Folders alone don’t hold a boundary. Lint rules do. Other modules may import features/tasks (its index.ts) but never features/tasks/server/internal-thing:
// eslint: no-restricted-imports
patterns: [{ group: ['@/features/*/*'], message: 'Import from the feature index only.' }]
When a feature needs another feature’s data, it goes through that feature’s public functions. That makes dependencies visible in code review.
Security as a cross-cutting rule
In a multi-tenant app, the scariest bug is user A reading user B’s data (IDOR). I didn’t want that to depend on remembering. So:
- Every repository function takes the current user’s ID and scopes the query by it.
- An automated test walks every route and action that takes a resource ID, and asserts that another user’s ID is rejected.
- Inputs are validated at the module boundary, with rate limiting on public endpoints.
Tests where they pay off
Around 1,500 automated tests sound like a lot for one person. Most are cheap Vitest tests at module boundaries, plus a Playwright layer for critical user flows. Boundary tests survive refactors inside a module. That’s exactly what lets you keep shipping every few days.