# africandillinger/ecommerce-db-schema-design architecture

> Architecture diagram of the GitHub repository africandillinger/ecommerce-db-schema-design, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-25). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/africandillinger/ecommerce-db-schema-design
- Repository: https://github.com/africandillinger/ecommerce-db-schema-design

## Overview

This repository is a PostgreSQL learning project: it documents normalizing a flat e-commerce dataset into related tables, then practicing queries against that data. The visible files support a migration script and four table definitions; README-described five-level query practice is represented at the existing `sql` directory because its query files are absent from the supplied tree. The schema and data-flow links follow the README and filenames; SQL contents were not available to verify implementation details.

Main entry points: [`migrate_data.sql`](https://github.com/africandillinger/ecommerce-db-schema-design/blob/main/migrate_data.sql) (Data migration), [`orders.sql`](https://github.com/africandillinger/ecommerce-db-schema-design/blob/main/orders.sql) (Orders), [`order_items.sql`](https://github.com/africandillinger/ecommerce-db-schema-design/blob/main/order_items.sql) (Order items), [`sql/schema/customers.sql`](https://github.com/africandillinger/ecommerce-db-schema-design/blob/main/sql/schema/customers.sql) (Customers)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_model["Relational model"]
  node_customers[("Customers<br/>[customers.sql]")]
  node_orders[("Orders<br/>[orders.sql]")]
  node_items[("Order items<br/>[order_items.sql]")]
  node_products[("Products<br/>[products.sql]")]
end

subgraph group_workflow["Data workflow"]
  node_flatdata["Flat dataset"]
  node_migration["Data migration<br/>[migrate_data.sql]"]
  node_postgres[("PostgreSQL")]
end

subgraph group_practice["SQL practice"]
  node_queries["Query practice"]
end

node_analyst(("Analyst"))

node_flatdata -->|"transforms"| node_migration
node_migration -->|"writes"| node_customers
node_migration -->|"writes"| node_orders
node_migration -->|"writes"| node_items
node_migration -->|"writes"| node_products
node_customers -->|"customer FK"| node_orders
node_orders -->|"order FK"| node_items
node_products -->|"product FK"| node_items
node_analyst -->|"runs queries"| node_queries
node_queries -->|"queries"| node_postgres

click node_migration "https://github.com/africandillinger/ecommerce-db-schema-design/blob/main/migrate_data.sql"
click node_customers "https://github.com/africandillinger/ecommerce-db-schema-design/blob/main/sql/schema/customers.sql"
click node_orders "https://github.com/africandillinger/ecommerce-db-schema-design/blob/main/orders.sql"
click node_items "https://github.com/africandillinger/ecommerce-db-schema-design/blob/main/order_items.sql"
click node_products "https://github.com/africandillinger/ecommerce-db-schema-design/blob/main/products.sql"
click node_queries "https://github.com/africandillinger/ecommerce-db-schema-design/tree/main/sql"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_customers,node_orders,node_items,node_products toneBlue
class node_flatdata,node_migration,node_postgres toneAmber
class node_queries toneMint
class node_analyst toneIndigo
```

## Components

### Relational model

- [Customers](https://github.com/africandillinger/ecommerce-db-schema-design/blob/main/sql/schema/customers.sql): `sql/schema/customers.sql`
- [Orders](https://github.com/africandillinger/ecommerce-db-schema-design/blob/main/orders.sql): `orders.sql`
- [Order items](https://github.com/africandillinger/ecommerce-db-schema-design/blob/main/order_items.sql): `order_items.sql`
- [Products](https://github.com/africandillinger/ecommerce-db-schema-design/blob/main/products.sql): `products.sql`

### Data workflow

- **Flat dataset**
- [Data migration](https://github.com/africandillinger/ecommerce-db-schema-design/blob/main/migrate_data.sql): `migrate_data.sql`
- **PostgreSQL**

### SQL practice

- [Query practice](https://github.com/africandillinger/ecommerce-db-schema-design/tree/main/sql): `sql`

### Other components

- **Analyst**

## Connections

- Flat dataset → Data migration: transforms
- Data migration → Customers: writes
- Data migration → Orders: writes
- Data migration → Order items: writes
- Data migration → Products: writes
- Customers → Orders: customer FK
- Orders → Order items: order FK
- Products → Order items: product FK
- Analyst → Query practice: runs queries
- Query practice → PostgreSQL: queries
