Product Engineering
Why most MVPs should start as a modular monolith
Microservices solve scaling problems most MVPs do not have yet. How to structure a modular monolith that is fast to build now and splittable later.
By Envexa Engineering6 min read
When founders ask for a technical architecture for their MVP, the instinct, often from conference talks about companies at enormous scale, is to reach for microservices. For an early product this usually trades a problem you do not have (scaling independent teams) for problems you will definitely have: distributed debugging, network failures, version coordination and operational overhead.
What an MVP is optimising for
An MVP exists to learn quickly whether something is worth building. The architecture should therefore maximise the speed of change and minimise the cost of being wrong. A single deployable application with one database is the simplest thing that supports that: one repository, one deployment, transactions that span features, and local development that is a single command.
Modular, not tangled
A monolith becomes a liability when everything can reach into everything. The remedy is not distribution; it is boundaries inside the codebase.
- Organise code by business capability (billing, accounts, projects), not by technical layer alone.
- Give each module a small public interface; other modules call that, not its tables or internals.
- Keep database access inside the owning module. Avoid cross-module joins on internal tables.
- Communicate across modules through function calls or domain events within the process.
- Enforce boundaries with lint rules or import restrictions so they do not erode.
src/
modules/
accounts/ # users, orgs, roles
index.ts # public API of the module
internal/ # not importable from other modules
billing/
projects/
platform/ # logging, config, db client, queue
web/ # routes and UI compositionDecisions worth making on day one
- Authentication and authorisation model. Roles and tenant scoping are expensive to retrofit.
- Data model and migrations. Use versioned migrations from the first commit.
- Background work. A simple job queue stops slow work from blocking requests.
- Observability. Structured logs and error reporting from the first deployment.
- Tests on the critical path. Not everything, but the flows that must not break.
When to split a service out
Extract a module into its own service when a specific, measurable constraint appears: it needs to scale independently (for example CPU-heavy document processing), it has a different runtime requirement (a Python worker beside a TypeScript web app), it has a different release cadence, or a separate team owns it. Because the boundary already exists, the extraction is mostly mechanical.
What this buys
You ship faster, debug with a single stack trace, and keep operational cost low, while retaining the option to distribute later. The aim is not to avoid architecture. It is to spend your complexity budget on the product instead of the plumbing.
Related articles
Background jobs: when a Postgres queue is enough and when to reach for Redis
Database-backed and Redis-backed job queues compared: durability, throughput, transactional enqueueing, retries and idempotency, and how to choose.
A production checklist for Dockerised FastAPI services
A practical checklist for running FastAPI in Docker in production: images, workers, health checks, configuration, logging, migrations, shutdown and CI.