Architecture
Monolith vs Microservices: What Startups Should Actually Build
Most startups that ask us about microservices have one product, one database and fewer than ten engineers. They are not asking because the monolith is failing. They are asking because microservices sound like what serious companies do.
That instinct is expensive. This post explains what each architecture actually buys you, what it costs, and the path we recommend for most early-stage teams: a well-structured monolith that is easy to split later, if you ever need to.
The two shapes in plain terms
A monolith is one deployable application. All your features (accounts, billing, search, notifications) live in one codebase, run in one process and usually share one database. A function call from billing to accounts is just that: a function call.
Microservices split those features into separate applications, each with its own deployment, its own data store and a network API. Billing asks accounts for a user over HTTP or a message queue, and either side can be deployed, scaled or rewritten without touching the other.
Picture the same product drawn both ways. The monolith is one box with internal sections and a single database underneath. The microservices version is five boxes, five databases, an API gateway in front and a web of arrows between them. Every one of those arrows is a network call that can be slow, fail or return stale data.
What microservices actually buy you
The benefits are real, but most of them are organisational rather than technical:
- Independent deployment. A team can ship its service without coordinating a release with everyone else.
- Independent scaling. The image-processing service can run on 40 machines while the settings page runs on two.
- Fault isolation. A memory leak in recommendations does not take down checkout, provided you have designed for it.
- Technology freedom. One service can be Python for ML work while the rest stays TypeScript.
- Clear ownership. A service boundary is a hard wall around what a team owns.
Notice who these help most: many teams working on one product at the same time. That is why microservices became popular at companies with hundreds of engineers. The architecture mirrors the org chart, which is Conway's law working as intended.
What they cost
Every benefit above comes with a bill that arrives on day one, long before you have the scale to justify it:
- Distributed systems problems. Network calls fail, time out and arrive out of order. You now need retries, timeouts, idempotency and circuit breakers for things that used to be function calls.
- Data consistency. With one database you get transactions. With a database per service, "create the order and charge the card" becomes a saga with compensating steps when one half fails.
- Operations. Each service needs a pipeline, monitoring, alerts, secrets and on-call coverage. Debugging one user request means tracing it across several services, so distributed tracing stops being optional.
- Slower change across boundaries. Most early product changes touch several features at once. In a monolith that is one pull request. Across services it is several, plus API versioning so you do not break callers.
- Infrastructure spend. More running processes, more load balancers, more data moving over the network.
None of this is hypothetical. In 2018 Segment published "Goodbye Microservices", describing how its team merged more than 140 services for its event destinations back into one, because the overhead of running them had become a heavy tax on a small team. In 2023 Amazon's Prime Video team wrote that moving one audio and video monitoring service from a distributed design to a single process cut that service's infrastructure cost by over 90%, largely by removing the cost of passing data between components. Both teams kept microservices elsewhere. The point is not that microservices are wrong; it is that they were the wrong shape for that particular problem.
Side by side
| Monolith | Microservices | |
|---|---|---|
| Time to first release | Fast: one repo, one deploy | Slow: platform work before features |
| Cross-feature changes | One pull request | Several services, versioned APIs |
| Transactions | Native database transactions | Sagas, eventual consistency |
| Debugging | One log stream, one stack trace | Distributed tracing across services |
| Scaling | Scale the whole app (often fine) | Scale each part independently |
| Team fit | One to a few teams | Many teams needing autonomy |
| Ops burden | Low | High, grows with service count |
For a team of five to fifteen engineers looking for product-market fit, almost every row favours the monolith. The rows that favour microservices describe problems you will be glad to have later.
The middle path: a modular monolith
The real risk with a monolith is not that it is one deployable. It is that, without discipline, it turns into a tangle where every file imports every other file. That is what people actually mean when they complain about "the monolith".
The fix is a modular monolith: one deployable, but split internally into modules with clear boundaries. Each module owns its data and exposes a small public interface. Other modules may only use that interface, never its internal files or tables.
Shopify is the best-known example. Rather than breaking up its large Rails application into services, it reorganised the code into components with enforced boundaries and later released Packwerk, an open-source tool that flags code reaching across those boundaries.
Here is what a boundary looks like in a TypeScript codebase:
// src/modules/billing/index.ts: the only file other modules may import
export interface BillingService {
createInvoice(accountId: string, amountCents: number): Promise<{ invoiceId: string }>;
getBalance(accountId: string): Promise<number>;
}
export { billingService } from "./service"; // implementation stays private
// src/modules/orders/checkout.ts
import { billingService } from "@/modules/billing"; // allowed: public interface
// import { invoicesTable } from "@/modules/billing/db"; // not allowed
export async function checkout(accountId: string, totalCents: number) {
const { invoiceId } = await billingService.createInvoice(accountId, totalCents);
return { invoiceId };
}
Enforce the rule with tooling, not good intentions. In TypeScript, the no-restricted-imports rule in ESLint or a tool such as dependency-cruiser can fail the build when one module imports another's internals. Apply the same rule to data: billing's tables are read and written only by billing's code.
The payoff comes later. If billing ever needs to become its own service, the interface already exists. You replace the in-process implementation with an HTTP or queue client that satisfies the same BillingService type, and callers do not change. Extracting a service from a clean module is a project. Extracting one from a tangle is a rewrite.
When to split out a service
Start with the monolith and extract a service only when you can name a concrete reason. The reasons we see hold up in practice:
- A part with very different load. Video transcoding, PDF generation or ML inference that needs GPUs or bursts of compute you do not want on your web servers.
- A part with different reliability or security needs. Payments handling under PCI scope, or a public webhook receiver you want isolated from internal systems.
- A part that needs a different runtime. A Python model-serving service next to a TypeScript product.
- Teams blocking each other. Several teams regularly waiting on one deploy pipeline, with ownership lines that are already clear in the code.
A background job queue, a separate worker process or a scheduled task often solves the first problem without a full service. Try that first.
The reasons that do not hold up: "we might need to scale", "it is cleaner", "investors expect it", and "we want to use Kubernetes". If the reason is about the future rather than a problem you have today, keep the boundary in code and move on.
What this means for AI features
The same logic applies to the AI work many startups are adding now. An LLM-powered feature, a RAG pipeline or a vector search layer can usually start as a module inside your existing app, calling a model provider's API. Split it into a service when it needs its own hardware, its own scaling or its own release cadence, not before.
The takeaway
Microservices solve coordination problems between many teams. They do not make a small team faster, and they bring distributed-systems costs from the first day. For most startups the right default is a modular monolith: one deployable, strong internal boundaries, each module owning its data. Split out a service when a specific part has a specific reason to live apart, and the clean boundary you already have will make that a contained change.
Planning the architecture for a new product, or untangling one that has grown messy? Talk to us about the right structure for your team and stage.