Design Schema For Amazon
Design Schema For Amazon
Designing a schema for Amazon or a similar large-scale e-commerce platform involves modeling
core entities such as users, products, orders, payments, and more, with careful attention to
relationships, scalability, and performance. Below is a robust, normalized relational schema
suitable for an Amazon-like system, with explanations for each major table.
Users
users
user_id (Primary Key)
name
password_hash
phone_number
created_at
last_login_at
Addresses
addresses
address_id (Primary Key)
user_id (Foreign Key)
street
city
state
postal_code
country
is_default (boolean)
User to Addresses is a one-to-many relationship: one user can have multiple addresses [1] [2] .
Categories
categories
category_id (Primary Key)
category_name
Products
products
product_id (Primary Key)
category_id (Foreign Key)
name
description
brand
created_at
updated_at
Product to Category is a many-to-many relationship, often managed via a join table if products
can belong to multiple categories [1] [3] .
quantity
is_active
is_main
Wishlist
wishlists
wishlist_id (Primary Key)
user_id (Foreign Key)
product_id (Foreign Key)
created_at
Carts
carts
cart_id (Primary Key)
user_id (Foreign Key)
created_at
updated_at
cart_items
cart_item_id (Primary Key)
cart_id (Foreign Key)
sku_id (Foreign Key)
quantity
added_at
Orders
orders
order_id (Primary Key)
user_id (Foreign Key)
address_id (Foreign Key)
order_date
order_items
order_item_id (Primary Key)
order_id (Foreign Key)
sku_id (Foreign Key)
quantity
price_at_purchase
discount
Payments
payments
payment_id (Primary Key)
order_id (Foreign Key)
amount
payment_method
transaction_id
status
payment_date
Shipments
shipments
shipment_id (Primary Key)
order_id (Foreign Key)
carrier
tracking_number
shipped_date
delivered_date
status
Summary Table
Table Key Columns Relationships Purpose
SKU-specific images
sku_images image_id, sku_id skus
(optional)
wishlist_id, user_id,
wishlists users, products Saved for later
product_id
cart_item_id, cart_id,
cart_items carts, skus Items in cart
sku_id
order_id, user_id,
orders users, addresses Customer orders
address_id
order_item_id, order_id,
order_items orders, skus Items in order
sku_id
Additional Notes
Normalization: The schema is normalized up to the third normal form (3NF) to ensure data
integrity and consistency [2] [4] .
Scalability: For very large-scale systems like Amazon, consider using NoSQL databases
(e.g., DynamoDB, MongoDB) for high-velocity or unstructured data, and relational
databases for transactional data [5] [6] .
Extensibility: The schema can be extended with additional tables for reviews, ratings,
returns, vendors, and more as needed [3] .
This schema serves as a robust foundation for an Amazon-like e-commerce platform, supporting
user management, product catalog, shopping cart, order processing, payments, and
shipments [2] [3] .
⁂
1. https://dev.to/ezzdinatef/ecommerce-database-design-1ggc
2. https://vertabelo.com/blog/er-diagram-for-online-shop/
3. https://www.linkedin.com/pulse/designing-robust-database-schema-e-commerce-shirsh-sinha-7orsc
4. https://github.com/marymathews/amazon-database-design
5. https://www.codekarle.com/system-design/Amazon-system-design.html
6. https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/data-modeling-schemas.html