When to use it
Use it for a database course project, a capstone ordering app, or data modeling for any marketplace with customers, sellers and orders. It shows the two points examiners ask about most: orders and menu items are linked through order items, and each order item stores the unit price at purchase so later price changes do not alter past orders.
Make it yours
- For coupons, payments and refunds, add an entity for each and connect it to the order.
- Dine-in ordering has no delivery: remove courier and address and add a table entity.
- Rename fields to match your naming convention so they map straight to table definitions.
Mermaid code
erDiagram
CUSTOMER ||--o{ ADDRESS : saves
CUSTOMER ||--o{ ORDER : places
RESTAURANT ||--o{ MENU_ITEM : lists
RESTAURANT ||--o{ ORDER : receives
ORDER ||--|{ ORDER_ITEM : contains
MENU_ITEM ||--o{ ORDER_ITEM : appears_in
COURIER ||--o{ ORDER : delivers
ORDER ||--o| REVIEW : gets
CUSTOMER {
string customer_id PK
string name
string phone
}
ADDRESS {
string address_id PK
string customer_id FK
string street
}
RESTAURANT {
string restaurant_id PK
string name
string status
}
MENU_ITEM {
string item_id PK
string restaurant_id FK
string name
decimal price
}
ORDER {
string order_id PK
string customer_id FK
string restaurant_id FK
string courier_id FK
decimal total_paid
string status
}
ORDER_ITEM {
string order_id FK
string item_id FK
int quantity
decimal unit_price
}
COURIER {
string courier_id PK
string name
string phone
}
REVIEW {
string review_id PK
string order_id FK
int rating
string comment
}Ask an AI for one with this structure
Send the prompt below to ChatGPT or Claude, then paste the whole reply into the editor; the code inside is detected automatically.
Draw a food delivery app ER diagram with Mermaid erDiagram syntax. Entities are CUSTOMER, ADDRESS, RESTAURANT, MENU_ITEM, ORDER, ORDER_ITEM, COURIER and REVIEW. Customer to address, customer to order, restaurant to menu item, restaurant to order, courier to order, and menu item to order item are one to many. Order to order item is one to one or more, and order to review is one to zero or one. Order items store quantity and unit price. List three to six fields per entity and mark PK and FK. Output only the mermaid code block.
FAQ
- Why store the unit price again on the order item?
Menu prices change. An order is a historical record and must keep the price at the time of purchase, or later reconciliation will be wrong.
- What is the difference between ||--|{ and ||--o{?
The first is one to one or more and the second is one to zero or more. An order has at least one item, so it uses the first.
- The diagram is large with this many entities.
Split it by module, such as customers and addresses, restaurants and menus, orders and delivery, and keep the linking entities on each diagram.
More in this category
Updated 2026-11-11