
π Retail & E-commerce Β· Database ERD
A flexible product catalog: categories, products with variants (size, colour), prices, stock per warehouse and images.
Drawing diagramβ¦
ERD for an e-commerce catalog: Category (with parent category), Product in a Category, Brand, ProductVariant (SKU) with attributes like size and colour, Price per variant with sale price, Inventory per variant per Warehouse, and ProductImage.
erDiagram
CATEGORY ||--o{ CATEGORY : "parent of"
CATEGORY ||--o{ PRODUCT : contains
BRAND ||--o{ PRODUCT : makes
PRODUCT ||--|{ PRODUCT_VARIANT : "sold as"
PRODUCT ||--o{ PRODUCT_IMAGE : shows
PRODUCT_VARIANT ||--|| PRICE : "priced at"
PRODUCT_VARIANT ||--o{ INVENTORY : stocked
WAREHOUSE ||--o{ INVENTORY : holds
PRODUCT {
int id PK
int category_id FK
int brand_id FK
string title
}
PRODUCT_VARIANT {
int id PK
int product_id FK
string sku
string size
string colour
}
PRICE {
int variant_id FK
decimal mrp
decimal sale_price
}
INVENTORY {
int variant_id FK
int warehouse_id FK
int quantity
}An online store split into microservices: catalog, cart, orders, payments and search, with Kafka events connecting them to shipping and notifications.
What happens when a shopper clicks Pay: stock is reserved, the payment is authorised, the order is created and stock is released again if payment fails.
Every status an online order moves through, from placed to delivered, including cancellations, returns and refunds.
How stock stays in sync across stores, warehouses and marketplaces so the same item isn't sold twice.
How an online store handles a return: eligibility, pickup, quality check at the warehouse and the refund or replacement.
How an online store builds 'recommended for you' and 'frequently bought together': click and order data, model training and a fast serving layer.