architecture

Monolith Architecture: Why Most AI MVPs Should Start Here

A software architecture where all components of an application are built and deployed as a single unit, sharing one codebase and database.

A monolith is a software application where all components, user interface, business logic, data access, and background processing, are packaged and deployed as a single unit. The word has acquired a negative connotation in the era of microservices, but this reputation is largely undeserved for early-stage products. The monolith is not a legacy pattern to be avoided. It is the pragmatic starting point for almost every successful SaaS and AI product, including products that later scaled to serve millions of users. Understanding what a monolith is, when it works well, and how to structure one so it can evolve cleanly is foundational product engineering knowledge for any UK startup. GitHub, Shopify, Stack Overflow, and Basecamp all ran as monoliths well into their growth phases, and some continue to do so at significant scale. The key distinction that experienced engineers draw is between an unstructured monolith (a big ball of mud where modules bleed into each other) and a modular monolith with clear internal boundaries. The former is painful to maintain. The latter is genuinely robust and can be decomposed into services later if scale demands it. For AI MVPs in the UK, the monolith is the default choice because it enables a 2-3 week delivery timeline, deploys as a single unit to platforms like Vercel or Railway, and requires no distributed systems expertise to operate. SpeedMVPs builds modular monoliths by default, with architecture designed to support future service extraction if the product ever reaches the team size or traffic level that makes it necessary.

What a Monolith Actually Is

A monolithic application is one where all code runs in the same process and is deployed as a single artifact: a single binary, a single Docker container, or a single set of files on a web server. In a typical web application monolith, the HTTP request handling, business logic, database queries, and HTML rendering or JSON serialisation all happen within the same running application. There is no network boundary between components. A function can call another function directly. A database transaction can span multiple tables and business operations without the complexity of distributed coordination. This simplicity is the monolith's core advantage. Deploying a monolith means deploying one thing. Debugging a monolith means reading logs from one application. Adding a feature to a monolith means writing code in one place without defining API contracts and managing service versions. For a team of two to ten engineers building a product that does not yet have product-market fit, this simplicity translates directly into faster iteration.

The Modular Monolith Pattern

The mistake many teams make with monoliths is building them without internal structure, what is sometimes called a big ball of mud: all code mixed together with no boundaries, where changing one thing unpredictably breaks another. The solution is the modular monolith, where the single deployable unit contains well-defined modules with clear interfaces between them. In a Next.js AI product, this might mean separate directories and modules for user management, AI orchestration, document processing, billing, and notifications. Each module exposes a typed interface to other modules. Direct database access is contained within each module. Business logic for one domain does not reach into another domain's data directly. This structure provides most of the maintainability benefits of microservices without the operational cost. If and when the product scales to the point where service extraction is justified, each module can become a service because the boundaries are already clean.

Monolith vs Microservices: The Real Trade-off

The microservices vs monolith debate is often framed as a question of which architecture is better. This is the wrong frame. The right question is which architecture is better for your current team size, operational capability, traffic levels, and time constraints. Microservices provide independent deployability, independent scaling, and team autonomy for large engineering organisations. These benefits are real but they come with significant costs: distributed tracing, service discovery, API versioning, distributed transaction management, and the operational complexity of running multiple services in production. For a team of two to eight engineers building an AI MVP, the operational costs of microservices almost always outweigh the benefits. The monolith lets you focus on the product. The decision to decompose into services should be driven by concrete operational problems, not by a desire to follow architectural fashion. Many of the most successful AI products today, including early-stage versions of products that now serve millions of users, started as monoliths.

Deploying and Scaling a Monolith

A common concern about monoliths is that they cannot scale. This is largely a myth for the traffic levels relevant to a UK AI startup at MVP and early growth stage. A well-written monolith running on a modern cloud platform can handle tens of thousands of concurrent users with horizontal scaling: running multiple instances behind a load balancer. Most UK AI startups will not reach traffic levels that require architectural decomposition before they have significant revenue and a team large enough to manage the operational complexity of microservices. On platforms like Vercel, Railway, Fly.io, or AWS App Runner, deploying a containerised monolith is a matter of minutes. Auto-scaling is handled by the platform. Zero-downtime deployments are straightforward. The operational burden that microservices impose to achieve the same deployment and scaling behaviour is simply not necessary at this scale.

When to Move Away from a Monolith

The right time to begin extracting services from a monolith is when you have concrete, current operational problems that service extraction solves. The most common triggers are: you have a component with dramatically different infrastructure requirements (GPU inference servers), you have two or more engineering teams that cannot safely modify the same codebase without constant coordination, you have a compliance requirement that mandates data isolation between components, or a specific component needs to scale to a dramatically different level than the rest of the application. Notice that none of these triggers are about traffic volume alone. A well-scaled monolith can handle substantial traffic. The triggers are about team coordination, compliance, or infrastructure heterogeneity. If you are extracting services without hitting one of these triggers, you are adding complexity without a concrete benefit.

Monoliths and UK Compliance

For UK AI products operating under UK GDPR or FCA rules, a monolith has genuine compliance advantages. A single database with comprehensive audit logging is straightforward to map in a Data Protection Impact Assessment. Data subject access requests and right to erasure requests can be handled with a single set of queries against a known schema. There is no inter-service data flow to map, no question of which service holds which data, and no distributed transaction complexity when you need to delete a user's data across all tables. For NHS Digital integration or FCA regulated products, the simplicity of the compliance surface area is a genuine practical benefit. SpeedMVPs builds GDPR-aware monoliths by default, with data minimisation, audit logging, and right to erasure built into the data model from the start.

Frequently Asked Questions

Is a monolith architecture appropriate for a production AI product?+

Yes, absolutely. Many production AI products serving thousands of users run on a well-structured monolith. The architecture is appropriate for any product that does not yet have the team size, traffic, or compliance requirements that genuinely justify the complexity of a distributed system. A monolith with good internal structure, proper observability, and a CI/CD pipeline is a production-ready architecture.

What happens if my monolith becomes too large to manage?+

If you have built a modular monolith with clean internal boundaries, decomposing it into services later is substantially easier than extracting services from an unstructured codebase. The key is maintaining those boundaries from the start: not letting one module reach directly into another module's data, and keeping business logic within the module that owns it. With good discipline, a monolith can grow to millions of lines of code and remain manageable.

Can a monolith support multiple frontends (web, mobile, API)?+

Yes. A monolith can expose a REST or GraphQL API that is consumed by a web frontend, a mobile app, and third-party integrations simultaneously. The fact that the backend is a monolith does not constrain the number or type of clients that consume it. This is a common pattern for AI MVPs that have a Next.js web app and a React Native mobile client both calling the same backend API.

Is a Next.js application a monolith?+

A standard Next.js application with API routes is effectively a monolith: the frontend, API, and business logic all live in one deployable unit. When deployed to Vercel, individual API routes can scale independently as serverless functions, which gives some of the scaling benefits of service separation without the operational complexity of maintaining separate services. This is the architecture SpeedMVPs uses for most AI MVPs.

Does SpeedMVPs recommend monolith or microservices for AI MVP development?+

We recommend starting with a well-structured monolith for the vast majority of AI MVPs. The operational simplicity lets us ship a production-ready product in 2-3 weeks at a fixed price. We design the internal architecture with clear module boundaries so that the codebase can be decomposed later if the product achieves the scale that justifies it. If you have specific requirements that make service separation necessary from day one, such as GPU inference or strict data isolation, we design accordingly. Get a free consultation at speedmvps.co.uk

Want a production-ready AI MVP with the right architecture for your current stage? Get a free consultation at speedmvps.co.uk

Get a Free Quote