Projects

Portfolio demo

DeskLab

A 3D workspace builder backed by Shopify. One planner validates budget and fit; shared Redis quotas and cart checks protect the checkout path.

Explore demoSource

Role
Designer and developer
Built with
Next.js, TypeScript, React Three Fiber, Shopify Storefront API, Redis, Playwright
Status
Portfolio demo, live
DeskLab storefront with a 3D desk setup, product collection and workspace builder.
The DeskLab storefront. Screenshot from the project's documentation.

The problem and what I built

Putting a desk setup together means holding a budget, the width of the space and whether the pieces fit, all at once. DeskLab helps a visitor assemble a compatible setup within their space and budget, then look around it in 3D.

I built the 3D storefront, plain-language preference flow, planner and validator, and Shopify checkout integration. The engineering problem was preserving product choices through model errors, stale stock, upstream outages and graphics failures.

What a visitor does

  1. Describe the space, budget and style in plain words.
  2. Get a proposed setup and look around it in a 3D scene.
  3. Swap pieces and open “Why this setup fits” to inspect the current budget, dimensions and compromises.
  4. Copy a link that reopens the same setup in another browser.
  5. Add pieces to the bag and continue to Shopify's hosted test checkout.
DeskLab's workspace builder: a written brief, a budget slider at 650 dollars, an available desk width of 140 cm, a 3D preview of the chosen desk, a 540 dollar total and a row of desk options with prices and widths.
An earlier documentation screenshot of the workspace builder, before the setup explanation panel was added.

The hard choice: a narrow job for AI

The model interprets what a visitor wants. Deterministic application rules decide whether a setup fits their space and budget. The model returns validated preferences, never product IDs, prices or purchase actions.

Recommendations and manual swaps use the same validator, which also explains the current selection. Builder edits invalidate pending recommendations, so late results cannot overwrite newer choices. Shopify stays the authority for connected prices, availability, carts and payment totals.

Source at the reviewed commit:Validated AI preferencesThe shared validatorCurrent-selection explanationDiscarding stale results

Boundaries and who decides

The table follows five responsibilities from the brief to checkout. Choose a boundary to inspect its input, decision and output.

Inspect a boundary
What each boundary receives, decides and passes on
BoundaryReceivesDecidesPasses on
Preferences and AITurns a brief into validated preferences.ai.ts, validationai.ts, timeout and fallbackA plain-language brief, or a budget, width and style chosen directly.The optional model interprets intent only, and its output is validated. On a timeout or error, a labelled rules fallback takes over.Validated preferences. Never product IDs, prices or purchase actions.
Planner and validatorOne deterministic check for generated and manual selections.recommend.ts, validatorrecommend.ts, plannerValidated preferences, or a manual swap from the builder.Budget, availability and fit, including combined footprints and clearance against the selected desk's configured catalog dimensions. Ties break deterministically.A setup that passes every check, or the reasons it does not.
Browser bagHolds the visitor's setup on their device.configuration.ts, stored selectionconfiguration.ts, validationA validated setup.Sends manual swaps back through the same validator. Share links use a versioned, validated encoding that is not encrypted or authenticated.Catalog product IDs and quantities, saved on the device and sent to the server at checkout, plus an optional share link. The bag holds no live Shopify variants.
Server recheckApplies shared quotas and validates the checkout handoff._utils.ts, request protectionshopify.ts, checkout validationCatalog product IDs and quantities from the bag.Checks origin, body size and shared Redis quotas before loading services. Resolves catalog products to live Shopify variants, rechecks availability and rejects warnings or changed cart lines and quantities.A checked Shopify checkout URL, or an error. Inventory is not reserved, and a configured Shopify outage is never hidden behind the fictional local catalog.
Shopify checkoutOwns prices, availability, carts and payment totals.ARCHITECTURE.md, authoritiesA cart from the server.Authoritative for connected prices, availability and payment totals. Checkout uses test payments.A test order. Returning from checkout is not proof that a payment succeeded.

Source links point at the reviewed commit.

A correctness example: combined footprints

A 100 cm desk inside a 140 cm space still has only 100 cm of tabletop. Checking each accessory against the space, or against the desk on its own, was not enough. The validator checks the combined footprints and clearance against the dimensions configured for the selected desk in the demo catalog.

The fit model is deliberately simple: rectangles in a fixed two-row layout, two items per row, with 4 cm of clearance between them. It does not assess ergonomics, load ratings, electrical compatibility or unusual room shapes.

