Skip to content

CLI: Deploy Backend Workers

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

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

Terminal window
npx wrangler secret put <SECRET_NAME>

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

Terminal window
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”

Section titled “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.

Apply migrations to Cloudflare D1 (not local):

Terminal window
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 ../..

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

Terminal window
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:

Terminal window
pnpm deploy:auth
pnpm deploy:support
# etc.

4. If you see “binding target not found”

Section titled “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)
  • Required auth secrets filled
  • Remote D1 migrations completed
  • All Workers deployed successfully
  • No binding-not-found errors