Docs/Deployment
Deployment

CLI: Prepare Cloudflare Resources

Create Workers, D1 databases, KV namespace, and R2 bucket in Cloudflare using wrangler commands.

Last updated Mar 19, 2026

Create the required Cloudflare resources for core delivery (9 D1, 1 KV, 1 R2) before deploying real code. Workers are created automatically when you run wrangler deploy — the name in each wrangler.jsonc defines the Worker, and bindings are applied on deploy. Value-added services (e.g. zship-provider1-service) are not included.

1. Create D1 databases

From the repository root, run these commands. Each will create the database and update the service's wrangler.jsonc:

cd backend/node1-auth-service && npx wrangler d1 create zship-auth --binding DB --update-config && cd ../..
cd backend/node2-support-service && npx wrangler d1 create zship-support --binding DB --update-config && cd ../..
cd backend/node3-pay-service && npx wrangler d1 create zship-pay --binding DB --update-config && cd ../..
cd backend/node4-notify-service && npx wrangler d1 create zship-notify --binding DB --update-config && cd ../..
cd backend/node5-blog-service && npx wrangler d1 create zship-blog --binding DB --update-config && cd ../..
cd backend/node7-site-service && npx wrangler d1 create zship-site --binding DB --update-config && cd ../..
cd backend/node8-prompt-service && npx wrangler d1 create zship-prompt --binding DB --update-config && cd ../..
cd backend/node9-checkin-service && npx wrangler d1 create zship-checkin --binding DB --update-config && cd ../..
cd backend/node10-ai-service && npx wrangler d1 create zship-ai --binding DB --update-config && cd ../..

2. Create KV namespace

cd backend/node3-pay-service
npx wrangler kv namespace create zship-pay-kv --binding KV --update-config
cd ../..

3. Create R2 bucket

cd backend/node6-cdn-service
npx wrangler r2 bucket create zship-cdn --binding BUCKET --update-config
cd ../..

4. Verify no placeholders remain

rg -n "00000000-0000-0000-0000-000000000000|placeholder-replace-after-create" backend/*/wrangler.jsonc

If this returns nothing, you are ready. If it finds matches, fix those configs before continuing.

5. Checklist

  • [ ] All 9 D1 databases created
  • [ ] KV namespace created
  • [ ] R2 bucket created
  • [ ] No placeholder IDs in wrangler.jsonc files