All templates

ER Diagram Template

Design your database schema visually. Define tables, fields, and relationships between entities before writing a single line of SQL.

Use this template

What you get

  • Table blocks with field type annotations
  • PK / FK labels for quick reference
  • Relationship connectors between tables

What this template is for

This ER diagram template gives you a starting point for mapping the entities, attributes, and relationships in any relational database. Use it to design a schema before you write migrations, communicate a data model to stakeholders, or document an existing database for a new team member. An entity-relationship diagram makes foreign keys and join conditions visible at a glance — which is far faster than reading a schema dump or asking the person who built it.

When to use this template

  • Design a new application's database schema before writing the first migration.
  • Document an existing production database so new engineers can understand the data model.
  • Communicate a proposed schema change to a technical lead or architect for review.
  • Map the relationships between tables when debugging a slow query or missing join.
  • Plan a multi-tenant SaaS schema with tenant isolation boundaries drawn explicitly.
  • Model an e-commerce database with products, orders, customers, and inventory tables.

How to use it

  1. 1Identify the main entities — the things your system needs to store, such as User, Order, or Product.
  2. 2List the key attributes of each entity and mark the primary key.
  3. 3Draw a line between entities that are related; label the relationship verb (places, contains, belongs to).
  4. 4Add cardinality notation to each relationship: one-to-one, one-to-many, or many-to-many.
  5. 5For many-to-many relationships, add a junction table with its own primary key and foreign keys.

Quick example

E-commerce ER diagram

Customer (id, name, email)
| 1 places many |
Order (id, customer_id, created_at, status)
| 1 contains many |
OrderItem (id, order_id, product_id, quantity, price)
| many refers to 1 |
Product (id, name, price, stock)

Start editing online

Open the template in CodePic, replace the sample nodes, and turn it into your own study board in a few minutes.

See examples: /templates/erd/examples

More templates you might like