Delivery Plan
Timeline overview
Section titled “Timeline overview”| Days | Phase | Gate |
|---|---|---|
| 1–2 | Infrastructure + data layer | All services reachable; schema deployed; first sync completes |
| 3–7 | API surface + background jobs | All scenarios produce correct outputs |
| 8–10 | Frontend swap + parity run | Parity checks pass; staff validates workflows |
| 11–14 | Cutover | Production traffic on new system |
| 15–21 | Buffer / stabilization | Fix anything that surfaces post-cutover |
Weeks 1–2 are active build. Week 3 is buffer — used only if needed.
Days 1–2: Infrastructure + data layer
Section titled “Days 1–2: Infrastructure + data layer”- Create PlanetScale database and dev branch
- Run schema migrations via dbmate
- Create
dashboard-apiWorker with Hono skeleton - Create
ingestWorker 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_ordersmatches Supabase - Verify:
GET /api/healthreturnsok
Days 3–7: API surface + background jobs
Section titled “Days 3–7: API surface + background jobs”All 14 scenarios are ported in parallel — CRUD routes and queue consumers built together since they share the same DB layer.
API routes
Section titled “API routes”- Performance metrics CRUD + classification settings + summary stats
- Tag classifications (bulk upsert, unclassified)
- Tag groups CRUD
- Tag analytics (replicate RPC logic in TypeScript)
- Designer assignments CRUD + performance aggregation
- Combo logs CRUD + CSV import/export
- Combo templates CRUD + ID generation
- Order lookup
- Fulfillment monitoring summary endpoint
- CF Access middleware
- Queue producers (enqueue endpoints)
Background jobs
Section titled “Background jobs”- Asset ingest queue consumer
- CSV export queue consumer
- Product tag sync queue consumer
- Combo suggestion generation
- Combo import queue consumer
- Wire Cron Triggers → daily sync + hourly mart refresh
- Verify: each scenario’s acceptance criteria pass
Days 8–10: Frontend swap + parity run
Section titled “Days 8–10: Frontend swap + parity run”- Swap API base URL to
dashboard-apiWorker - 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
Days 11–14: Cutover
Section titled “Days 11–14: Cutover”- 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”
Week 3 (buffer): Stabilization
Section titled “Week 3 (buffer): Stabilization”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)
Success criteria
Section titled “Success criteria”The rewrite is accepted when:
- Operational parity: Every workflow used by Ops/Creative/Fulfillment/Design runs end-to-end
- Security remediation: No unauthenticated endpoints; no hardcoded credentials; single auth plane
- Reliability: Scheduled sync runs daily without manual intervention; queue retries handle transient failures
- Performance: CRUD endpoints p99 < 200ms; daily sync < 15 minutes
- Observability: All alerts operational; run history queryable; JSONL archives available for replay
Risk register
Section titled “Risk register”| Risk | Likelihood | Impact | Mitigation |
|---|---|---|---|
| PlanetScale limits require more chunking than expected | Medium | Medium | Start with conservative batch sizes; tune in buffer week |
| Shopify bulk op API version constraints | Low | High | Pin API version; test concurrency on day 1 |
| CF Access integration friction | Low | Medium | Test with small group on day 2; fallback to manual JWT |
| Data migration misses edge cases | Medium | Medium | Parity run on days 8–10 catches discrepancies |
| Frontend compatibility issues after auth removal | Low | Low | Deploy Pages with old API first, then swap base URL |
| Compressed timeline leaves no slack | Medium | Medium | Buffer week absorbs overflow; scope can be trimmed to critical scenarios first |