Independent sellers needed to open shops inside an app whose accounts, addresses and categories already existed.
TL;DR
NDA note: shop applications, category attributes, and up to two variant axes with a price and stock row per variant.
live trace · Application flowfrom the original diagram
01
Seller → Apply APIapply with profile, address, account details, documents
02
Apply API → Seller storeinsert or update if rejected, status pending
03
Apply API → Store locationcreate default location from address
04
Apply API → Account detailcreate default account detail
05
Apply API → Sellerapplication submitted
…
01
Background
+
Independent sellers needed to open shops inside an app whose accounts, addresses and categories already
existed. Products needed variants (for example size and colour) with their own price and stock.
02
How it works
+
The seller applies using an existing account address and account details detail; the application copies them into
the shop's default location and account details record.
One shop per account. A rejected application is updated in place and resubmitted, not duplicated.
Admin approves or rejects. Only an active shop can list products.
Categories define attribute templates; the seller fills attributes and defines up to two variant axes.
Every combination of axis values becomes a variant row with its own price and stock. The product keeps a
denormalised minimum price for listing pages.
Edits keep existing variant rows where possible, so stock and order references stay stable. Structural
edits are blocked while stock is held by an unconfirmed checkout.
03
Design decisions
+
Snapshot address and account details onto the shop at apply time, so later edits to the buyer profile do
not silently change the shop.
Two fixed variant axes instead of an open-ended axis table: simpler queries and admin UI, matching what
sellers actually need.
Uniqueness enforced by database constraints (one shop per account, unique slug), with application checks
in front.
All diagrams
Other views
Tap a table to see what it links to.
ACCOUNT
SELLER_STORE
STORE_LOCATION
OPENING_HOURS
ACCOUNT_DETAIL
CATEGORY
ATTRIBUTE_TEMPLATE
PRODUCT
VARIANT_AXIS
AXIS_VALUE
VARIANT
ATTRIBUTE_VALUE
ACCOUNTownsSELLER_STORE 1 → 0..1
SELLER_STOREhasSTORE_LOCATION 1 → many
STORE_LOCATIONhasOPENING_HOURS 1 → many
SELLER_STOREhasACCOUNT_DETAIL 1 → many
CATEGORYdefinesATTRIBUTE_TEMPLATE 1 → many
SELLER_STORElistsPRODUCT 1 → many
CATEGORYclassifiesPRODUCT 1 → many
PRODUCThasVARIANT_AXIS 1 → many
VARIANT_AXIShasAXIS_VALUE 1 → many
PRODUCThasVARIANT 1 → many
PRODUCThasATTRIBUTE_VALUE 1 → many
01
active→ suspended [moderation]
02
rejected→ pending [re-apply]
03
pending→ active [admin approves]→ rejected [admin rejects]