Server Action = mutation endpoint, inline 선언
Server Action 은 server 에서 도는 async function 인데 Client Component 에서 callable. Framework 가 unique POST endpoint 로 뒤에서 wiring — API 처럼 부르는 게 아니라 function 처럼.
선언 두 방법
| 접근 | 방법 |
|---|---|
| File-level | File 위에 'use server'. 그 file 의 모든 export 가 action. |
| Inline | Server Component 안에 function 정의 + 그 body 위에 'use server'. |
대체하는 것
내부 CRUD 위해서는 더 이상 /api/…/route.ts + fetch() + 양쪽 JSON parse 안 필요. Server Action 이 built-in CSRF protection, encrypted action ID, unused action 자동 dead-code elimination 가진 POST endpoint.
대체 안 하는 것
Public API (third party 가 부름), webhook, integration, stable URL 노출 필요한 거 — Route Handler 가 owning (다음 track).