Bỏ qua

✅ Deployment Task Checklist

Danh sách công việc đã hoàn thành trong phiên triển khai Production (2026-03-22).

Chuẩn bị & Cấu hình

  • Lập kế hoạch triển khai (Deployment Plan)
  • Kiểm tra cấu hình build Next.js
  • Tạo backend/Dockerfile cho FastAPI
  • Cập nhật backend/main.py sử dụng biến CORS_ORIGINS
  • Cấu hình backend/.env cho Local Dev
  • Cấu hình frontend/.env.local cho Local Dev
  • Tạo file .env.example cho cả Backend và Frontend

Database

  • Tạo project trên Supabase (Free PostgreSQL)
  • Chạy Alembic Migration từ Local → Supabase (alembic upgrade head)

Backend Deployment

  • Deploy Backend lên Northflank (Branch: init-run-full-stack-on-local)
  • Cấu hình 7 biến môi trường trên Northflank (DATABASE_URL, CORS_ORIGINS, R2_*, CDN_BASE)
  • Cấu hình Networking (Port 8000, HTTP, Public)
  • Cấu hình Custom Domain api.chienle.dev
  • Thêm CNAME record trên Cloudflare DNS (DNS Only, không Proxy)
  • Verify domain trên Northflank

Frontend Deployment

  • Deploy Frontend lên Cloudflare Pages
  • Cấu hình Root directory: frontend
  • Thêm biến NEXT_PUBLIC_API=https://api.chienle.dev
  • Cấu hình Custom Domain chienle.dev
  • Bật flag nodejs_compat trong Compatibility flags

Các lỗi đã Fix trong quá trình Deploy

  • Fix lỗi TypeScript tailwind.config.ts (xóa import type { Config })
  • Tạo next.config.js (bỏ qua TS/ESLint errors khi build)
  • Thêm scripts build, start, lint vào package.json
  • Fix lib/api.ts (thêm JSON headers, sửa endpoint finalize-upload)
  • Fix lỗi Node.JS Compatibility Error (thêm flag nodejs_compat)
  • Fix lỗi Backend crash "no healthy upstream" (thiếu biến môi trường R2)

Xác minh & Tài liệu

  • Xác minh Backend API hoạt động (api.chienle.dev)
  • Xác minh Frontend hiển thị (chienle.dev)
  • Xác minh Custom Domains + SSL Active
  • Tạo Deployment Guide (docs/deployment-guide.md)