Frontend Architecture

Frontend Architecture Overview — The Only Layer Users Touch

Frontend Architecture Overview — The Only Layer Users Touch

About this article

This article is the entry point of the “Frontend Architecture” category in the Architecture Crash Course for the Generative-AI Era series, surveying the domain.

The frontend is “the only place users actually touch.” No matter how perfect the backend is, if the UI trips users up the system goes unused. This article surveys why we treat it as its own domain, the rendering taxonomy, the placement of major frameworks, a page-type × configuration ladder, and the AI-era benefits structure.

The only layer that reaches the user

Developers tend to focus design effort on the backend to satisfy functional and non-functional requirements, but for consumer-facing products “UX matters at a level directly tied to business outcomes.” Treating the frontend as “the cosmetic layer” is the same as dismissing business value.

No matter how functional the system is, a system users don’t use may as well not exist.

Why treat it as a separate architecture

1. The tech stack has evolved separately

Frontend-specific frameworks (React, Vue.js, Angular), build tools (Vite, Turbopack), state managers (Redux, Zustand) — a “different tech culture” has formed compared to backend.

2. UX requirements are orthogonal to functional requirements

Page load speed (LCP — Largest Contentful Paint), input responsiveness (INP — Interaction to Next Paint), layout stability (CLS — Cumulative Layout Shift) — UI-specific non-functional requirements that backend can’t see.

3. Change frequency and blast radius differ

Changes far more frequently than business logic, and small changes hit user experience directly.

Rendering taxonomy

flowchart LR
    USER([User]) --> EDGE[CDN/Edge]
    EDGE --> RENDER{Rendering}
    RENDER -->|Per nav,<br/>server-generated| MPA[MPA<br/>WordPress/Rails]
    RENDER -->|One HTML, JS swaps| SPA[SPA<br/>React CSR/Vue]
    RENDER -->|Per request,<br/>server-generated| SSR[SSR<br/>Next.js/Nuxt]
    RENDER -->|Static at build| SSG[SSG<br/>Astro/Next static]
    RENDER -->|Static + partial regen| ISR[ISR<br/>Next.js]
    classDef user fill:#fef3c7,stroke:#d97706;
    classDef edge fill:#f0f9ff,stroke:#0369a1;
    classDef classic fill:#f1f5f9,stroke:#64748b;
    classDef modern fill:#dbeafe,stroke:#2563eb;
    classDef static fill:#dcfce7,stroke:#16a34a;
    class USER user;
    class EDGE edge;
    class MPA classic;
    class SPA,SSR modern;
    class SSG,ISR static;
ApproachDescriptionExamples
MPA (Multi Page App)Server generates HTML on each navigationWordPress, traditional Rails
SPA (Single Page App)One HTML, JS swaps the viewReact CSR, Vue.js
SSRServer generates HTML per requestNext.js, Nuxt.js
SSGHTML generated at build timeAstro, Next.js Static
ISR (Incremental Static Regeneration)Hybrid of SSR and SSGNext.js

What you must decide — what’s your project’s answer?

For each item, articulate your project’s answer in 1-2 sentences.

Rendering / tech stack

ItemExamples
HostingCDN, edge compute
RenderingMPA / SPA / SSR / CSR / SSG
State managementContext / Redux / Zustand / Jotai
CSSCSS Modules / Tailwind / CSS-in-JS
FrameworkReact / Vue.js / Angular / Svelte
BFF (Backend For Frontend)GraphQL / REST / tRPC (typed APIs in TypeScript end-to-end)

Routing / auth / accessibility

ItemExamples
RoutingFile-based / Config-based
AuthCookie / LocalStorage / Refresh Token (long-lived token used to mint new access tokens without re-login)
NamingBEM (Block Element Modifier — CSS naming convention), kebab-case, etc.
Directory layoutfeature-based / layer-based
URL pathsRESTful / hierarchical / query design
AccessibilityWCAG (Web Content Accessibility Guidelines) compliance, ARIA (Accessible Rich Internet Applications)

i18n / SEO / security / performance

ItemExamples
i18nnext-intl / react-i18next
Supported environmentsBrowsers / OS / screen-size range
SEOMeta tags / OGP (Open Graph Protocol) / structured data / sitemap
SecurityCSP (Content Security Policy) / XSS prevention / CSRF prevention
Error handlingValidation / Error Boundary
PerformanceCore Web Vitals (LCP / INP / CLS) / image optimization

Where major frameworks sit

FWStrengthsFits
ReactLargest ecosystem, most jobsGeneral mid-to-large web apps
Vue.jsLow learning cost, HTML-friendlySmall/mid scale, gradual adoption
AngularFull-featured, TypeScript-defaultLarge enterprise, robustness focus
SvelteLightweight, no runtimePerformance focus, small scale
Next.jsReact-based, SSR/SSGSEO-focused web apps
AstroContent-focused, fast SSGBlogs, LPs, docs

A search-traffic disaster from “modern, therefore” (industry case)

A media-site relaunch project decided to “rebuild every page in React CSR (SPA)” for the sole reason of “because it’s modern.” Three months after launch, organic search traffic was cut in half. The cause was simple: OGP and meta tags only entered the HTML after JS executed, and crawlers (search engines and social media share crawlers) were “reading empty HTML.” No thumbnails appeared, and even shared links got no clicks.

There are similar stories of personal bloggers around 2017 impulsively making their site a SPA, then opening Search Console six months later in cold sweat at the visible drop in traffic. Astro-style SSG frameworks weren’t mature yet, so the standard ending was “we went back to WordPress.”

