Skip to content
ApexSutra

Reference build 04 · Retail

Headless Commerce

Prerendered catalogue with edge cart state and inventory reservation that prevents oversell.

Reference architecture · illustrative
The problem

What we'd be solving.

A multi-channel retailer has a storefront that is slow on mobile and oversells during sale events. Catalogue pages are rendered per request, and stock is synced between channels on a schedule.

Next.jsTypeScriptPostgreSQLRedisCloudflareStripe

The approach

Four decisions that shape everything else.

  • 01

    Static catalogue, revalidated on change

    Product pages are prerendered and invalidated by webhook when the catalogue updates. The common path becomes a CDN hit instead of a database query.

  • 02

    Cart state at the edge

    Per-session cart and pricing run in an edge runtime near the user. Only the genuinely dynamic part pays a latency cost.

  • 03

    Reserve stock at add-to-cart

    A short-lived reservation with automatic expiry, held centrally. Oversell comes from treating inventory as eventually consistent across channels; reservation removes the window.

  • 04

    Rehearse the peak

    Sale events are known dates. Load is tested against the real architecture beforehand, so capacity is a decision rather than a discovery.

What we rejected

The alternatives, and why they lost.

Anyone can list the technology they chose. What tells you whether a team can be trusted with your system is whether they can explain what they didn't choose.

  • Server-rendering catalogue pages per request

    Pays a database round trip for content that changes a few times a day, and it is the direct cause of the mobile slowness.

  • Scheduled inventory sync between channels

    The sync interval is precisely the oversell window. Shortening it reduces the symptom without removing the cause.

  • A single monolithic commerce platform

    Simpler initially, but it couples storefront performance to a release cycle the retailer does not control.

Start here

Tell us the problem.
We'll be honest about the fit.

A first conversation costs nothing and is useful even if you go elsewhere — you'll leave with an architecture opinion and a realistic sense of scope.

  • Reply within 24 hours
  • No sales sequence