Netlify는 정적 사이트와 Jamstack 애플리케이션 배포에 특화된 클라우드 플랫폼이다. Git 연동 CI/CD, CDN, 서버리스 함수, 폼 처리, A/B 테스트를 통합 제공한다.
핵심 기능
| 기능 | 설명 |
|---|
| Continuous Deployment | Git push → 자동 빌드·배포 |
| Branch Deploys | 브랜치별 고유 URL |
| Split Testing | 트래픽 분기 A/B 테스트 |
| Netlify Functions | AWS Lambda 기반 서버리스 함수 |
| Edge Functions | Deno 런타임 엣지 함수 |
| Forms | 서버 없이 폼 데이터 수집 |
| Identity | JWT 기반 사용자 인증 |
netlify.toml 설정
toml
[build]
command = "npm run build"
publish = "dist"
[build.environment]
NODE_VERSION = "20"
[[redirects]]
from = "/api/*"
to = "/.netlify/functions/:splat"
status = 200
[[headers]]
for = "/*"
[headers.values]
X-Frame-Options = "DENY"
X-XSS-Protection = "1; mode=block"
[context.production]
command = "npm run build:prod"
[context.deploy-preview]
command = "npm run build:preview"
Netlify Functions 예시
typescript
import { Handler } from '@netlify/functions';
export const handler: Handler = async (event, context) => {
const { name = 'World' } = event.queryStringParameters ?? {};
return {
statusCode: 200,
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ message: `Hello, ${name}!` }),
};
};
Jamstack 배포 흐름
Git Push (GitHub/GitLab/Bitbucket)
↓
Netlify Build (npm run build)
↓
정적 파일 → Netlify CDN (전 세계)
↓
동적 요청 → Functions / Edge Functions
관련 문서