f8b21af4be
10_Wiki/Topics 대규모 정리: - 오류 캡처/미완성 stub 문서 227개 제거 - 교차폴더 중복 43클러스터 병합 (63파일 → redirect) - 링크명 정규화: 깨진 링크 수정·redirect 직결·개념 매핑 ~2,400건 - 카테고리 MOC 6개 신규 생성 - Graph 섹션 미해결 related-keyword 링크 10,058건 제거 Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
209 lines
5.6 KiB
Markdown
209 lines
5.6 KiB
Markdown
---
|
|
id: wiki-2026-0508-modern-website-architecture
|
|
title: Modern Website Architecture
|
|
category: 10_Wiki/Topics
|
|
status: verified
|
|
canonical_id: self
|
|
aliases: [Web Architecture 2026, RSC Architecture, Islands Architecture]
|
|
duplicate_of: none
|
|
source_trust_level: A
|
|
confidence_score: 0.9
|
|
verification_status: applied
|
|
tags: [web, architecture, rsc, astro, nextjs, edge]
|
|
raw_sources: []
|
|
last_reinforced: 2026-05-10
|
|
github_commit: pending
|
|
tech_stack:
|
|
language: typescript
|
|
framework: nextjs-astro
|
|
---
|
|
|
|
# Modern Website Architecture
|
|
|
|
## 매 한 줄
|
|
> **"매 page = static shell + streamed server components + minimal islands"**. 2020 SPA → 2024 SSR → 2026 RSC + edge 의 진화. Next.js 16 / Astro 5 / Remix 의 매 default = server-first, JS 의 ship 매 minimum.
|
|
|
|
## 매 핵심
|
|
|
|
### 매 layer
|
|
- **Edge runtime**: 매 request 의 region-local. Vercel/Cloudflare Workers, sub-50ms.
|
|
- **Server components**: 매 default render = server. Zero JS 의 ship.
|
|
- **Client islands**: 매 interactivity 의 hydrate 만.
|
|
- **CDN**: 매 static asset + ISR cache.
|
|
|
|
### 매 trade-off
|
|
- **SSG**: 매 build-time, fastest, stale data.
|
|
- **SSR**: 매 request-time, fresh, slower TTFB.
|
|
- **ISR**: 매 hybrid — stale-while-revalidate.
|
|
- **CSR**: 매 SPA, JS-heavy, slow first paint.
|
|
|
|
### 매 응용
|
|
1. Marketing site: SSG + Astro islands.
|
|
2. Dashboard: RSC + streaming + Suspense.
|
|
3. E-commerce: ISR + edge personalization.
|
|
|
|
## 💻 패턴
|
|
|
|
### Next.js 16 RSC
|
|
```tsx
|
|
// app/products/[id]/page.tsx — server component (default)
|
|
import { db } from "@/lib/db";
|
|
import { AddToCart } from "./add-to-cart"; // client island
|
|
|
|
export default async function Page({ params }: { params: { id: string } }) {
|
|
const product = await db.product.findUnique({ where: { id: params.id } });
|
|
if (!product) return <NotFound />;
|
|
return (
|
|
<article>
|
|
<h1>{product.name}</h1>
|
|
<p>{product.description}</p>
|
|
<AddToCart productId={product.id} />
|
|
</article>
|
|
);
|
|
}
|
|
```
|
|
|
|
### Client island
|
|
```tsx
|
|
// app/products/[id]/add-to-cart.tsx
|
|
"use client";
|
|
import { useState } from "react";
|
|
|
|
export function AddToCart({ productId }: { productId: string }) {
|
|
const [pending, setPending] = useState(false);
|
|
return (
|
|
<button
|
|
disabled={pending}
|
|
onClick={async () => {
|
|
setPending(true);
|
|
await fetch("/api/cart", { method: "POST", body: JSON.stringify({ productId }) });
|
|
setPending(false);
|
|
}}
|
|
>Add</button>
|
|
);
|
|
}
|
|
```
|
|
|
|
### Streaming with Suspense
|
|
```tsx
|
|
import { Suspense } from "react";
|
|
|
|
export default function Page() {
|
|
return (
|
|
<>
|
|
<Header />
|
|
<Suspense fallback={<Skeleton />}>
|
|
<SlowProductList /> {/* awaits DB */}
|
|
</Suspense>
|
|
<Suspense fallback={<Skeleton />}>
|
|
<SlowReviews />
|
|
</Suspense>
|
|
</>
|
|
);
|
|
}
|
|
```
|
|
|
|
### Astro islands
|
|
```astro
|
|
---
|
|
// src/pages/index.astro
|
|
import Counter from "../components/Counter.svelte";
|
|
const products = await fetch("https://api.shop/products").then(r => r.json());
|
|
---
|
|
<html>
|
|
<body>
|
|
{products.map(p => <article>{p.name}</article>)}
|
|
<Counter client:visible />
|
|
</body>
|
|
</html>
|
|
```
|
|
|
|
### Edge middleware (Vercel)
|
|
```typescript
|
|
// middleware.ts
|
|
import { NextResponse } from "next/server";
|
|
import { geolocation } from "@vercel/functions";
|
|
|
|
export function middleware(req: Request) {
|
|
const { country } = geolocation(req);
|
|
const res = NextResponse.next();
|
|
res.cookies.set("country", country ?? "US");
|
|
return res;
|
|
}
|
|
|
|
export const config = { matcher: "/((?!_next).*)" };
|
|
```
|
|
|
|
### ISR + tag revalidation
|
|
```tsx
|
|
// fetch with cache tags
|
|
const data = await fetch("https://api.shop/products", {
|
|
next: { revalidate: 3600, tags: ["products"] },
|
|
});
|
|
|
|
// trigger revalidation on update
|
|
import { revalidateTag } from "next/cache";
|
|
revalidateTag("products");
|
|
```
|
|
|
|
### Server actions
|
|
```tsx
|
|
// app/contact/page.tsx
|
|
export default function Page() {
|
|
async function submit(form: FormData) {
|
|
"use server";
|
|
await db.message.create({ data: { body: form.get("body") as string } });
|
|
}
|
|
return (
|
|
<form action={submit}>
|
|
<textarea name="body" />
|
|
<button>Send</button>
|
|
</form>
|
|
);
|
|
}
|
|
```
|
|
|
|
### View transitions
|
|
```tsx
|
|
"use client";
|
|
import { unstable_ViewTransition as ViewTransition } from "react";
|
|
|
|
<ViewTransition><ProductCard /></ViewTransition>
|
|
```
|
|
|
|
## 매 결정 기준
|
|
| 상황 | Approach |
|
|
|---|---|
|
|
| Content site (blog, docs) | Astro SSG + minimal islands |
|
|
| App with auth | Next.js RSC + server actions |
|
|
| Personalized e-commerce | Next.js ISR + edge middleware |
|
|
| Realtime dashboard | RSC + Suspense streaming + SSE |
|
|
|
|
**기본값**: Next.js 16 RSC for apps, Astro 5 for content.
|
|
|
|
## 🔗 Graph
|
|
- 부모: [[Web-Architecture]] · [[프론트엔드_및_UIUX_표준|Frontend-Architecture]]
|
|
- 변형: [[Single-Page-Application]] · [[MPA]]
|
|
- 응용: [[Next-js-and-Modern-Web]] · [[Edge Computing|Edge-Computing]]
|
|
- Adjacent: [[CDN]] · [[Server-Components]] · [[Hydration]]
|
|
|
|
## 🤖 LLM 활용
|
|
**언제**: 매 server vs client component 의 split-suggest, Suspense boundary 의 propose, cache strategy 의 review.
|
|
**언제 X**: 매 design system, brand identity, accessibility audit (manual + tooling).
|
|
|
|
## ❌ 안티패턴
|
|
- **Everything client**: 매 100KB JS 의 marketing page = 매 LCP regression.
|
|
- **No streaming**: 매 await 의 block, blank screen 5s.
|
|
- **Cache everywhere**: 매 personalized data 의 stale = 매 wrong-user bug.
|
|
- **Edge for DB-heavy**: 매 cold start + DB latency = slower than serverful.
|
|
|
|
## 🧪 검증 / 중복
|
|
- Verified (Next.js 16 docs, Astro 5 docs, Vercel architecture guides 2026).
|
|
- 신뢰도 A.
|
|
|
|
## 🕓 Changelog
|
|
| 날짜 | 변경 |
|
|
|---|---|
|
|
| 2026-05-08 | Phase 1 |
|
|
| 2026-05-10 | Manual cleanup — RSC + islands + edge web architecture |
|