feat: add client-backend.sonicjs.com independent deployment

Merged
LA
9h ago
+121-2

What

Adds a separate sonicjs-client-backend Cloudflare Worker at client-backend.sonicjs.com so caching can be tuned independently from demo.sonicjs.com.

Resources

ResourceValue
Worker namesonicjs-client-backend
Routeclient-backend.sonicjs.com/*
D1 (shared)sonicjs-demo — same content, no re-seed needed
R2 (shared)sonicjs-demo-media
KV (isolated)fa15ce6927af43af9149e926631d7ad5 — independent cache state

Changes

  • my-sonicjs-app/wrangler.client-backend.toml — new worker config
  • .github/workflows/deploy-client-backend-cms.yml — deploys on every push to main that touches packages/core/** or my-sonicjs-app/**, same trigger as deploy-demo-cms.yml; auto-creates DNS record on first CI run
  • .github/workflows/deploy-demo.yml — sets VITE_CMS_URL=https://client-backend.sonicjs.com for the Pages build; fixes project name (sonicjs-client-directory)

DNS

The workflow auto-creates the client-backend AAAA 100:: proxied record via CF API on first run. If the CI token lacks DNS write permission, add it manually: CF Dashboard → sonicjs.com DNS → Add AAAA client-backend 100:: proxied.


Summary by cubic

Adds a separate sonicjs-client-backend Cloudflare Worker at client-backend.sonicjs.com so caching can be tuned independently from demo.sonicjs.com. The demo Pages build now points at the new backend.

Changes

  • The new worker shares sonicjs-demo D1 and sonicjs-demo-media R2 (same content, no re-seed) but has an isolated KV namespace for cache state.
  • A new CI workflow deploys on the same triggers as the demo CMS workflow and auto-creates the DNS record on first run.
  • The demo Pages deployment now uses the corrected project name sonicjs-client-directory.

Deployment

  • If the CI token lacks DNS write permission, add the AAAA client-backend 100:: proxied record manually.
  • If the CI token lacks Workers Routes edit permission, the worker uploads but route registration fails; grant Zone > Workers Routes > Edit.

RetriggerView in GreptileConfidence Score: 3/5

Fix the DNS lookup and first-deployment route checks before merging, and satisfy the secret-storage and browser-test requirements.

Findings

  1. P1 DNS lookup stops deployment ▶
  2. P1 Deployment succeeds without a route ▶
  3. P2 Security Authentication secret is public ▶
  4. P2 Backend switch lacks required tests ▶

Summary

Adds a separate Worker for the employee directory and points its Pages build at the new backend.

  • A separate client backend runs at its own Cloudflare address.
  • The employee-directory site now sends CMS requests to the client backend.

lane711 explicitly allows manual DNS setup when the token lacks DNS write permission. That warning is intentional; the separate unguarded lookup remains an issue.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart LR
  Pages["Employee directory Pages"] --> Backend["client-backend.sonicjs.com"]
  Backend --> DB[("Shared demo D1")]
  Backend --> Media[("Shared demo R2")]
  Backend --> ClientKV[("Separate client KV")]
  Demo["demo.sonicjs.com"] --> DB
  Demo --> Media
  Demo --> DemoKV[("Demo KV")]

Reviews (1) · Last reviewed commit: "feat: add client-backend.sonicjs.com dep..." · Reviewed by Greptile