Cloudflare Pages cho Next.js static export, Workers cho edge functions, R2 cho object storage (rẻ hơn S3 80%), D1 SQLite global. Free tier rộng, scale tự động, latency edge thấp cho user VN.
- Phân loại
- Edge Cloud Platform
- Kinh nghiệm
- 2+ năm production
- Đã triển khai
- 10+ dự án
Năng lực kỹ thuật
Alodev chuyển sang Cloudflare từ Vercel + AWS từ 2024. Lý do: cost giảm 60-80%, free tier rộng (10M requests/tháng), zero egress fee R2, deploy nhanh + reliable. Đã deploy 10+ dự án trên Cloudflare bao gồm alodev.vn này.
Cloudflare Pages deployment
Git push → auto build → deploy global. Preview URL cho mỗi PR. Custom domain free. SSL auto.
Workers runtime
V8 isolate runtime, fast cold start (<5ms). Node.js compatibility layer. TypeScript first. Đã deploy edge functions cho 5 dự án.
R2 object storage
S3-compatible API, presigned URL, lifecycle rules, multi-region. Cost: $0.015/GB-month + zero egress.
Workers KV + Durable Objects
Distributed key-value cho cache + session. Durable Objects cho stateful (chat, collaboration realtime).
Pages Functions
Server-side functions trong Pages site. Cho dynamic routes, API endpoints, form handling - không cần Workers riêng.
Custom email routing
Email Workers - auto-process incoming mail. Tạo support@alodev.vn → forward + log + auto-reply tự động.
Use case phù hợp
Static site + landing
Cloudflare Pages: deploy Git push tự động, global CDN, free SSL, unlimited bandwidth. Phù hợp landing, blog, marketing site.
Next.js static export
Output Next.js (SSG) deploy lên Pages. Hỗ trợ ISR qua Workers KV cache. Performance đỉnh, cost gần 0.
Edge API + serverless functions
Workers chạy code Node.js/TypeScript tại edge (200+ cities). Latency <50ms từ VN. Phù hợp API auth, payment webhook, image proxy.
Media + file storage
R2 thay S3: cùng API S3-compatible, rẻ 80%, zero egress fee. Phù hợp media library, backup, CDN origin.
Global database with D1
D1 = SQLite distributed globally. Phù hợp app cần data global low-latency. Beta nhưng production-ready cho use case đơn giản.
Security + DDoS protection
WAF, bot management, DDoS L3-7. Free tier đủ cho SME. Production-grade security không cần config phức tạp.
Dùng khi
- Static site + landing page
- Next.js app với traffic toàn cầu (low latency edge)
- Cần free tier rộng cho POC / startup
- API serverless với cold start fast
Không phù hợp khi
- Database phức tạp (PostgreSQL) → cần managed service khác
- Long-running tasks (>30s) → AWS Lambda lâu hơn
- Yêu cầu data residency VN strict (Nghị định 13) → VNG Cloud / Viettel IDC
Stack đi kèm
- Cloudflare Pages
- Workers
- R2
- D1 (SQLite)
- Workers KV
- Durable Objects
- Wrangler CLI
Câu hỏi thường gặp
Cloudflare vs AWS vs Vercel - chọn cái nào?
Vercel: best DX cho Next.js, deploy 1 click, đắt khi traffic lớn. AWS: feature đầy đủ nhất, complex, cost cao nếu không optimize. Cloudflare: edge global, free tier rộng, cost predictable, learning curve trung bình. Cho SME VN: Cloudflare ROI tốt nhất.
Cloudflare có data center VN không?
Có. Cloudflare có 2 PoP (Point of Presence) tại Việt Nam: HAN (Hà Nội), SGN (TP.HCM). Latency từ user VN <30ms cho static + edge functions. Tuy nhiên, origin server không ở VN - nếu cần data residency VN strict, vẫn dùng VNG Cloud / Viettel IDC làm origin.
Cost Cloudflare thực tế cho SME?
Pages: free tier unlimited bandwidth + 500 builds/tháng. Workers: 100k requests/ngày free, sau đó $0.50/1M. R2: $0.015/GB-month + zero egress. D1: free 5GB. SME web app ~50k user/ngày: $0-30/tháng. So với AWS tương đương: $200-500/tháng.
Workers có thay được full backend không?
Cho 70% dự án có. Limitations: max 30s execution time (free), 50ms CPU time. Không phù hợp: heavy computation (image processing), long polls. Phù hợp: API CRUD, auth, payment webhook, image transform, edge cache. Combine với managed DB (Neon, PlanetScale) cho full backend.
Migration từ Vercel/AWS sang Cloudflare khó không?
Tuỳ stack. Next.js static export: dễ (đổi deploy target). Next.js full SSR: cần adapter @cloudflare/next-on-pages. AWS Lambda → Workers: viết lại với Workers API (khác signature). S3 → R2: API tương thích, switch SDK + endpoint. Alodev đã làm 5 migration, mất 1-3 tuần/dự án.
Công nghệ khác
Dự án Cloudflare
của bạn bắt đầu từ đâu?
Mô tả bài toán, ALODEV tư vấn đúng nghiệp vụ, miễn phí.