ER diagram for food delivery app

This ER diagram models the core database of a food delivery app: who orders, where they order from, what they order and who delivers it. It is a good starting point for students learning database design and for developers sketching the schema of a delivery or ordering platform.

ER diagram for food delivery app

Example: ER diagram for food delivery app: click to open it in the editor and change it.

Entities and Key Attributes

The model has six tables. Each one uses an INT id as its primary key.

EntityKey attributesForeign keys
customersid, name, phonenone
restaurantsid, name, city, rating (DECIMAL)none
menu_itemsid, name, price, is_veg (BOOLEAN)restaurant_id
ordersid, total, statuscustomer_id, restaurant_id, partner_id
order_itemsid, quantityorder_id, menu_item_id
delivery_partnersid, name, phone, vehiclenone

Relationships and Cardinality

  • restaurants 1 : N menu_items: a restaurant offers many dishes, and each dish belongs to one restaurant.
  • customers 1 : N orders: a customer can place many orders.
  • restaurants 1 : N orders: each order comes from a single restaurant.
  • delivery_partners 1 : N orders: a partner delivers many orders, and each order has one partner.
  • orders 1 : N order_items: one order contains many line items.
  • menu_items 1 : N order_items: a dish can appear in many orders.

order_items is a junction table. It resolves the many-to-many link between orders and menu_items and stores the quantity of each dish.

How to Adapt It for Your Project

  • Add an addresses table linked to customers if users save several delivery locations.
  • Add a payments table with order_id, method and payment status.
  • Store a unit price in order_items so old orders keep the price that was charged, even after the menu price changes.
  • Add timestamps such as created_at and delivered_at to orders for tracking and reports.
  • Add a reviews table if customers rate restaurants or partners, instead of storing only one rating value.

Tip: Make partner_id in orders nullable. A new order often has no delivery partner until someone accepts it, and a NOT NULL constraint would block saving it.

Frequently asked questions

What are the entities in an ER diagram for a food delivery app?

This diagram uses six entities: customers, restaurants, menu_items, orders, order_items and delivery_partners. Together they cover users, restaurant menus, orders with their line items, and delivery.

Why is there an order_items table?

An order can include many menu items, and a menu item can appear in many orders. The order_items table resolves this many-to-many relationship and records the quantity of each item.

How is the delivery partner linked to an order?

The orders table has a partner_id foreign key pointing to delivery_partners. This creates a one-to-many relationship: one partner can deliver many orders, and each order has one partner.

Make your own ER diagram with AI →

More templates

← All templates

Try AI Flowchart free →