docs(10_Wiki): 위키 전체 재구성 — Topic_* 폴더를 4개 카테고리로 통합 + 대규모 중복 제거
Topic_Agent/Topic_Blog/Topics/Topics_Biz/Topics_Meeting/Topics_Rag의 마크다운 지식 문서를 Topic_General/Topic_Programming/Topic_Graphic/Topic_Business 4개 카테고리로 재분류. - 중복 제거: frontmatter의 status:duplicate/merged + duplicate_of/redirect_to 필드로 자기 자신을 중복으로 선언한 리다이렉트 stub 1032개 제거, 완전 동일 내용 파일 472개 제거, 동일 파일명·다른 내용 충돌 시 더 큰(완전한) 버전만 유지(162개 제거) — 총 1639개 중복 제거. - 분류: 폴더 단위로 명확한 항목(AI_and_ML/Coding/Architecture 등 → Programming, Comfyui/Visual_Effects → Graphic, Topics_Biz/Topics_Meeting/사업 등 → Business, Poetic_Blog_Writing/창의성/Game_Design 등 → General)은 폴더 우선순위로, 나머지 혼재 폴더(Topic_Agent/Topic_Blog/Topics 루트/Thinking & Reasoning/Other/UI_UX_Assets)는 title/tags 키워드 스코어링으로 파일 단위 분류(불명확한 경우 General로 폴백). 원본 폴더명은 "From_*" 서브폴더로 보존해 추적 가능성 유지. - 최종 배치: Programming 2784 / General 1608 / Graphic 285 / Business 249 = 4926개 문서. - 에이전트 운영 상태(.astra/.agent/.obsidian/sessions/memory/_company/docs/lessons/_shared/src)는 지식 콘텐츠가 아니므로 재분류 대상에서 제외하고 원위치 유지. - Topics/Topic_email(상위 보호 폴더 Topic_email과 파일명 100% 중복) 삭제 — 보호 폴더 자체는 미변경. - 완전히 비게 된 Topic_Agent/Topic_Blog/Topics_Biz/Topics_Rag 폴더 제거.
This commit is contained in:
@@ -0,0 +1,184 @@
|
||||
---
|
||||
id: wiki-2026-0508-web-rendering-strategies-csr-vs-
|
||||
title: Web Rendering Strategies — CSR vs SSR
|
||||
category: 10_Wiki/Topics
|
||||
status: verified
|
||||
canonical_id: self
|
||||
aliases: [CSR vs SSR, SSG, ISR, Rendering Strategies, Hybrid Rendering]
|
||||
duplicate_of: none
|
||||
source_trust_level: A
|
||||
confidence_score: 0.9
|
||||
verification_status: applied
|
||||
tags: [rendering, ssr, csr, ssg, isr, frontend, performance]
|
||||
raw_sources: []
|
||||
last_reinforced: 2026-05-10
|
||||
github_commit: pending
|
||||
tech_stack:
|
||||
language: typescript
|
||||
framework: nextjs
|
||||
---
|
||||
|
||||
# Web Rendering Strategies — CSR vs SSR
|
||||
|
||||
## 매 한 줄
|
||||
> **"매 어디서 render 매 (server/build/client/edge), 매 언제 (request/build/runtime), 매 무엇 (static/dynamic) — 매 이 3 축 의 매 trade-off"**. 매 2026 매 hybrid (RSC + Streaming SSR + ISR + Edge) 매 default — Next.js / Nuxt / Remix / SvelteKit / Astro 매 모두 mix.
|
||||
|
||||
## 매 핵심
|
||||
|
||||
### 매 5 가지 strategy
|
||||
- **CSR (Client-Side Rendering)**: empty HTML + JS bundle → browser 매 render. SPA classic.
|
||||
- **SSR (Server-Side Rendering)**: per-request HTML on server.
|
||||
- **SSG (Static Site Generation)**: build-time HTML.
|
||||
- **ISR (Incremental Static Regeneration)**: SSG + on-demand or time-based revalidate.
|
||||
- **RSC (React Server Components, 2023~)**: server-only component, zero JS ship for that part.
|
||||
|
||||
### 매 핵심 metric
|
||||
- **TTFB**: server response time.
|
||||
- **FCP / LCP**: 매 visible content speed.
|
||||
- **TTI**: 매 interactive — hydration cost.
|
||||
- **INP**: 매 interaction latency (FID 의 후속, Core Web Vitals 2024+).
|
||||
- **JS bundle**: 매 작을 수록 hydration fast.
|
||||
|
||||
### 매 응용
|
||||
1. Marketing site → SSG / ISR (Astro, Next).
|
||||
2. E-commerce → ISR + dynamic SSR for cart.
|
||||
3. Dashboard / admin → CSR or SSR with auth.
|
||||
4. Blog → SSG + ISR.
|
||||
5. Real-time chat → CSR + SSE/WebSocket.
|
||||
6. News site → ISR (revalidate every 60s).
|
||||
|
||||
## 💻 패턴
|
||||
|
||||
### Next.js App Router (RSC + streaming)
|
||||
```tsx
|
||||
// app/products/[id]/page.tsx — RSC, fetched on server, no JS shipped
|
||||
export default async function ProductPage({ params }: { params: { id: string } }) {
|
||||
const product = await db.product.findUnique({ where: { id: params.id } });
|
||||
return (
|
||||
<article>
|
||||
<h1>{product.name}</h1>
|
||||
<Suspense fallback={<Skeleton />}>
|
||||
<Reviews productId={params.id} />
|
||||
</Suspense>
|
||||
</article>
|
||||
);
|
||||
}
|
||||
```
|
||||
|
||||
### ISR with revalidate
|
||||
```tsx
|
||||
// Next.js — 매 60s 마다 background regenerate
|
||||
export const revalidate = 60;
|
||||
export default async function Posts() {
|
||||
const posts = await fetch("https://api.example.com/posts").then((r) => r.json());
|
||||
return <ul>{posts.map((p) => <li key={p.id}>{p.title}</li>)}</ul>;
|
||||
}
|
||||
```
|
||||
|
||||
### SSG with `generateStaticParams`
|
||||
```tsx
|
||||
export async function generateStaticParams() {
|
||||
const slugs = await getAllSlugs();
|
||||
return slugs.map((slug) => ({ slug }));
|
||||
}
|
||||
```
|
||||
|
||||
### CSR via dynamic + ssr:false
|
||||
```tsx
|
||||
"use client";
|
||||
import dynamic from "next/dynamic";
|
||||
const Chart = dynamic(() => import("./HeavyChart"), { ssr: false });
|
||||
export default function Page() { return <Chart />; }
|
||||
```
|
||||
|
||||
### Streaming SSR (Suspense)
|
||||
```tsx
|
||||
// app/dashboard/page.tsx
|
||||
export default function Dashboard() {
|
||||
return (
|
||||
<>
|
||||
<Header />
|
||||
<Suspense fallback={<Skel />}><SlowWidget /></Suspense>
|
||||
<Suspense fallback={<Skel />}><AnotherSlow /></Suspense>
|
||||
</>
|
||||
);
|
||||
}
|
||||
// 매 shell 먼저 flush, 매 widget ready 시 stream
|
||||
```
|
||||
|
||||
### Edge runtime (Vercel / Cloudflare Workers)
|
||||
```ts
|
||||
// Next.js — Edge 매 cold start 매 0 에 가까움
|
||||
export const runtime = "edge";
|
||||
export async function GET(req: Request) {
|
||||
const country = req.headers.get("x-vercel-ip-country") ?? "US";
|
||||
return new Response(`Hello from ${country}`);
|
||||
}
|
||||
```
|
||||
|
||||
### Astro islands
|
||||
```astro
|
||||
---
|
||||
// 매 default static, 매 island 만 hydrate
|
||||
import Counter from "../components/Counter.tsx";
|
||||
const posts = await fetch("...").then((r) => r.json());
|
||||
---
|
||||
<html>
|
||||
<body>
|
||||
{posts.map((p) => <article><h2>{p.title}</h2></article>)}
|
||||
<Counter client:visible /> <!-- viewport entry 시 hydrate -->
|
||||
</body>
|
||||
</html>
|
||||
```
|
||||
|
||||
### On-demand revalidation
|
||||
```ts
|
||||
// Next.js — webhook 받으면 매 즉시 invalidate
|
||||
import { revalidateTag, revalidatePath } from "next/cache";
|
||||
export async function POST(req: Request) {
|
||||
const { tag } = await req.json();
|
||||
revalidateTag(tag);
|
||||
return Response.json({ ok: true });
|
||||
}
|
||||
```
|
||||
|
||||
## 매 결정 기준
|
||||
| 상황 | Approach |
|
||||
|---|---|
|
||||
| Static marketing | SSG / Astro |
|
||||
| Blog with comments | SSG + CSR comments |
|
||||
| News feed (changes hourly) | ISR (revalidate=3600) |
|
||||
| Product page + cart | RSC + Client island for cart |
|
||||
| Real-time dashboard | CSR + WebSocket |
|
||||
| Geo-personalized | Edge SSR |
|
||||
| Authenticated app | SSR with auth + RSC |
|
||||
|
||||
**기본값**: Next.js App Router (RSC default) + Suspense streaming + ISR for content. 매 client component 매 조심히.
|
||||
|
||||
## 🔗 Graph
|
||||
- 부모: [[Large_Frontend_Projects|Frontend Architecture]] · [[Web Performance]]
|
||||
- 변형: [[CSR]] · [[SSR]] · [[SSG]] · [[ISR]] · [[RSC]]
|
||||
- 응용: [[Astro]] · [[SvelteKit]] · [[Remix]]
|
||||
- Adjacent: [[Streaming SSR]] · [[Edge Runtime]] · [[Hydration]] · [[Core Web Vitals Optimization (INP, LCP, CLS)|Core Web Vitals]] · [[Islands Architecture]]
|
||||
|
||||
## 🤖 LLM 활용
|
||||
**언제**: Rendering strategy 결정, Next.js / Nuxt / Astro setup, Core Web Vitals tuning.
|
||||
**언제 X**: Pure native app, internal CLI, embedded device UI.
|
||||
|
||||
## ❌ 안티패턴
|
||||
- **CSR for SEO-critical content**: 매 crawler 매 problem.
|
||||
- **SSR everywhere without caching**: 매 server CPU 폭발 — ISR / cache 도입.
|
||||
- **Hydration mismatch**: server HTML ≠ client render — 매 console error + flicker.
|
||||
- **Massive client bundle**: 매 hydration TTI 늦어짐 — RSC / island 활용.
|
||||
- **No streaming**: 매 slow API 매 entire page block — Suspense.
|
||||
- **Misuse of `"use client"`**: 매 RSC tree 의 매 leaf 만 client.
|
||||
|
||||
## 🧪 검증 / 중복
|
||||
- Verified (Next.js 15 docs, Vercel team blog, web.dev rendering guide 2025).
|
||||
- 신뢰도 A.
|
||||
|
||||
## 🕓 Changelog
|
||||
| 날짜 | 변경 |
|
||||
|---|---|
|
||||
| 2026-05-08 | Phase 1 |
|
||||
| 2026-05-10 | Manual cleanup — RSC, streaming, ISR, edge runtime patterns |
|
||||
Reference in New Issue
Block a user