Skip to content

Delivery Plan

DaysPhaseGate
1–2Infrastructure + data layerAll services reachable; schema deployed; first sync completes
3–7API surface + background jobsAll scenarios produce correct outputs
8–10Frontend swap + parity runParity checks pass; staff validates workflows
11–14CutoverProduction traffic on new system
15–21Buffer / stabilizationFix anything that surfaces post-cutover

Weeks 1–2 are active build. Week 3 is buffer — used only if needed.

  • Create PlanetScale database and dev branch
  • Run schema migrations via dbmate
  • Create dashboard-api Worker with Hono skeleton
  • Create ingest Worker with queue consumer skeleton
  • Configure Hyperdrive binding to PlanetScale
  • Set up R2 bucket + public domain
  • Configure CF Access application (Google SSO, allowed emails)
  • Create ingest-queue (Queue) + Cron Triggers
  • Implement Drizzle PostgreSQL schema with all tables
  • Build consolidated Shopify client module
  • Implement bulk sync pipeline (start → poll → parse → write)
  • Implement mart refresh with classification logic
  • Implement watermark management + JSONL archival to R2
  • Run first sync; verify raw_shopify_orders matches Supabase
  • Verify: GET /api/health returns ok

All 14 scenarios are ported in parallel — CRUD routes and queue consumers built together since they share the same DB layer.

  • Swap API base URL to dashboard-api Worker
  • Remove Supabase auth code (AuthContext, login page, ProtectedRoute)
  • Remove Passport login page
  • Deploy to CF Pages
  • Run parity checks
  • Staff validates key workflows end-to-end
  • Fix any discrepancies found
  • DNS switch to new system
  • Monitor for 48 hours
  • Verify all observability alerts are operational
  • Document runbooks: “validate daily sync”, “replay from R2 archive”, “interpret ingest failures”

Used only if needed. If cutover is clean, this week is for:

  • Fix edge cases surfaced by real usage
  • Tune batch sizes and cron schedules based on production data
  • Decommission old system (after 2-week post-cutover holding period)

The rewrite is accepted when:

  1. Operational parity: Every workflow used by Ops/Creative/Fulfillment/Design runs end-to-end
  2. Security remediation: No unauthenticated endpoints; no hardcoded credentials; single auth plane
  3. Reliability: Scheduled sync runs daily without manual intervention; queue retries handle transient failures
  4. Performance: CRUD endpoints p99 < 200ms; daily sync < 15 minutes
  5. Observability: All alerts operational; run history queryable; JSONL archives available for replay
RiskLikelihoodImpactMitigation
PlanetScale limits require more chunking than expectedMediumMediumStart with conservative batch sizes; tune in buffer week
Shopify bulk op API version constraintsLowHighPin API version; test concurrency on day 1
CF Access integration frictionLowMediumTest with small group on day 2; fallback to manual JWT
Data migration misses edge casesMediumMediumParity run on days 8–10 catches discrepancies
Frontend compatibility issues after auth removalLowLowDeploy Pages with old API first, then swap base URL
Compressed timeline leaves no slackMediumMediumBuffer week absorbs overflow; scope can be trimmed to critical scenarios first