‹ All templates
COMMERCE TEMPLATE

E-commerce

From product discovery to the final checkout. A practical foundation for your next storefront.

6 tables5 relationships4 SQL dialects
Use this template

A practical foundation, ready to adapt

This template models the core entities of a e-commerce system. It gives each entity an integer primary key and connects related records with explicit foreign keys. Open it in the designer to adjust names, add fields, and choose the rules that fit your application.

What’s included

users

id (integer), email (varchar), full_name (varchar), password_hash (text), created_at (timestamp).

orders

id (integer), user_id (integer), status (varchar), total (decimal), created_at (timestamp).

order_items

id (integer), order_id (integer), product_id (integer), quantity (integer), unit_price (decimal).

categories

id (integer), name (varchar), slug (varchar).

products

id (integer), category_id (integer), name (varchar), description (text), price (decimal), stock_quantity (integer).

payments

id (integer), order_id (integer), amount (decimal), payment_method (varchar), paid_at (timestamp).

Before you build

Review nullability, uniqueness, indexes, and deletion rules for your use case. This is a starting schema, not a complete application. It does not include application logic, authorization, or migrations. Monetary fields use decimal values; timestamps and authentication fields still need appropriate handling in your application.

Keep a JSON backup as you customize the project. Then select your SQL dialect, resolve any validation issues, and review the generated statements before running them.

Learn how relationships work or explore primary keys and constraints.