Docs/Deployment
Deployment

CLI: Deploy Backend Workers

Deploy backend Workers using wrangler deploy. Fill secrets first, run remote migrations, then deploy in order.

Last updated Mar 22, 2026

This step deploys only the 10 core Workers (node1-auth through node10-ai). Value-added services (e.g. zship-provider1-service) are not included.

1. Fill required secrets first

Before deploying, ensure node1-auth-service has its critical secrets filled. Check the service's wrangler.jsonc and use:

npx wrangler secret put <SECRET_NAME>

For each required secret. Run from the service directory, e.g.:

cd backend/node1-auth-service
npx wrangler secret put JWT_SECRET
# ... other secrets as needed
cd ../..

1.5 How this maps to Dev Console “push env”

wrangler secret put and vars in wrangler.jsonc + deploy both end up as Worker configuration in Cloudflare. If you use Dev ConsoleDeployEnvironment variablesPush to a Worker, you are updating the same remote Worker—just without terminal commands and often next to one-click deploy. Use either CLI or Dev Console for routine non-secret values; keep secrets in secret put or store them as Secrets in the UI—never commit them to git.

2. Run remote D1 migrations

Apply migrations to Cloudflare D1 (not local):

cd backend/node1-auth-service && npx wrangler d1 migrations apply zship-auth --remote && cd ../..
cd backend/node2-support-service && npx wrangler d1 migrations apply zship-support --remote && cd ../..
cd backend/node3-pay-service && npx wrangler d1 migrations apply zship-pay --remote && cd ../..
cd backend/node4-notify-service && npx wrangler d1 migrations apply zship-notify --remote && cd ../..
cd backend/node5-blog-service && npx wrangler d1 migrations apply zship-blog --remote && cd ../..
cd backend/node7-site-service && npx wrangler d1 migrations apply zship-site --remote && cd ../..
cd backend/node8-prompt-service && npx wrangler d1 migrations apply zship-prompt --remote && cd ../..
cd backend/node9-checkin-service && npx wrangler d1 migrations apply zship-checkin --remote && cd ../..
cd backend/node10-ai-service && npx wrangler d1 migrations apply zship-ai --remote && cd ../..

3. Deploy Workers in order

Deploy each backend service. Recommended order (auth first, then others):

cd backend/node1-auth-service && pnpm run deploy && cd ../..
cd backend/node2-support-service && pnpm run deploy && cd ../..
cd backend/node3-pay-service && pnpm run deploy && cd ../..
cd backend/node4-notify-service && pnpm run deploy && cd ../..
cd backend/node5-blog-service && pnpm run deploy && cd ../..
cd backend/node6-cdn-service && pnpm run deploy && cd ../..
cd backend/node7-site-service && pnpm run deploy && cd ../..
cd backend/node8-prompt-service && pnpm run deploy && cd ../..
cd backend/node9-checkin-service && pnpm run deploy && cd ../..
cd backend/node10-ai-service && pnpm run deploy && cd ../..

Or use root scripts where available:

pnpm deploy:auth
pnpm deploy:support
# etc.

4. If you see "binding target not found"

  • Ensure you did not rename any Worker (must match name in wrangler.jsonc)
  • Ensure you are logged into the correct Cloudflare account (npx wrangler whoami)
  • Deploy in dependency order (Workers without bindings first)

5. Checklist

  • [ ] Required auth secrets filled
  • [ ] Remote D1 migrations completed
  • [ ] All Workers deployed successfully
  • [ ] No binding-not-found errors