serverless choices

API Routes, Server Actions, Edge Functions는 같은 문제가 아니다

세 방식은 모두 서버에서 실행되지만 호출 방식, 데이터 경계, 배포 제약이 다르다.

API Routes

좋음: 외부 클라이언트도 호출하는 HTTP API

주의: 인증과 rate limit이 빠지기 쉬움

Server Actions

좋음: 폼 제출, 데이터 변경, revalidate

주의: 클라이언트 입력을 신뢰하면 안 됨

Edge Functions

좋음: 인증 초입, redirect, geo 분기

주의: Node API와 무거운 SDK 제약

질문선택확인할 것
브라우저 밖에서도 호출해야 하나API RouteHTTP method, auth, schema
폼 액션과 UI 갱신이 붙어 있나Server Action권한, revalidatePath/Tag
요청 초입에서 빠르게 분기하나Edge Function지원 API, TTFB, fallback