Picking technology because “it’s trending” or “it’s modern” punches you twice afterward — UX and business metrics. Building content-centric sites (blogs, LPs, media) on SPA is a textbook landmine — SEO and initial render are catastrophically weak. The current default is to choose method per page (articles SSG, admin SPA, etc.) — both “all SPA” and “all SSR are sloppy.

“Modern = correct” is wrong. Pick the method per use case — that is the foundation of frontend design.

Page-type × configuration ladder

Note: industry rates as of April 2026. They will go stale, so periodic refresh is needed.

“One method for the whole site” is a recipe for breakdown. Choosing per page type is the standard.

Page typeRenderingHostingStateCore Web Vitals
Blog / docsSSG (Astro)Cloudflare PagesuseStateLCP < 2s
LP / marketingSSGVercel / NetlifyuseStateLCP < 2.5s
E-commerce product detailISR (60-300s)VercelZustand + TanStack QueryLCP < 2.5s
SaaS dashboardCSRVercel / private CDNZustand + TanStack QueryINP < 200ms
Login-required adminCSRPrivate CDNZustand + TanStack QueryINP < 200ms
News / mediaISR + Streaming SSRVercelTanStack QueryLCP < 2.5s

Core Web Vitals “Good” range (LCP < 2.5s, INP < 200ms, CLS < 0.1) is the Google SEO bar. The evaluation axis: “75% of page views inside the Good range.”

“All-page SSR is a time bomb. The classic incident is exhausting your Vercel function-execution quota. Design Static First.

Architecture-level traps

Forbidden moveWhy
CSR-only on an SEO-required siteJS execution lags days to weeks, organic traffic crashes
JWT in localStorageXSS instantly leaks every user’s token; httpOnly Cookie required
Hand-rolled routing / SSR on raw ReactNo reason not to use Next.js / Astro
Tailwind without configurationDesign Tokens don’t apply, color/spacing drift
Serving images at native sizeClassic LCP killer — Next/Image auto-optimizes
Adopting CSS-in-JS in an RSC environmentstyled-components went into maintenance mode in 2024
Frontend-only authorization with user.role === 'admin'Editable in DevTools — server authorization required
Same fact stored twice (items and itemCount)One will go stale; derived state must be computed
10+ useState for a single formReact Hook Form solves it
Checking WCAG 2.2 AA only by eyeAdd axe-core + Lighthouse to CI

The frontend is the only layer that reaches the user. Treat Core Web Vitals as a business requirement.

The AI-era lens

With AI-driven development as the assumption, the frontend dramatically benefits as “a domain where AI can write the UI directly.” AI tools — v0, Bolt, Lovable — instantly produce React/Tailwind/shadcn code, and the more mainstream your stack, the better the generation quality.

AI-era favorableAI-era unfavorable
React + Tailwind + shadcn/ui (copy-paste reusable component library) (mainstream)Custom UI / in-house design system
Next.js / Astro (mature)Niche / emerging frameworks
Type safety (TypeScript + Zod — schema validation library)Plain JavaScript
Server Components, file-based routingCustom routing, complex state management

UI/UX design is AI’s strong suit, but “branding, user context, accessibility” still need human judgment. AI can mass-produce patterns, but “deciding why this screen looks this way is human work.”

Common misreadings

  • “All frameworks are basically the same” → React, Vue, Svelte, Astro have different philosophies; “team skill × use case fit” changes productivity by 2-3x. Picking by trend hurts hiring and maintainability.
  • SPA solves everything” → SPA gives great interaction, but SEO and first render are weak. SPA on a blog or LP wipes out organic traffic. Per-page choice is the modern default.
  • “CSS can be done later” → CSS design is where the biggest difference shows up at scale. Postponing means “class-name collisions and style duplication explode the refactor cost.”
  • “Frontend is easy, perfect for new hires”LCP, INP, CLS, accessibility, XSS prevention — it’s a “concentrated specialty.” Treating it lightly breaks UX in production.

How to make the final call

Frontend architecture is “the only layer touching the user directly,” and no matter how solid the backend is, a rough UI/UX produces an unused system. The core of selection is reasoning backward from “what user experience do we want”, not from “functional requirements.”

SPA vs SSR vs SSG, Context vs Redux, Tailwind vs CSS Modules — none of those are decided by isolated technical merit. LCP, INP, CLS — UX metrics — must be treated as part of the business requirements. The frontend changes frequently; “small changes punch the user directly”, so reconciling change-friendliness with stability is constant.

The decisive axis is “lean into AI’s strong suit.” v0, Bolt, Lovable, Cursor, Claude Code — AI tools that produce frontend code directly are now production-ready. Picking the mainstream stack of React + TypeScript + Tailwind + shadcn/ui + Next.js (or Astro) alone makes “development speed differ by an order of magnitude.”

Conversely, niche frameworks, custom design systems, and plain JavaScript drop AI’s accuracy and cost effort. AI can write up to “patternized UI”; “branding, accessibility, user context remain human work.” Splitting “let AI mass-produce this” from “humans decide this” is the modern frontend stance.

Selection priority:

  1. Backward from UX metrics (LCP, INP, CLS as business requirements).
  2. Lean on the mainstream stack (React + TS + Tailwind + Next/Astro is the default).
  3. Type safety end to end (TypeScript + Zod to make contracts explicit).
  4. Split AI-written portions vs human-decided portions (branding and A11y stay human).

Summary

This article served as the entry point of the “Frontend Architecture” category, surveying the domain.

Reason backward from user experience, lean on the mainstream stack, separate AI-written portions from the human territory. Three cores of frontend architecture.

The next article opens the deep dive: hosting (CDN, edge).

Back to series TOC -> ‘Architecture Crash Course for the Generative-AI Era’: How to Read This Book

I hope you’ll read the next article as well.