Deploy Guide
Deploy to Zeabur
- Push your repo to GitHub
- Go to zeabur.com → New Project → Add Service → GitHub
- Select your repo — Zeabur auto-detects Next.js via
zbpack.json - Set env vars (see Deployment docs)
- Deploy
Required Env Vars
env
DATABASE_URL=postgresql://...
AUTH_SECRET=<random 32+ char secret>
NEXTAUTH_URL=https://your-app.zeabur.appZero-Downtime Deploys
Migrations do not run at startup (start is plain next start, and the standalone runtime image has no drizzle-kit). Run them from your machine with scripts/deploy/zeabur-db.sh <env> migrate (verified pg_dump backup first, temporary port always closed) before deploying the new code — see Deployment. Keep migrations additive (backward-compatible column add first, deploy, cleanup later) so the previous release still runs on the new schema and a rollback is safe.
Deploy dev-docs to Cloudflare Pages
See deploy/cloudflare-pages.md for the full config. Short version:
bash
# Set env var
export CLOUDFLARE_API_TOKEN=<your token>
# Run the gh-cf-deploy skill from Claude Code
/gh-cf-deployBuild settings for Cloudflare Pages:
- Root:
dev-docs - Build command:
pnpm build - Output:
.vitepress/dist
Environment Variables for dev-docs Build
| Var | Purpose |
|---|---|
VITEPRESS_API_BASE | Base URL for the API playground (e.g. https://app.zeabur.app) |
Smoke Test After Deploy
bash
# Health check
curl https://your-app.zeabur.app/api/health
# Expected: { "status": "ok" }
# Sign in(工牌編號 + 密碼)
curl -X POST https://your-app.zeabur.app/api/auth/signin \
-H "Content-Type: application/json" \
-d '{"badge":"R90001","password":"Admin123!"}'