Web and mobile app architecture: monolith, modules and microservices
Application architecture is how a product is divided into parts and how those parts are connected: interfaces, the API, business logic, the database, background jobs and integrations. The two extremes are a monolith, where everything is assembled into a single application, and microservices, where each part lives separately. For most new products the sensible choice is a monolith that is well divided into modules: it is simpler to build and release, and individual parts can be split out later when there is a real reason to do so.
Open the software development page
What architecture is and why it matters to a business
Architecture is often seen as a matter for programmers, but its consequences are felt by the whole business. It determines how much each new feature costs, how quickly bugs are fixed, whether the product can handle a growing number of customers and whether it can be handed to another team without months of onboarding.
Good architecture is not necessarily complex. On the contrary, it is most often simple and clear: each part has a clear responsibility, data is kept in one place and the connections between parts are described. Poor architecture does not show itself at once: at first everything works, and a year later any change touches three other places and requires a week of testing.
That is why architectural decisions are made deliberately at an early stage, together with user scenarios and the data structure, and written down, so that a year later it is clear why things were done this way.
What parts an application consists of
Almost any business application can be broken down into several layers, regardless of the chosen approach:
- Interfaces: the mobile app, web account, desktop version, bot. They display data and accept user actions.
- API: the set of methods through which interfaces call the server side.
- Business logic: order rules, calculations, statuses, access rights.
- Data: the database, file storage, cache.
- Background jobs: mailings, reports, exchanges with other systems.
- Integrations: payments, delivery, CRM, accounting systems.
The central question of architecture is how to group and deploy these parts: all together in one application or separately. More on what happens on the server in the guide to the web app database.
Monolith: everything in one application
A monolith is an application in which all server logic is assembled into one program and released as a whole. The word often sounds like a reproach, but in reality most products start as a monolith, and many large services still run that way.
- Pros: simpler development and debugging, one database with no desynchronisation, one release process, lower infrastructure costs, and it is easier to test the product as a whole.
- Cons: with a poor internal structure the code becomes a tangle where everything is connected to everything; one heavy operation can slow down the whole service; the entire application has to be scaled rather than a single part.
Almost all the drawbacks of a monolith come not from the approach itself but from the lack of internal boundaries. If the modules are separated and communicate through clear interfaces, a monolith remains manageable for many years.
Microservices: separate parts with their own data
Microservice architecture divides a product into several small applications called services. Each one is responsible for its own area, such as the catalogue, orders, payments or notifications, has its own data and is released independently. Services communicate with each other through APIs or a message queue.
- Pros: parts can be released and scaled separately; a failure in one service does not necessarily stop the others; different teams work independently without getting in each other's way.
- The price: network calls instead of calls inside one program, which means delays and new kinds of failures; data is spread across different databases and is harder to keep consistent; more infrastructure is needed, including orchestration, monitoring of every service and end-to-end logs; testing the product as a whole is harder.
Microservices primarily solve an organisational problem: they let many teams develop a large product in parallel. If there is a single small team, their cost is usually higher than their benefit.
The modular monolith: a sensible middle ground
Between the two extremes there is an approach that is chosen more and more often for new products. A modular monolith is released as one application but is divided internally into modules with clear boundaries: each has its own area, its own data and a clear interface for the others.
| Monolith without boundaries | Modular monolith | Microservices | |
|---|---|---|---|
| Release | One application | One application | Each service separately |
| Data | Shared database, everything linked to everything | Shared database, modules own their tables | Each service has its own data |
| Infrastructure complexity | Low | Low | High |
| Independence of parts | Low | Medium | High |
| When it fits | Prototypes and very small projects | Most new products | Large products and many teams |
The main advantage of a modular monolith is that it keeps options open. If a module really starts to need separate scaling or a separate team, it can be moved into an independent service without rewriting the rest.
Common mistakes in architectural decisions
Most architecture problems repeat from project to project. They are easier to avoid if you know them in advance:
- Microservices from day one. A small product is split into a dozen services, and the team spends more time on the connections between them than on features for users.
- Logic in the interface. Price calculation or permission checks live only in the mobile app and have to be repeated in the web version, the bot and the admin panel, with the risk of discrepancies.
- No master source of data. The same information is stored in several places with no rule about which one is correct.
- Hard links to external services. A payment or email service is built into the code so that replacing it means rewriting half the product.
- Undocumented decisions. A year later nobody remembers why a particular approach was chosen, and people are afraid to touch it.
All of these mistakes are cheaper to prevent at the design stage than to fix in a running product with real users.
How to choose an architecture for the task
The choice is made not by fashion and not by how the largest companies are organised, but by the circumstances of a specific product. It helps to answer a few questions:
- How many teams will work on the product at the same time over the next few years.
- Whether there are parts with fundamentally different loads, for example rare calculations and a constant stream of notifications.
- How critical a failure is: what must keep working if one part is unavailable.
- Whether some parts must be kept separate for security or legal reasons.
- Who will maintain the infrastructure after launch and whether there are enough resources for it.
- How well the scenarios are known: a new idea still being tested or an established process.
For the first version of a product that tests an idea, a simple architecture almost always pays off: it ships faster and is cheaper to change when it turns out that users need something else. More on this in the guide to what an MVP is.
Signs of an architecture that can evolve
Whatever approach is chosen, healthy architecture shares common traits:
- a well-thought-out data structure and clarity about which system is the master for each type of data;
- documented APIs: interfaces and external systems know what they can request and what they will get back;
- money and permissions are checked on the server, not in the interface;
- secrets are kept outside the code, and settings for different environments are separated;
- automated tests for key scenarios, so that code can be changed without fear;
- logs and monitoring that show what is going on;
- a description of how the product is built and released that a new developer can understand.
If the architecture was inherited from earlier years and holds back development, it does not have to be rewritten from scratch: systems are often renewed piece by piece without stopping work. How this is done is covered in the guide to legacy software modernization.
How JEEKSSHIRE 24 approaches architecture
We start from the task rather than the technology and propose the simplest solution that covers it. At the design stage we work out the screens, scenarios and server side, and build in languages, right-to-left text direction and access rights from the start. We explain the solution in terms of the task rather than the tech stack, so that the client can argue with it on the merits.
We release the product in parts: first the main scenario, then the following releases, and priorities can be changed between parts. The build, linting and tests pass before every deployment. Together with the product we hand over the source code and a description of how it is built and released, with the terms fixed in the contract. More on the pages for web application development and turnkey MVP development, and all our services are collected on the software development page.
Frequently asked questions
Which is better: a monolith or microservices?
There is no universal answer. For new products and small teams a modular monolith usually pays off, while microservices are justified in large products that several teams develop in parallel.
Can you move from a monolith to microservices later?
Yes, if the monolith has clear modules inside. Then a separate part is moved into an independent service without rewriting the rest.
Does architecture affect the cost of development?
Yes. Microservices require more infrastructure, monitoring and release work, and a poor structure makes every subsequent change more expensive.
What is a modular monolith?
It is an application released as a whole but divided internally into modules with clear boundaries and their own data. It is simple to maintain and leaves the option of splitting out services later.
Should architecture be documented?
Yes. A short description of the parts, connections, data and release process saves a new team time and helps explain why decisions were made the way they were.