Supplier Order Portal
A bilingual order system shared with my manufacturers in China. Every paid order arrives with finish, address, contact details, pricing and freight method, and is tracked through each production stage.
01Problem statement
Made-to-order parts are produced by manufacturers in China. Every order needs a lot of information to reach them correctly: the exact part number, carbon finish, quantity, agreed price, the customer's shipping address and phone number, and whether it ships by sea or air. That lived in chat messages and spreadsheets. There was no shared status, details got lost in translation, and a job could slip for weeks before anyone noticed.
02Goals
In scope
- Every paid order line reaches the right manufacturer automatically, with everything they need to build and ship it
- One shared status per order, updated by the factory itself
- Works in Chinese and English
- Late jobs are impossible to miss
Out of scope
- Inventory management
- Supplier invoicing and payments
03Acceptance criteria
- A paid order becomes an order card within seconds
- Each card carries part number, finish, quantity, price, ship-to address, contact number, freight method and notes
- Part number = variant barcode, falling back to SKU, then name
- Lines routed to the right manufacturer by vendor and barcode rules
- Cards move through Order raised → Invoice paid → In production → Shipped → Delivered, each stage dated
- Freight set to sea or air from the customer's shipping choice, editable per card
- Shopify retries never create duplicates; deleted cards never come back
- Works offline and syncs when back online
- Amber at 30 days in production, late at 35
04Design
- The Worker verifies the webhook HMAC and looks up part numbers per variant through Admin GraphQL, because order webhooks don't include them
- Finish comes from the variant, freight from the shipping line ('Express' → air, otherwise sea), address and contact from the order
- Each line is routed and written to its own KV record; soft deletes are kept for 90 days
- A static, bilingual web app on GitHub Pages reads and writes through the Worker, one PIN per manufacturer
- Users
- Me + factory teams in China, one portal per manufacturer
- Per order
- Part number, finish, quantity, price, ship-to address, contact number, freight, notes
- Stages
- Order raised → Invoice paid → In production → Shipped → Delivered
- Freight
- Sea or air, set from the customer's shipping choice
- Trigger
- orders/create webhook, HMAC-verified
- Enrichment
- Part numbers looked up per variant via Admin GraphQL
- Storage
- One KV record per order line, soft delete for 90 days
- Client
- Static web app, Chinese / English, works offline
- Access
- PIN per manufacturer, IP lockout with push alerts
- SLA
- Amber at 30 days, late at 35 days in production
05Key decisions
| Decision | Alternative considered | Why |
|---|---|---|
| One KV key per card | One JSON blob per board | The blob lost updates when a webhook and a person saved at the same time |
| Counter keys for card numbers | Counting with KV list() | list() lags behind writes, so it can hand out duplicate numbers |
| API version pinned | Tracking the latest API | The barcode field is deprecated in the newer version |
| PIN + IP lockout | User accounts | Partner staff need zero-friction access; lockout and push alerts limit brute force |
06Failure modes
| Risk | Mitigation |
|---|---|
| A board write fails mid-webhook | Return 500 so Shopify retries; both boards dedupe |
| No barcode found for a line | It stays on the default board, so a real order is never dropped |
| Deploy propagation | Wait ~20 s before backfills that depend on new fields |
07Testing & rollout
Testing
- Local dev with persisted KV and a test webhook secret
- Real historical orders backfilled through the same path
Rollout
- First manufacturer portal
- Cloned for a second manufacturer on shared code and styles
08Outcome
- Two manufacturer portals live, filled automatically from paid orders
- No more order details re-typed into chat
09Follow-ups
- Delivery ETA from the freight type already tagged on each card