FlowDiagram
Database & ER modelsSQL DDL

Food delivery app schema template

Restaurants, menus, customers, orders, couriers and delivery tracking for a DoorDash-style app. This data model has 9 tables and 39 columns, joined by 10 relationships. FlowDiagram draws it as an entity-relationship diagram with crow's-foot notation.

Open in the editor →
  • Free — no account, no trial, no watermark
  • Fully editable shapes and connectors, not a screenshot
  • Export PNG, SVG or PDF, or share it as a link
  • Private: the diagram never leaves your browser

Tables in this data model

  • restaurants — 4 columns
  • menu_items — 5 columns
  • customers — 3 columns
  • addresses — 5 columns
  • couriers — 3 columns
  • orders — 7 columns
  • order_items — 4 columns
  • delivery_events — 4 columns
  • ratings — 4 columns

How to use this ER diagram template

  1. Click Open in the editor. The ER diagram opens on a new page in FlowDiagram — nothing is uploaded and there is no sign-up.
  2. Rename, add or delete shapes and drag them where you want; connectors stay attached as things move.
  3. Drop in vendor logos from the library — 1,160 of them, including every AWS, Azure and Google Cloud service icon — or restyle it with the colour and theme controls.
  4. Prefer text? Edit the SQL DDL below and paste it in through ☰ → Import / export SQL; the finished model exports back to DDL.
  5. Export to PNG, SVG or PDF, or press Ctrl+L for a link that carries the whole diagram.

SQL DDL source

The whole template is the text below. Paste it into FlowDiagram, keep it in Git next to the code it describes, or hand it to an AI assistant to extend.

CREATE TABLE restaurants (
  restaurant_id INTEGER      NOT NULL PRIMARY KEY,
  name          VARCHAR(150) NOT NULL,
  cuisine       VARCHAR(60),
  is_open       BOOLEAN      NOT NULL
);

CREATE TABLE menu_items (
  item_id       INTEGER       NOT NULL PRIMARY KEY,
  restaurant_id INTEGER       NOT NULL REFERENCES restaurants(restaurant_id),
  name          VARCHAR(150)  NOT NULL,
  price         DECIMAL(8,2)  NOT NULL,
  available     BOOLEAN       NOT NULL
);

CREATE TABLE customers (
  customer_id INTEGER      NOT NULL PRIMARY KEY,
  name        VARCHAR(150) NOT NULL,
  phone       VARCHAR(30)
);

CREATE TABLE addresses (
  address_id  INTEGER      NOT NULL PRIMARY KEY,
  customer_id INTEGER      NOT NULL REFERENCES customers(customer_id),
  line1       VARCHAR(200) NOT NULL,
  lat         DECIMAL(9,6),
  lng         DECIMAL(9,6)
);

CREATE TABLE couriers (
  courier_id INTEGER      NOT NULL PRIMARY KEY,
  name       VARCHAR(150) NOT NULL,
  vehicle    VARCHAR(20)
);

CREATE TABLE orders (
  order_id      INTEGER       NOT NULL PRIMARY KEY,
  customer_id   INTEGER       NOT NULL REFERENCES customers(customer_id),
  restaurant_id INTEGER       NOT NULL REFERENCES restaurants(restaurant_id),
  address_id    INTEGER       NOT NULL REFERENCES addresses(address_id),
  courier_id    INTEGER       REFERENCES couriers(courier_id),
  status        VARCHAR(20)   NOT NULL,
  total         DECIMAL(10,2) NOT NULL
);

CREATE TABLE order_items (
  order_item_id INTEGER NOT NULL PRIMARY KEY,
  order_id      INTEGER NOT NULL REFERENCES orders(order_id),
  item_id       INTEGER NOT NULL REFERENCES menu_items(item_id),
  quantity      INTEGER NOT NULL
);

CREATE TABLE delivery_events (
  event_id    INTEGER     NOT NULL PRIMARY KEY,
  order_id    INTEGER     NOT NULL REFERENCES orders(order_id),
  status      VARCHAR(30) NOT NULL,
  occurred_at TIMESTAMP   NOT NULL
);

CREATE TABLE ratings (
  rating_id INTEGER NOT NULL PRIMARY KEY,
  order_id  INTEGER NOT NULL REFERENCES orders(order_id),
  food_stars INTEGER,
  courier_stars INTEGER
);

Related: Database schema diagram tool · ER diagram from SQL · All database & er models templates · All 521 templates