Database ER Diagram — Reladraw template

电商 ER 图. Copy the source, paste into the official playground, done. No coordinates — every position is stated relative to something else.

Preview

users orders products order_items payments 1:N 1:N 1:N 1:N

Source (.reladraw)

node users "users"
node orders "orders"  right of users
node products "products"  right of orders
node items "order_items"  below orders
node pay "payments"  below products
edge users -> orders  "1:N"
edge orders -> items  "1:N"
edge products -> items  "1:N"
edge orders -> pay  "1:N"

How to use

  1. Open the Reladraw playground
  2. Paste the source above — the diagram re-solves live
  3. Export SVG from the playground, or render locally: npx reladraw er-database.reladraw -o out.svg

When to use this template

An entity-relationship diagram that fits the most common business shape: users place orders for products, orders contain line items. Use it to lock down schema design before migration, or to document an existing database for the next developer.

How to customize

  1. Add a category table. Add node cats "categories" above products and edge cats -> products "1:N".
  2. Show nullable relations. Change the label: edge orders -> pay "1:0..N" — labels are free text, so any cardinality notation works.
  3. Model a join table. Add node tags "order_tags" below items with two edges from orders and a new tags node.

FAQ

How do I draw an ER diagram in Reladraw?

Each table is a node, each foreign key is an edge, and cardinality goes in the edge label (1:N, N:1). Place the central table first, then hang others around it — the template on this page is a paste-ready example.

Can Reladraw show table columns and keys?

Keep column lists out of the diagram and put PK/FK hints in labels: order_id (PK), user_id (FK). Full column lists make any diagram unreadable — link a schema file instead.

How do I show many-to-many relationships?

Through the join table, same as your schema: draw a node for order_items and give it two 1:N edges. That is more honest than a direct N:M edge and matches what migration code does.

Related templates

Swimlane ProcessSystem LandscapeClass Diagram