Choosing an Architecture Style: Six Forces, a Five-Question Decision Tree and a Hybrid
No architecture style is best. Set six forces, walk five questions from the top, accept a hybrid when the needs are mixed, and write down why. Shown on five teams and the TicketHub support app.
What you will learn
- Name the six forces that decide an architecture style
- Walk the five-question decision tree from modular monolith down to serverless
- Explain why a real system like TicketHub ends up as a hybrid
- Record the choice in a short ADR and know when to extract a module
Before you start
- Basic idea of a web app with a database
- What a queue does
Five teams walk up to you with the same question: which architecture style should we use? A three-person startup. A bank with two hundred engineers. A smart-meter company with millions of devices sending readings. A school that runs one report every night. And our own TicketHub, a support-ticket app.
Should the answer be the same for all five? Of course not. Nobody asks which vehicle is best. One person going to town takes a bicycle, a family takes a car, two tons of goods go on a truck and fifty people get a bus. You ask what the job is. Architecture styles work the same way.
So here's the idea in one line: no style is best. Pick by the forces, and write down why.
The six forces
In architecture, "the job" is described by forces. Think of them as six dials you set before you choose anything.
- Team size. A few people, or many?
- Domain clarity. The domain is the business area your software covers. Are its boundaries clear, or still blurry?
- Traffic shape. Steady all day, or spiky?
- Latency target. How fast must a user get an answer?
- Budget. What can we afford to run, and to look after?
- Compliance and data rules. Where must data live, and who may touch it?
Set these six and the choice gets much easier.
The decision tree
Five questions, asked in order. Picture a ball dropping from the top; wherever it lands is your starting style.
Walk it with the ball:
- Is it just one team? Yes: modular monolith. Done.
- Are the domain boundaries clear? A boundary is the line between two business areas, say tickets and billing. If they're still blurry, it's a modular monolith again, because moving a line inside one app is cheap. Moving it between services is not.
- Do the parts need different scaling, or their own deploys? Yes: microservices.
- Can some of the work be done later? Sending an email, building a report. Yes: event-driven, with a queue.
- Is it spiky, short jobs? Then a serverless function.
Notice the order. You don't start at the bottom and look for reasons to stay simple. You start simple and move down only when an answer pushes you.
Five teams, five answers
| Team | What the forces say | Starting style |
|---|---|---|
| Three-person startup | One team, domain still changing | Modular monolith |
| Bank, 200 engineers | Many teams, clear business areas | Microservices built around those areas |
| Smart-meter company | Readings arrive in bursts, work can wait a little | Event-driven ingestion with a queue in front |
| School nightly report | One short job, once a day | Serverless function on a schedule |
| TicketHub | A mix of needs | A hybrid |
TicketHub is a hybrid
TicketHub's needs are mixed, so its architecture is mixed too.
- The core is a modular monolith: tickets, replies, the dashboard and users, in one app with one deploy.
- Sending emails and building reports are slow and can wait. The app drops a message on a queue and workers pick it up. That part is event-driven.
- Attachments go to storage, and a function makes the thumbnail only when a file arrives. That part is serverless.
Three styles in one app, each used where it fits. Real systems are very rarely pure.
A wrong choice is a path, not a trap
Start with a modular monolith on day one, then measure. Say the reports module is using 80% of the app's CPU. That number is an example, but it's the kind of number you look for. Now that one module moves out into its own service. Everything else stays where it was.
The rule: extract a module when a number proves the need, not before. The modular monolith lesson works through what that split really costs.
Write it down
A decision you can't explain later is only half made. TicketHub's choice goes on an architecture decision record (ADR), a short note on what was chosen and why:
| Field | TicketHub |
|---|---|
| Context | One team. About 230 reads and 7 writes a second at peak. The domain is still changing. |
| Decision | A modular monolith, a queue for slow work, and a function for thumbnails. |
| Alternatives | Microservices: too much to run for one team. All serverless: runs into limits on run time. |
| Consequences | Simple deploys. Revisit when a number shows one module needs its own scaling. |
A year from now someone will ask why. This card is the answer. There's more on the format in ADRs and C4 diagrams.
The four styles side by side
| Modular monolith | Microservices | Event-driven | Serverless | |
|---|---|---|---|---|
| Latency | Low, calls stay in memory | Higher, network hops | Answer comes later | Cold start possible |
| Cost | Lowest when small | Costly when small, good when large | Medium to start, needs a broker | Near zero when small, more under constant load |
| Strength / weakness | Low complexity; weak isolation, one fault can stop everything | Strong isolation; high complexity | Good for bursts; the queue absorbs failures | Cheap for spiky jobs; limits on run time |
| Fits | One team, or a few | Many teams | Work that can wait | Small teams with spiky jobs |
Recap
- Set six forces first: team size, domain clarity, traffic shape, latency, budget, compliance.
- Walk five questions from the top. The modular monolith is where you start, and you move away only when an answer forces you.
- Mixed needs give a hybrid, and that's normal.
- Extract a module when a number proves the need.
- Pick the simplest style the forces allow, and write down why.
Try it yourself
Take an app you know and set the six dials for it. Walk the five questions and write a four-line ADR: context with one real number, decision, the alternative you rejected and why, and the consequence you'll watch.
Related course on Udemy
The Python Architect Masterclass: Full Stack to AI Engineer
Python, Django, FastAPI, React, Docker, AWS, LLMs, RAG, agents and MCP, from first steps to AI engineer.View on Udemy ↗: The Python Architect Masterclass: Full Stack to AI Engineer (paid course, opens in a new tab)Related posts
Fallback Models for an LLM App: A Chain That Checks Region and Fit, Flags Degraded Answers and Gets Rehearsed
When the main model goes down, the backup has to be allowed to take the data, able to read the whole request and tested before the bad day. A simulated four-model chain for an EU customer: a 6,000-token request lands on mid-eu, flagged degraded; a 10,000-token request is served by nobody, on purpose.
Back Pressure for LLM Traffic: Bound the Queue, Give Chat Its Own Lane, Count Tokens, Cancel When the Caller Leaves
A bulk upload buries the chat. In a small simulation, one shared queue grows to 199 waiting and the middle chat answer takes 80.2 s. A bound plus a chat lane brings it to 0.35 s while 178 bulk jobs are told to retry in 10 s, and cancelling abandoned calls saves 21,000 wasted tokens.
Load Balancing LLM Traffic: Count the Work, Weigh the Prefix Cache, Check Real Health, Drain Before Deploys
Six GPU replicas, two at 95% and four at 30%: round robin counts requests, and requests aren't equal. In a small simulation, least outstanding requests cuts p95 from 6.52 s to 3.05 s, prefix affinity lifts cache hits to 95% but pushes p95 to 11.45 s, a real health check takes errors from 48 to 2, and draining cuts 0 answers instead of 4.
A Message Queue for Document Ingestion: At Least Once, Leases, an Idempotent Consumer and a Dead Letter Queue
A queue doesn't lose a document, but it can hand one out twice. In a small simulation, a worker crash makes document two go from 3 to 6 chunks and the index holds 11 when the documents hold 8. An idempotent consumer brings it back to 8 with the same two deliveries, and a limit of three tries moves a poison file to a dead letter queue.
