Today’s goal
Turn architecture from a collection of technologies into a transparent set of decisions.
We will connect:
- requirements, quality attributes, constraints, and trade-offs;
- cohesion, coupling, dependency direction, and blast radius;
- complexity budgets, reversibility, locality, and explicit data flow;
- progressive enhancement, platform-first design, and dependency evaluation;
- fitness functions, ADRs, spikes, risk reduction, and failure modes;
- performance, security, accessibility, testing, observability, and deployability;
- team topology, governance, migration, and architecture outcomes.
By the end of today you can
- define architecture as decisions made under constraints;
- distinguish functional requirements from quality attributes;
- compare alternatives without fake precision;
- reduce coupling and blast radius through boundaries;
- prefer reversible decisions when information is weak;
- use ADRs to record decisions and revisit triggers;
- turn important architecture rules into fitness functions;
- choose a proportionate architecture for different scenarios;
- design migration instead of assuming rewrites are cleaner;
- defend the smallest coherent solution with evidence.
Not everything can be optimized at once
Trade-offs may exist between:
- autonomy and consistency;
- speed and flexibility;
- freshness and cacheability;
- simplicity and isolation;
- performance and feature richness;
- delivery independence and runtime coupling.
Architecture makes the trade-off visible so the team can choose intentionally.
Not every quality attribute has equal priority
A government service may prioritize accessibility and reliability.
An internal analytics tool may prioritize iteration speed and data accuracy.
A marketing page may prioritize cacheability and loading performance.
Priorities should be explicit rather than assumed.
Prefer reversible decisions
When information is weak, prefer choices that can be changed without rewriting the entire platform.
Examples:
- explicit adapter around a vendor;
- route-level boundary before full micro-frontends;
- local state before global store;
- package API before runtime federation.
Reversibility buys learning time.
Core versus commodity
Protect and understand capabilities that differentiate the product.
Avoid spending strategic team capacity reinventing commodity infrastructure unless the trade-off is intentional.
Also avoid outsourcing a core capability that determines security, user trust, or domain advantage without sufficient control.
Framework lock-in
Lock-in can be acceptable when the framework provides strong value and the team accepts its lifecycle.
Reduce unnecessary lock-in at boundaries with:
- domain models;
- adapters;
- platform APIs;
- stable package contracts;
- route and API boundaries.
Avoid turning lock-in avoidance into architecture by itself.
Worked decision: Civic Platform Architecture
Context & Forces (Erbil Citizen Portal):
- 4 autonomous product squads (Health, Transport, Commerce, Education).
- Target users: 70% mobile browsers on congested 3G/4G networks; WCAG 2.1 AA legal mandate.
- High SEO requirement for public municipal announcements and legal circulars.
Candidate architectures: Rejected options
| Candidate Option | Architecture Model | Reason for Rejection |
|---|---|---|
| Option A: Micro-Frontends | Webpack Module Federation; multi-repo independent deploys | 4.2s mobile LCP on 3G: duplicate React vendor runtimes violate performance budget |
| Option B: Client-Side SPA | Pure CSR single-page app; static CDN hosting | SEO & blank screen: fails public legal circular indexing and initial 3G render |
Candidate architectures: Accepted decision
Option C: Modular Monolith with Edge SSR (ACCEPTED)
| Architectural Dimension | Strategy & Evaluation |
|---|---|
| Mobile LCP | 1.4s (p75): cached semantic HTML at CDN edge |
| Search Engine Indexing | 100% crawlable: complete server-rendered document |
| Squad Autonomy | pnpm monorepo with strict package.json "exports" |
| Operational Overhead | Single container pipeline; zero distributed federation complexity |
Testability as an architecture attribute
Testability improves when the system has:
- explicit inputs and outputs;
- replaceable boundaries;
- deterministic transitions;
- isolated ownership;
- observable failures;
- stable contracts.
If architecture makes the important behavior impossible to isolate, testing cost is design feedback.
When a rewrite is justified
Possible evidence:
- the current platform cannot meet a required constraint;
- incremental migration is more expensive than replacement;
- ownership and product scope are stable;
- behavior is well understood;
- rollout and rollback are credible;
- the organization can sustain the work.
“The code feels old” is not enough evidence by itself.
Resume-driven architecture
This occurs when a technology is chosen mainly because it is interesting or marketable.
Counter it with:
- explicit requirements;
- measurable constraints;
- a representative spike;
- total lifecycle cost;
- a revisit trigger.
Technology can be valuable without being the reason for the decision.
Architecture and product lifecycle
Prototype, growth, maturity, and retirement may need different priorities.
prototype → learning speed
growth → boundaries and scale
maturity → reliability and maintenance
retirement → migration and safe shutdownDo not optimize a prototype for the operational needs of a global platform without evidence.
Revisit triggers
Examples:
- traffic exceeds the assumed range;
- team ownership changes;
- deployment becomes a bottleneck;
- performance budget fails;
- a dependency is retired;
- a security requirement changes;
- evidence from a spike contradicts an assumption.
Triggers turn an ADR into a living decision rather than a permanent verdict.
Example: micro-frontend decision
Choose runtime separation only when:
- independent deployment is a real bottleneck;
- capability boundaries are stable;
- contracts and observability exist;
- failure containment matters;
- the organization can operate the integration.
Otherwise start with packages or a modular monolith.
Practical stages 6–12: design the boundaries
- Choose rendering topology.
- Choose component boundaries.
- Decide on shared state.
- Choose API boundary strategy.
- Define security boundaries.
- Define performance constraints.
- Define accessibility requirements.
Treat each as a decision with trade-offs, not a framework checkbox.
Practical stages 25–27: migration and defense
Practical stages 1–3: constraints, options & empirical spike
- Stage 1 (Explicit Problem & Constraint Mapping):
- Document functional goals and prioritize non-negotiable quality attributes.
- Stage 2 (Formulating Three Viable Candidate Architectures):
- Candidate A (Micro-Frontends), Candidate B (Client-Side SPA), Candidate C (Modular Monolith with Edge SSR).
- Stage 3 (The Investigative Technical Spike):
- Run a benchmark spike measuring bundle size and p75 LCP under 4x CPU throttling.
Practical stages 4–5: ADR & reversal plan
- Stage 4 (Drafting the Formal ADR):
- Record Title, Status, Context, Decision, Consequences, and Automated Fitness Functions.
- Stage 5 (Reversal Plan & Review Trigger Conditions):
- Define exact quantitative thresholds (team size >12 squads, CI queue >30m) that trigger architectural review.
Verification: Decisions reflect empirical evidence and trade-offs rather than technology fashion.
Troubleshooting guide (Part 1)
| Symptom | Likely cause |
|---|---|
| Architecture debate never ends | Requirements and decision criteria are unclear |
| Every solution is global | Ownership and locality were not evaluated |
| Micro-frontends are proposed immediately | Organizational pressure was mistaken for runtime need |
| ADRs are long and unread | They record meetings instead of decisions |
| Fitness checks are ignored | They protect preferences rather than important properties |
Troubleshooting guide (Part 2)
| Symptom | Likely cause |
|---|---|
| Rewrite feels safer than migration | Hidden behavior and compatibility cost are underestimated |
| Shared package changes break everyone | Public API and versioning are weak |
| Architecture depends on one expert | Ownership, documentation, and runbooks are insufficient |
| “Simple” system fails at scale | The relevant quality attribute was not measured |
Completion checklist
- the problem and context are explicit;
- quality attributes are prioritized and measurable;
- constraints are distinguished from preferences;
- alternatives and trade-offs are documented;
- unknowns are tested with focused spikes;
- boundaries reduce change cost and blast radius;
- important architecture properties have guardrails;
- failure, security, performance, and accessibility are included;
- migration and rollback are credible;
- the decision has an owner and revisit trigger.
Misconceptions to leave behind (Part 1)
| Misconception | Better mental model |
|---|---|
| Architecture is the technology stack | It is contextual decisions and boundaries |
| A good architecture optimizes everything | It makes explicit trade-offs |
| More abstraction is better | Abstraction has coupling and cognitive cost |
| Duplication is always bad | Local duplication can preserve autonomy |
| Global state is required for scale | Ownership and lifetime determine scope |
| SSR is more architectural than CSR | Rendering is one contextual decision |
| Micro-frontends are the natural future | Distribution is justified by real independence needs |
Misconceptions to leave behind (Part 2)
| Misconception | Better mental model |
|---|---|
| Every shared component belongs centrally | Stable shared concepts deserve promotion |
| ADRs are bureaucracy | They preserve reasoning and revisit conditions |
| A decision cannot change | Architecture should learn from evidence |
| A rewrite is cleaner | Incremental migration often reduces risk |
| Technical debt must always be removed | Prioritize by impact and change cost |
| Simplicity means underengineering | Simplicity can be deliberate, bounded architecture |
Course completion: Capstone architecture
Congratulations on completing all 18 chapters of modern web application engineering!
Next steps to master front-end architecture:
- Capstone Architecture Project: Build and defend an end-to-end civic application platform;
- Appendix A: Review the Architectural Rosetta Stone (React vs. Vue mechanics);
- Appendix B: Consult the Modern Browser APIs Reference;
- Appendix C: Run the Production Deployment Checklist before every release.