refactor(topics): 멀티 에이전트용 지식 재편 — _Common(공통 기본기) + Domain_* 구조
에이전트 8종(대화형/프로그래머 C·S/디자이너/설계자/기획자/QA/PD/PM)에게 [공통 기본 능력 + 롤별 Specialty] 2층으로 지식을 주입하기 위한 재분류. 문서 내용·포맷은 무수정, 폴더 이동만 (6,372개 문서 수 보존 확인). - Topic_Programming → Domain_Programming (내부 구조 보존) - Topic_Graphic → Domain_Design - Topic_Business → Domain_Product - Topic_General → Domain_General - _Common 신설: Math(구 Topic_Math_Specialty), Reasoning(구 General/From_Thinking & Reasoning), Reasoning_Creativity(구 General/From_창의성), Communication(Poetic_Blog_Writing + From_writing) - 타 도메인의 From_* 폴더는 유지 (출처 표기일 뿐, 이미 도메인에 맞게 분류된 문서) - 빈 폴더 정리 (memory/procedures) - 에이전트→폴더 매핑은 workspace의 .astra/agent-knowledge-map.json (9개 에이전트) Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,200 @@
|
||||
---
|
||||
id: wiki-2026-0508-nextjs-framework
|
||||
title: Next.js Framework
|
||||
category: 10_Wiki/Topics
|
||||
status: verified
|
||||
canonical_id: self
|
||||
aliases: [Next.js, NextJS, Nextjs]
|
||||
duplicate_of: none
|
||||
source_trust_level: A
|
||||
confidence_score: 0.95
|
||||
verification_status: applied
|
||||
tags: [nextjs, react, ssr, framework, vercel]
|
||||
raw_sources: []
|
||||
last_reinforced: 2026-05-10
|
||||
github_commit: pending
|
||||
tech_stack:
|
||||
language: TypeScript
|
||||
framework: Next.js 15
|
||||
---
|
||||
|
||||
# Next.js Framework
|
||||
|
||||
## 매 한 줄
|
||||
> **"매 Next.js 는 React-based full-stack framework — App Router (RSC) + Server Actions + Turbopack 의 조합"**. 2026 의 Next 15 는 매 React 19 RSC + Partial Prerendering (PPR) 안정화 + Turbopack 가 default. 매 Vercel 의 commercial backing.
|
||||
|
||||
## 매 핵심
|
||||
|
||||
### 매 Render 모드 (App Router)
|
||||
- **Static (default)**: 매 build-time, ISR 가능.
|
||||
- **Dynamic**: 매 request-time, `cookies()` / `headers()` 사용 시 자동 전환.
|
||||
- **Streaming SSR**: 매 RSC + Suspense — 매 progressive HTML.
|
||||
- **PPR (Partial Prerendering)**: 매 static shell + dynamic holes — 매 Next 15 default.
|
||||
|
||||
### 매 핵심 API
|
||||
- **Server Components**: 매 default — 매 zero JS 전송.
|
||||
- **`"use client"`**: 매 client component boundary.
|
||||
- **Server Actions** (`"use server"`): 매 form / mutation, RPC 자동.
|
||||
- **`fetch()` extension**: 매 cache, revalidate, tags.
|
||||
|
||||
### 매 응용
|
||||
1. E-commerce (Shopify Hydrogen 영향).
|
||||
2. Marketing site + blog (ISR 강점).
|
||||
3. SaaS dashboard (RSC 로 bundle 감소).
|
||||
4. AI chat UI — 매 streaming Server Action.
|
||||
|
||||
## 💻 패턴
|
||||
|
||||
### Server Component data fetch
|
||||
```tsx
|
||||
// app/posts/page.tsx — 매 server component, async 가능
|
||||
async function PostsPage() {
|
||||
const posts = await fetch("https://api.example.com/posts", {
|
||||
next: { revalidate: 60, tags: ["posts"] },
|
||||
}).then((r) => r.json());
|
||||
|
||||
return (
|
||||
<ul>
|
||||
{posts.map((p) => <li key={p.id}>{p.title}</li>)}
|
||||
</ul>
|
||||
);
|
||||
}
|
||||
export default PostsPage;
|
||||
```
|
||||
|
||||
### Server Action (form mutation)
|
||||
```tsx
|
||||
// app/actions.ts
|
||||
"use server";
|
||||
import { revalidateTag } from "next/cache";
|
||||
|
||||
export async function createPost(formData: FormData) {
|
||||
await db.post.create({ data: { title: formData.get("title") as string } });
|
||||
revalidateTag("posts");
|
||||
}
|
||||
|
||||
// app/new/page.tsx
|
||||
import { createPost } from "../actions";
|
||||
export default function NewPost() {
|
||||
return (
|
||||
<form action={createPost}>
|
||||
<input name="title" />
|
||||
<button type="submit">Save</button>
|
||||
</form>
|
||||
);
|
||||
}
|
||||
```
|
||||
|
||||
### Streaming with Suspense
|
||||
```tsx
|
||||
import { Suspense } from "react";
|
||||
|
||||
export default function Page() {
|
||||
return (
|
||||
<>
|
||||
<Header /> {/* 매 즉시 stream */}
|
||||
<Suspense fallback={<Skeleton />}>
|
||||
<SlowProductList /> {/* 매 fetch 끝나면 stream-in */}
|
||||
</Suspense>
|
||||
</>
|
||||
);
|
||||
}
|
||||
```
|
||||
|
||||
### Partial Prerendering (Next 15)
|
||||
```tsx
|
||||
// next.config.js
|
||||
module.exports = {
|
||||
experimental: { ppr: "incremental" },
|
||||
};
|
||||
|
||||
// app/page.tsx — static shell + dynamic part
|
||||
export const experimental_ppr = true;
|
||||
|
||||
import { cookies } from "next/headers";
|
||||
async function CartCount() {
|
||||
const session = (await cookies()).get("session");
|
||||
// 매 dynamic — static shell 의 hole 로 stream
|
||||
return <span>{await getCartCount(session?.value)}</span>;
|
||||
}
|
||||
|
||||
export default function Page() {
|
||||
return (
|
||||
<>
|
||||
<StaticHeader />
|
||||
<Suspense fallback="0"><CartCount /></Suspense>
|
||||
</>
|
||||
);
|
||||
}
|
||||
```
|
||||
|
||||
### Route Handler (REST endpoint)
|
||||
```ts
|
||||
// app/api/users/route.ts
|
||||
import { NextResponse } from "next/server";
|
||||
export async function GET() {
|
||||
const users = await db.user.findMany();
|
||||
return NextResponse.json(users);
|
||||
}
|
||||
export async function POST(req: Request) {
|
||||
const body = await req.json();
|
||||
const user = await db.user.create({ data: body });
|
||||
return NextResponse.json(user, { status: 201 });
|
||||
}
|
||||
```
|
||||
|
||||
### Middleware (auth gate)
|
||||
```ts
|
||||
// middleware.ts
|
||||
import { NextResponse, type NextRequest } from "next/server";
|
||||
export function middleware(req: NextRequest) {
|
||||
const token = req.cookies.get("token");
|
||||
if (!token && req.nextUrl.pathname.startsWith("/dashboard")) {
|
||||
return NextResponse.redirect(new URL("/login", req.url));
|
||||
}
|
||||
}
|
||||
export const config = { matcher: ["/dashboard/:path*"] };
|
||||
```
|
||||
|
||||
### Image optimization
|
||||
```tsx
|
||||
import Image from "next/image";
|
||||
<Image src="/hero.jpg" width={1200} height={600} alt="" priority />
|
||||
// 매 자동 AVIF/WebP, srcset, lazy
|
||||
```
|
||||
|
||||
## 매 결정 기준
|
||||
| 상황 | Approach |
|
||||
|---|---|
|
||||
| Marketing site | Static + ISR |
|
||||
| User dashboard | RSC + Server Action |
|
||||
| Realtime chat | "use client" + WebSocket |
|
||||
| Mostly static + cart | PPR (Next 15) |
|
||||
| Pure SPA | 매 Next 대신 Vite + React |
|
||||
|
||||
**기본값**: App Router + RSC + PPR. Pages Router 는 매 legacy.
|
||||
|
||||
## 🔗 Graph
|
||||
- 부모: [[React]]
|
||||
- 변형: [[Remix]] · [[Astro]] · [[SvelteKit]]
|
||||
- Adjacent: [[React Server Components — 경계 의식]] · [[Turbopack]] · [[Edge Runtime]]
|
||||
|
||||
## 🤖 LLM 활용
|
||||
**언제**: App Router migration, RSC 설계, Server Action 구현, PPR 적용.
|
||||
**언제 X**: 매 pure backend (Express/Fastify), pure SPA.
|
||||
|
||||
## ❌ 안티패턴
|
||||
- **`"use client"` on root layout**: 매 RSC 효과 무효 — 매 leaf 만.
|
||||
- **`fetch` 안에 secret**: 매 client 로 leak 가능 — 매 Server Action 사용.
|
||||
- **getInitialProps**: 매 Pages Router legacy — 매 App Router 에서 X.
|
||||
- **Massive client bundle**: 매 Server Component 로 옮길 것.
|
||||
|
||||
## 🧪 검증 / 중복
|
||||
- Verified (nextjs.org docs, React 19 RSC spec).
|
||||
- 신뢰도 A.
|
||||
|
||||
## 🕓 Changelog
|
||||
| 날짜 | 변경 |
|
||||
|---|---|
|
||||
| 2026-05-08 | Phase 1 |
|
||||
| 2026-05-10 | Manual cleanup — Next 15 RSC + PPR + Server Action |
|
||||
Reference in New Issue
Block a user