Available space: 140 cm68 cm34 cm4 cmSecond rowDesk tabletop: 100 cm68 + 4 + 34= 106 cm6 cm pastthe edge
An illustration of the tested constraint, not DeskLab output. The layout holds two items in each of two rows. A 68 cm item and a 34 cm item each fit the desk alone, but in one row they need 68 + 4 + 34 = 106 cm, more than the 100 cm tabletop, even though the 140 cm space has room.

Source at the reviewed commit:Combined footprint calculationFit regression cases

Protecting the service and checkout

One Redis Lua script checks the client-minute, global-minute and global-day quotas before incrementing any counter. Server instances share these limits, and production cannot substitute per-process counters when Redis is unavailable.

Checkout validates the response as well as the request. The server rejects Shopify warnings, changed cart lines and quantity mismatches before returning a checkout URL. A successful API response alone does not prove the cart matches the visitor’s choice.

Health probes share an in-flight Redis PING, cached for 30 seconds per instance, without calling Shopify or the model. Application logs record a fixed event, route, status and duration, without briefs, cart tokens or raw IPs.

Source at the reviewed commit:Atomic Redis quotasLua reservationCart response validationCoalesced health probesBounded application logs

When something fails

Each failure has a defined behavior, and none of them quietly changes what a visitor buys.

The AI model times out or errors
A labelled rules fallback produces the preferences instead.ai.ts
Shopify is configured but unavailable
The visitor sees an error. The fictional local catalog is never presented as live inventory.shopify.ts
Stock or the cart changes before checkout
The server rechecks stock and verifies the returned cart lines and quantities. A warning or mismatch stops the handoff. It does not reserve inventory, so hosted checkout stays authoritative.shopify.ts
A quota is exhausted or Redis is unavailable
Exhausted quotas return 429 with Retry-After. Missing or unavailable protection returns 503 and stops the request, without a local counter fallback._utils.ts
WebGL fails
A usable SVG configurator replaces the 3D scene.workspace-scene.tsx

How it was checked

Local verification on November 18, 2026 covered the builder changes and shared quotas. Earlier hosted checks retain their original dates.

  • Lint, TypeScript and the production build passed, with 109 domain/backend tests.
  • 49 Chromium/WebKit browser checks passed; one existing WebKit pixel check was intentionally skipped. Regressions forced late responses to arrive after edits and exercised the setup explanation.
  • A separate Redis suite passed 15 tests across four worker processes, covering 14 quota, atomic-denial, time-window, expiry and failure scenarios.
  • November 15 hosted checks covered AI recommendations, sharing, declined and successful test payments, and storefront return. The documented Shopify orders were Paid, Unfulfilled and Test.
  • November 16 and 17 scheduled smoke runs checked homepage/headers, readiness, the connected catalog and an empty-brief rules recommendation. They made no model call or cart.

The Redis suite ran unchanged production Lua through a local socket adapter, with direct handler calls and controlled time. It checked production TTLs before shortening fixture expiry. Hosted Upstash transport and production throughput remain untested; other service tests use test doubles. The November 18 checks made no model calls or orders.

Source at the reviewed commit:November 18 checks and scopeHistorical hosted checksScheduled smoke, Nov 16Scheduled smoke, Nov 17

Tradeoffs and limits

  • Exhaustive planning stays inspectable for a curated 18-product catalog. A larger catalog would need a candidate search step in front of the same validation boundary.
  • Inventory rechecks do not reserve stock, and orders are not reconciled through webhooks.
  • Share links are validated, not private.
  • Footprints use a bounded, simplified geometry model.
  • Fixed-window quotas share workload limits across instances. Denied requests still use Redis, so these are not provider billing caps.

What carries over to infrastructure work

  • Put each decision where its authority lives. The model interprets, the application validates, and Shopify owns prices, stock and payment.
  • Validate both sides of an integration: model output before planning, and the returned cart before handing off to checkout.
  • Give every path the same check. Generated and manual selections share one validator, so there is one place to fix and test.
  • Make failure states explicit. Exhaustion, unavailable protection, upstream failure and a labelled rules fallback each have a defined response.
  • Turn observed mistakes into regression cases. “1.2 meters” once became $1.20; the corrected parser separates measurements from money. Its small fixture set does not establish general language accuracy.

Source at the reviewed commit:The parser regression

Explore demoSourceAll projects