SG-Mart needed to exist in three places at once — an iOS app, an Android app and the web — with a full marketplace and distribution system underneath. Building three separate storefronts on top of one commerce engine is exactly the problem headless architecture was invented to solve. Here’s what we learned doing it for real.

One commerce core, many storefronts

The central decision was to separate the commerce engine from the experiences sitting on top of it. Catalogue, pricing, inventory, orders and fulfilment live in one well-defined backend exposed through a clean API. Each storefront — mobile and web — is a client of that API, free to optimise its own experience without forking business logic.

Headless isn’t about the frontend. It’s about having a single source of truth for commerce that every channel can trust.

Performance was a first-class requirement

A marketplace lives or dies on how fast it feels while browsing. As the catalogue grew, naive queries that were fine at launch became the bottleneck. We invested early in the parts that matter:

  • Aggressive caching of catalogue and category data, which changes far less often than it’s read.
  • Pagination and lazy loading so a category with thousands of products never tries to load at once.
  • Image pipelines that serve right-sized, modern formats per device instead of shipping full-resolution assets to phones.
Lesson learned

The query that’s instant with 200 products can take seconds with 20,000. Design for the catalogue you’ll have in a year, not the one you launch with.

Keep the cart and checkout boringly reliable

Browsing can be clever; checkout must be dependable. We treated the order pipeline as the most critical path in the system — idempotent operations so a flaky connection never double-charges, clear states for every step, and graceful recovery when something downstream fails. Trust at checkout is the whole business.

Sharing logic without sharing bugs

Across three clients there’s a constant temptation to copy-paste logic. We resisted it by pushing anything business-critical — pricing rules, tax, promotions — into the commerce core, so all three storefronts compute the same answer the same way. The clients stay thin; the core stays authoritative.

What we’d keep doing

  1. Define the API contract before building any client.
  2. Put business rules in the core, never in the storefront.
  3. Budget performance from day one — it’s far cheaper than retrofitting it.

The takeaway

Headless commerce gave SG-Mart three tailored experiences without three copies of the truth. The architecture paid for itself the first time we shipped a pricing change once and saw it reflected everywhere instantly — and every time the catalogue grew without the app slowing down.