ER Diagramdatabaseerecommerce

User Order ER Diagram

Start a Mermaid ER diagram for ecommerce or SaaS billing data with users, orders, products, line items, and payments.

Use Cases

Draft a commerce database model
Explain order ownership and payment relationships
Review schema boundaries before adding migrations
Align product, finance, and engineering teams on how purchases are represented

How This Workflow Works

StepPurpose
User entityRepresents the account or customer record that owns orders and identifies the buyer.
Order entityStores purchase-level status, totals, timestamps, and the relationship back to the user.
Line itemsBreak each order into purchased products, quantities, and per-item commercial details.
Product entityDefines the catalog item referenced by line items so product data is not duplicated.
Payment entityTracks provider, payment status, and payment identifiers separately from order contents.

How To Customize

Add fields that match your database column names
Replace payment status values with your billing workflow
Extend the model with subscriptions, invoices, or refunds
Change cardinality markers when your product supports guest checkout or split payments
Add indexes, external IDs, or audit fields before turning the diagram into migrations

Edit This Template Visually

Open this template in the editor to work from the rendered diagram and the Mermaid source together. Click a node in supported flowchart and sequence diagrams to locate the matching code, select source lines to find the related shape, or ask AI to rename, expand, restyle, or rewrite the selected part of the workflow.

Mermaid Source

erDiagram
    USER ||--o{ ORDER : places
    ORDER ||--|{ LINE_ITEM : contains
    PRODUCT ||--o{ LINE_ITEM : appears_in
    ORDER ||--o| PAYMENT : paid_by

    USER {
      string id
      string email
      datetime created_at
    }
    ORDER {
      string id
      string user_id
      string status
      decimal total
    }
    LINE_ITEM {
      string order_id
      string product_id
      int quantity
    }
    PRODUCT {
      string id
      string name
      decimal price
    }
    PAYMENT {
      string id
      string provider
      string status
    }