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,190 @@
|
||||
---
|
||||
id: wiki-2026-0508-single-page-applications-spa
|
||||
title: Single Page Applications (SPA)
|
||||
category: 10_Wiki/Topics
|
||||
status: verified
|
||||
canonical_id: self
|
||||
aliases: [SPA, Single-Page App, Client-Side App]
|
||||
duplicate_of: none
|
||||
source_trust_level: A
|
||||
confidence_score: 0.9
|
||||
verification_status: applied
|
||||
tags: [web, frontend, architecture, routing]
|
||||
raw_sources: []
|
||||
last_reinforced: 2026-05-10
|
||||
github_commit: pending
|
||||
tech_stack:
|
||||
language: TypeScript
|
||||
framework: React/Vue/SvelteKit
|
||||
---
|
||||
|
||||
# Single Page Applications (SPA)
|
||||
|
||||
## 매 한 줄
|
||||
> **"매 한 HTML 의 모든 view 의 client-side 의 render"**. SPA 매 initial load 후 server-fetch 의 X 의 navigation — 매 data-only API call. 2026 매 SPA-only 의 declining trend — 매 SSR/RSC hybrid (Next.js 15, Remix, Astro Islands) 의 mainstream.
|
||||
|
||||
## 매 핵심
|
||||
|
||||
### 매 핵심 Architecture
|
||||
- 매 single `index.html` shell.
|
||||
- 매 JS bundle 의 view rendering (React / Vue / Svelte).
|
||||
- Client-side routing (History API).
|
||||
- 매 API 의 JSON fetch — REST / GraphQL / tRPC.
|
||||
|
||||
### 매 Pros
|
||||
- 매 fluid navigation — 매 page reload X.
|
||||
- 매 rich interactivity.
|
||||
- 매 backend / frontend 분리 — 매 separate deploy.
|
||||
|
||||
### 매 Cons
|
||||
- Initial bundle size — 매 large.
|
||||
- SEO 의 challenge — 매 crawler 의 JS execution 의존.
|
||||
- TTI (Time to Interactive) 의 slow.
|
||||
- 매 JS-disabled / network-fail 의 blank screen.
|
||||
|
||||
### 매 vs MPA / SSR / SSG
|
||||
- MPA: server 의 매 page-by-page render.
|
||||
- SSR: 매 first render 의 server, 매 hydrate 후 SPA-like.
|
||||
- SSG: 매 build-time 의 pre-render — 매 static deploy.
|
||||
- RSC (React Server Components): 매 server/client 의 component-level mix.
|
||||
|
||||
### 매 2026 trend
|
||||
- 매 pure SPA 의 niche (admin panel, internal tool).
|
||||
- Next.js / Remix / SvelteKit 의 hybrid 의 default.
|
||||
- Astro Islands — 매 partial hydration.
|
||||
- 매 streaming SSR + Suspense — 매 perceived perf 개선.
|
||||
|
||||
## 💻 패턴
|
||||
|
||||
### React Router v7 — 매 client-side routing
|
||||
```tsx
|
||||
import { createBrowserRouter, RouterProvider } from "react-router";
|
||||
|
||||
const router = createBrowserRouter([
|
||||
{ path: "/", element: <Home /> },
|
||||
{ path: "/posts/:id", element: <Post />, loader: postLoader },
|
||||
{ path: "*", element: <NotFound /> },
|
||||
]);
|
||||
|
||||
export default function App() {
|
||||
return <RouterProvider router={router} />;
|
||||
}
|
||||
```
|
||||
|
||||
### History API — manual SPA navigation
|
||||
```typescript
|
||||
function navigate(url: string) {
|
||||
history.pushState({}, "", url);
|
||||
render(); // re-render based on location.pathname
|
||||
}
|
||||
|
||||
window.addEventListener("popstate", render);
|
||||
```
|
||||
|
||||
### Code splitting — 매 route-level lazy
|
||||
```tsx
|
||||
import { lazy, Suspense } from "react";
|
||||
|
||||
const Dashboard = lazy(() => import("./Dashboard"));
|
||||
|
||||
<Suspense fallback={<Spinner />}>
|
||||
<Dashboard />
|
||||
</Suspense>
|
||||
```
|
||||
|
||||
### Data fetching — TanStack Query
|
||||
```typescript
|
||||
import { useQuery } from "@tanstack/react-query";
|
||||
|
||||
function Post({ id }: { id: string }) {
|
||||
const { data, isLoading } = useQuery({
|
||||
queryKey: ["post", id],
|
||||
queryFn: () => fetch(`/api/posts/${id}`).then(r => r.json()),
|
||||
staleTime: 60_000,
|
||||
});
|
||||
|
||||
if (isLoading) return <Skeleton />;
|
||||
return <Article {...data} />;
|
||||
}
|
||||
```
|
||||
|
||||
### Vite — SPA build
|
||||
```typescript
|
||||
// vite.config.ts
|
||||
import { defineConfig } from "vite";
|
||||
import react from "@vitejs/plugin-react";
|
||||
|
||||
export default defineConfig({
|
||||
plugins: [react()],
|
||||
build: {
|
||||
rollupOptions: {
|
||||
output: {
|
||||
manualChunks: {
|
||||
vendor: ["react", "react-dom"],
|
||||
ui: ["@radix-ui/react-dialog"],
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
});
|
||||
```
|
||||
|
||||
### SPA fallback — server config (nginx)
|
||||
```nginx
|
||||
location / {
|
||||
try_files $uri $uri/ /index.html;
|
||||
}
|
||||
```
|
||||
|
||||
### Skeleton + optimistic UI
|
||||
```tsx
|
||||
const mutation = useMutation({
|
||||
mutationFn: postComment,
|
||||
onMutate: async (newComment) => {
|
||||
await queryClient.cancelQueries({ queryKey: ["comments"] });
|
||||
const prev = queryClient.getQueryData(["comments"]);
|
||||
queryClient.setQueryData(["comments"], (old: any) => [...old, newComment]);
|
||||
return { prev };
|
||||
},
|
||||
onError: (_, __, ctx) => queryClient.setQueryData(["comments"], ctx.prev),
|
||||
});
|
||||
```
|
||||
|
||||
## 매 결정 기준
|
||||
| 상황 | Approach |
|
||||
|---|---|
|
||||
| Public marketing site | SSG (Astro / Next static) — 매 SPA X. |
|
||||
| Content blog | SSG / ISR. |
|
||||
| SaaS dashboard (auth-walled) | SPA OK — 매 SEO 의 X 필요. |
|
||||
| E-commerce | SSR/RSC — 매 SEO + perceived perf. |
|
||||
| Internal admin tool | SPA — Vite + React Router. |
|
||||
| Rich realtime app | SPA + WebSocket. |
|
||||
|
||||
**기본값**: 매 새 project 의 Next.js / Remix / SvelteKit (hybrid). 매 pure SPA 의 internal tool 만.
|
||||
|
||||
## 🔗 Graph
|
||||
- 부모: [[Web Architecture]]
|
||||
- 변형: [[MPA]] · [[SSR]] · [[SSG]] · [[Islands Architecture]]
|
||||
- 응용: [[SvelteKit]]
|
||||
- Adjacent: [[Code Splitting]] · [[Hydration]] · [[Service Worker]]
|
||||
|
||||
## 🤖 LLM 활용
|
||||
**언제**: 매 auth-walled rich app — admin, dashboard, realtime collaborative tool.
|
||||
**언제 X**: 매 SEO-critical / content-heavy site — 매 SSR/SSG 의 사용.
|
||||
|
||||
## ❌ 안티패턴
|
||||
- **매 SEO-critical site 의 pure SPA**: 매 crawler 문제 → SSR/SSG.
|
||||
- **매 huge initial bundle (no code-split)**: TTI 악화.
|
||||
- **매 in-memory routing 의 history API X**: 매 back-button 의 X.
|
||||
- **매 server fallback (try_files) 의 X**: 매 deep-link refresh 의 404.
|
||||
- **매 every state 의 Redux**: 매 over-engineering — TanStack Query + local useState.
|
||||
|
||||
## 🧪 검증 / 중복
|
||||
- Verified (MDN Web Docs, React Router v7 docs).
|
||||
- 신뢰도 A.
|
||||
|
||||
## 🕓 Changelog
|
||||
| 날짜 | 변경 |
|
||||
|---|---|
|
||||
| 2026-05-08 | Phase 1 |
|
||||
| 2026-05-10 | Manual cleanup — SPA arch + 2026 hybrid trend 정리 |
|
||||
Reference in New Issue
Block a user