All work

Custom caps — 3D configurator

A phone-first 3D studio where customers design rhinestone caps in real millimetres, with store and back-office.

Stack:
  • Astro 7
  • React 19
  • Three.js
  • zustand + immer
  • zod
  • Drizzle ORM
  • Cloudflare D1 + R2
  • Vitest + Playwright
  • 53named anchor points per cap model, each with a mirror twin
  • 315 → 21 msper step with 6,000 stones along the edge, after tuning
  • 26architecture decision records

One cap, measured in millimetres

Tap a block to see what it does.

  • Logic
  • People
  • Data
  • Infrastructure
  • Output

The heart of the system

Cap studio in millimetres

Every part works on the same design: a procedural cap in real millimetres, edited on a phone, checked by one schema and turned into products, stock and a bill of materials.

Connected to Cap engine, Phone Studio, Offline drafts, Design document, Cloudflare Worker, D1 + R2, Store and cart, Back-office

The problem

A maker of custom rhinestone caps had a 3D configurator with a low-poly model, one colour for the whole cap and a native colour picker that covered the model on iPhone. The client wanted placing text, logos, patches and rhinestones to be very easy, with many preset anchors, snapping and symmetry.

What I built

  1. Wrote a phased master spec with quality gates and bans, then ran Claude Code in a long autonomous loop and Codex on a separate branch, with every task checked again by an independent reviewer subagent.
  2. Specified a procedural cap engine in real millimetres instead of a 3D asset: 5 models, 14 zones, 11 procedural fabrics and 53 named anchors, each with a mirror twin.
  3. Shipped a phone-first Studio: rhinestones from text, shapes, images or a brush, mirror mode, undo and redo, and offline drafts that sync with conflict detection.
  4. Added a store with a server-side cart that holds limited pieces atomically, and a back-office where each design's bill of materials drives the stock.
  5. Locked down the Worker: one-time email codes, CSRF, CSP, per-client rate limits and validated uploads; private assets answer 404, never 403.

The hard part

Putting flat text and logos on a curved cap without distortion. The first surface map inverted with errors up to 53.7 mm; Newton iteration with periodic wrapping brought it to 0 errors on 400 test points, and a geodesic walker brought sheared elements back to square.

Result

A working local prototype, not deployed yet: Studio, store and back-office run on local D1 and R2 after 74 commits in 6 days. Placing 6,000 stones along the edge went from 315 to 21 ms per step after tuning; checkout, export and the final audit are still to do.

My role

Client project built by orchestrating agents: Claude Code and Codex wrote the code. I wrote and maintained the master spec, supplied the references and my design skills, asked for the technical comparisons that became ADRs, set the priorities and reviewed the results.