Food Delivery ER diagram and database schema
The Food Delivery database schema is a DB Planner template with 29 tables, 269 columns and 49 relationships, free to use. Core tables include courier_earnings, courier_payouts, courier_shifts, couriers. It can be opened as an interactive ER diagram or exported as PostgreSQL, MySQL, or SQL Server DDL.
- Tables
- 29
- Columns
- 269
- Relationships
- 49
- Category
- Logistics
- Exports
- DBML, SQL, C#
- Price
- Free
What this schema models
A complete food delivery app database design for a three-sided marketplace of customers, restaurants and couriers: 29 tables, 22 enums and 49 relationships covering menus with dayparts and modifier groups, restaurants, opening hours and delivery zones with fee schedules, customers and saved addresses, orders with snapshotted lines, promotions and ratings, courier offers, deliveries and tracking events, courier shifts, and payments, refunds and payouts to restaurants and couriers. THE FOUR DESIGN RULES 1. Order lines are snapshots. Order items copy the item name and price, and their modifiers copy the group name, option name and price delta, so editing or deleting a menu item never changes a past order, kitchen ticket or receipt; the menu foreign keys remain for reporting only. Fees, the commission rate and the delivery address are copied onto the order the same way. 2. The order is not the delivery. The order belongs to the customer and the restaurant; a delivery is a courier assignment created from an accepted delivery offer. A courier who drops the job leaves an unassigned row and a new delivery is created, with a partial unique index allowing only one live delivery per order. Pickup orders never get a delivery at all. 3. Three sides, three ledgers. The customer side is payments and refunds; the restaurant side is ledger entries (food sales, minus commission, minus restaurant-funded promotions and refund chargebacks); the courier side is earnings by component. Each sweeps into its own payouts, and delivery fees and tips never touch the restaurant ledger. 4. Modifier groups are reusable and carry their own rules. "Choose a size" or "Add toppings" is defined once with minimum, maximum and free selections, then attached to many items through a join table. Items are placed into menu categories the same way, so one item can sit on the breakfast and the all-day menu at one price. DETAILS WORTH STEALING - Refunds record the party at fault (restaurant, courier, platform or customer), which decides who absorbs the cost; a restaurant-fault refund is charged back on its ledger. - Promotions record who funds them (platform, restaurant or shared, with the restaurant share), because that decides whose ledger the discount hits. - Ratings are split by subject, so a cold meal from a slow courier is not held against the kitchen. - Orders carry a timestamp for each milestone (placed, accepted, ready, completed, cancelled), so prep time and total wait are plain subtractions. - Opening hours allow split lunch and dinner services and shifts that run past midnight, and menus have their own time-of-day windows. - Alcohol items require an ID check at handoff: only age-verified couriers can take them, and the check is logged as a tracking event. WHAT YOU GET Clean DBML that imports directly into DB Planner, and a laid-out board with zones color-coded and framed: menus, restaurants and delivery zones, customers, orders, delivery, couriers, and money. Every table carries a note. Postgres-flavoured types, with PostGIS geography columns for locations and zones; the rest ports cleanly to MySQL or SQL Server. Useful for developers building a food delivery or online ordering marketplace, and for students who need a realistic food delivery app ER diagram for a DBMS project. This is a schema design reference; tax, tipping and courier classification rules vary by market and belong in your own business logic.
Tables (29)
| Table | Columns |
|---|---|
| courier_earnings | 8 |
| courier_payouts | 11 |
| courier_shifts | 10 |
| couriers | 13 |
| customer_addresses | 11 |
| customers | 7 |
| deliveries | 14 |
| delivery_events | 6 |
| delivery_offers | 10 |
| delivery_zones | 13 |
| menu_categories | 4 |
| menu_category_items | 3 |
| menu_item_modifier_groups | 3 |
| menu_items | 9 |
| menus | 6 |
| modifier_groups | 6 |
| modifier_options | 7 |
| order_item_modifiers | 7 |
| order_items | 9 |
| orders | 27 |
| payment_methods | 8 |
| payments | 11 |
| promotions | 12 |
| ratings | 7 |
| refunds | 10 |
| restaurant_hours | 4 |
| restaurant_ledger_entries | 9 |
| restaurant_payouts | 9 |
| restaurants | 15 |
Relationships (49)
courier_earnings.courier_id references couriers.idmany to onecourier_earnings.courier_payout_id references courier_payouts.idmany to onecourier_earnings.delivery_id references deliveries.idmany to onecourier_payouts.courier_id references couriers.idmany to onecourier_shifts.courier_id references couriers.idmany to onecourier_shifts.delivery_zone_id references delivery_zones.idmany to onecouriers.home_zone_id references delivery_zones.idmany to onecustomer_addresses.customer_id references customers.idmany to onedeliveries.courier_id references couriers.idmany to onedeliveries.courier_shift_id references courier_shifts.idmany to onedeliveries.order_id references orders.idmany to onedelivery_events.delivery_id references deliveries.idmany to onedelivery_offers.courier_id references couriers.idmany to onedelivery_offers.id references deliveries.delivery_offer_idone to onedelivery_offers.order_id references orders.idmany to onemenu_categories.menu_id references menus.idmany to onemenu_category_items.menu_category_id references menu_categories.idmany to onemenu_category_items.menu_item_id references menu_items.idmany to onemenu_item_modifier_groups.menu_item_id references menu_items.idmany to onemenu_item_modifier_groups.modifier_group_id references modifier_groups.idmany to onemenu_items.restaurant_id references restaurants.idmany to onemenus.restaurant_id references restaurants.idmany to onemodifier_groups.restaurant_id references restaurants.idmany to onemodifier_options.modifier_group_id references modifier_groups.idmany to oneorder_item_modifiers.modifier_option_id references modifier_options.idmany to oneorder_item_modifiers.order_item_id references order_items.idmany to oneorder_items.menu_item_id references menu_items.idmany to oneorder_items.order_id references orders.idmany to oneorders.customer_address_id references customer_addresses.idmany to oneorders.customer_id references customers.idmany to oneorders.promotion_id references promotions.idmany to oneorders.restaurant_id references restaurants.idmany to onepayment_methods.customer_id references customers.idmany to onepayments.order_id references orders.idmany to onepayments.parent_payment_id references payments.idmany to onepayments.payment_method_id references payment_methods.idmany to onepromotions.restaurant_id references restaurants.idmany to oneratings.courier_id references couriers.idmany to oneratings.order_id references orders.idmany to onerefunds.order_id references orders.idmany to onerefunds.order_item_id references order_items.idmany to onerefunds.payment_id references payments.idmany to onerestaurant_hours.restaurant_id references restaurants.idmany to onerestaurant_ledger_entries.order_id references orders.idmany to onerestaurant_ledger_entries.refund_id references refunds.idmany to onerestaurant_ledger_entries.restaurant_id references restaurants.idmany to onerestaurant_ledger_entries.restaurant_payout_id references restaurant_payouts.idmany to onerestaurant_payouts.restaurant_id references restaurants.idmany to onerestaurants.delivery_zone_id references delivery_zones.idmany to one
How to use this template
- Open the ER diagram to see the tables and how they relate.
- Copy it into your workspace. You get your own editable copy, in DBML.
- Export it as PostgreSQL, MySQL, or SQL Server DDL, or as C# models.
The copy opens in DB Planner’s ER diagram tool, with the schema as text in the DBML editor beside it. Have a database already? Turn its SQL into an ER diagram instead.
Frequently asked questions
- What is in the Food Delivery database schema?
- 29 tables and 49 relationships, across 269 columns. The table names and the full relationship list are shown on this page.
- Can I export it to PostgreSQL or MySQL?
- Yes. Every DB Planner template exports as DBML, as PostgreSQL, MySQL, or SQL Server DDL, and as C# models.
- Is this template free?
- Yes. You can open it in the browser without an account, and copy it into your own workspace with a free DB Planner account.
- Can I change it after copying it?
- Yes. A copy is yours: you can rename tables, add columns, and export it. Changes the author makes later do not affect your copy.