# sheetalnagar16/inventory-app architecture

> Architecture diagram of the GitHub repository sheetalnagar16/inventory-app, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-16). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/sheetalnagar16/inventory-app
- Repository: https://github.com/sheetalnagar16/inventory-app

## Overview

This is a full-stack inventory and order management system. A user works through the React dashboard or product, customer, and order pages; those pages call the shared HTTP client, which sends requests to FastAPI routes that validate business rules and read or update PostgreSQL-backed records. Order creation checks customers and stock, calculates totals, and deducts inventory; cancellation restores it. The dashboard summarizes counts and low-stock products. The route handlers, ORM models, schemas, and database connection are shown as distinct backend layers. Some connections are documented in the README; unsampled database configuration details are not inferred.

Main entry points: [`frontend/src/api.js`](https://github.com/sheetalnagar16/inventory-app/blob/main/frontend/src/api.js) (API client), [`backend/database.py`](https://github.com/sheetalnagar16/inventory-app/blob/main/backend/database.py) (DB connection), [`frontend/src/App.js`](https://github.com/sheetalnagar16/inventory-app/blob/main/frontend/src/App.js) (App routing), [`backend/models.py`](https://github.com/sheetalnagar16/inventory-app/blob/main/backend/models.py) (ORM entities)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_frontend["Web interface"]
  node_app["App routing<br/>[App.js]"]
  node_dashboard["Dashboard<br/>[Dashboard.jsx]"]
  node_products_ui["Products UI<br/>[Products.jsx]"]
  node_customers_ui["Customers UI<br/>[Customers.jsx]"]
  node_orders_ui["Orders UI<br/>[Orders.jsx]"]
  node_api_client["API client<br/>[api.js]"]
end

subgraph group_backend["API and domain"]
  node_product_routes["Product routes<br/>[main.py]"]
  node_customer_routes["Customer routes<br/>[main.py]"]
  node_order_routes["Order routes<br/>[main.py]"]
  node_dashboard_route["Dashboard route<br/>[main.py]"]
  node_schemas["Request schemas<br/>[schemas.py]"]
end

subgraph group_persistence["Persistence"]
  node_orm_models["ORM entities<br/>[models.py]"]
  node_db_connection["DB connection<br/>[database.py]"]
  node_postgres[("PostgreSQL")]
end

node_user(("User"))

node_user -->|"uses"| node_app
node_app -->|"routes to"| node_dashboard
node_app -->|"routes to"| node_products_ui
node_app -->|"routes to"| node_customers_ui
node_app -->|"routes to"| node_orders_ui
node_dashboard -->|"requests summary"| node_api_client
node_products_ui -->|"requests products"| node_api_client
node_customers_ui -->|"requests customers"| node_api_client
node_orders_ui -->|"requests orders"| node_api_client
node_api_client -->|"calls endpoints"| node_product_routes
node_api_client -->|"calls endpoints"| node_customer_routes
node_api_client -->|"calls endpoints"| node_order_routes
node_api_client -->|"calls endpoint"| node_dashboard_route
node_product_routes -->|"validates and shapes"| node_schemas
node_customer_routes -->|"validates and shapes"| node_schemas
node_order_routes -->|"validates and shapes"| node_schemas
node_product_routes -->|"queries and updates"| node_orm_models
node_customer_routes -->|"queries and updates"| node_orm_models
node_order_routes -->|"checks and updates"| node_orm_models
node_dashboard_route -->|"counts and filters"| node_orm_models
node_product_routes -->|"uses session"| node_db_connection
node_customer_routes -->|"uses session"| node_db_connection
node_order_routes -->|"uses session"| node_db_connection
node_dashboard_route -->|"uses session"| node_db_connection
node_orm_models -->|"imports base"| node_db_connection
node_db_connection -.->|"connects to"| node_postgres

click node_app "https://github.com/sheetalnagar16/inventory-app/blob/main/frontend/src/App.js"
click node_dashboard "https://github.com/sheetalnagar16/inventory-app/blob/main/frontend/src/pages/Dashboard.jsx"
click node_products_ui "https://github.com/sheetalnagar16/inventory-app/blob/main/frontend/src/pages/Products.jsx"
click node_customers_ui "https://github.com/sheetalnagar16/inventory-app/blob/main/frontend/src/pages/Customers.jsx"
click node_orders_ui "https://github.com/sheetalnagar16/inventory-app/blob/main/frontend/src/pages/Orders.jsx"
click node_api_client "https://github.com/sheetalnagar16/inventory-app/blob/main/frontend/src/api.js"
click node_product_routes "https://github.com/sheetalnagar16/inventory-app/blob/main/backend/main.py"
click node_customer_routes "https://github.com/sheetalnagar16/inventory-app/blob/main/backend/main.py"
click node_order_routes "https://github.com/sheetalnagar16/inventory-app/blob/main/backend/main.py"
click node_dashboard_route "https://github.com/sheetalnagar16/inventory-app/blob/main/backend/main.py"
click node_schemas "https://github.com/sheetalnagar16/inventory-app/blob/main/backend/schemas.py"
click node_orm_models "https://github.com/sheetalnagar16/inventory-app/blob/main/backend/models.py"
click node_db_connection "https://github.com/sheetalnagar16/inventory-app/blob/main/backend/database.py"

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_app,node_dashboard,node_products_ui,node_customers_ui,node_orders_ui,node_api_client,node_user toneBlue
class node_product_routes,node_customer_routes,node_order_routes,node_dashboard_route,node_schemas toneAmber
class node_orm_models,node_db_connection,node_postgres toneMint
```

## Components

### Web interface

- [App routing](https://github.com/sheetalnagar16/inventory-app/blob/main/frontend/src/App.js): `frontend/src/App.js`
- [Dashboard](https://github.com/sheetalnagar16/inventory-app/blob/main/frontend/src/pages/Dashboard.jsx): `frontend/src/pages/Dashboard.jsx`
- [Products UI](https://github.com/sheetalnagar16/inventory-app/blob/main/frontend/src/pages/Products.jsx): `frontend/src/pages/Products.jsx`
- [Customers UI](https://github.com/sheetalnagar16/inventory-app/blob/main/frontend/src/pages/Customers.jsx): `frontend/src/pages/Customers.jsx`
- [Orders UI](https://github.com/sheetalnagar16/inventory-app/blob/main/frontend/src/pages/Orders.jsx): `frontend/src/pages/Orders.jsx`
- [API client](https://github.com/sheetalnagar16/inventory-app/blob/main/frontend/src/api.js): `frontend/src/api.js`

### API and domain

- [Product routes](https://github.com/sheetalnagar16/inventory-app/blob/main/backend/main.py): `backend/main.py`
- [Customer routes](https://github.com/sheetalnagar16/inventory-app/blob/main/backend/main.py): `backend/main.py`
- [Order routes](https://github.com/sheetalnagar16/inventory-app/blob/main/backend/main.py): `backend/main.py`
- [Dashboard route](https://github.com/sheetalnagar16/inventory-app/blob/main/backend/main.py): `backend/main.py`
- [Request schemas](https://github.com/sheetalnagar16/inventory-app/blob/main/backend/schemas.py): `backend/schemas.py`

### Persistence

- [ORM entities](https://github.com/sheetalnagar16/inventory-app/blob/main/backend/models.py): `backend/models.py`
- [DB connection](https://github.com/sheetalnagar16/inventory-app/blob/main/backend/database.py): `backend/database.py`
- **PostgreSQL**

### Other components

- **User**

## Connections

- User → App routing: uses
- App routing → Dashboard: routes to (evidence: `frontend/src/App.js`)
- App routing → Products UI: routes to (evidence: `frontend/src/App.js`)
- App routing → Customers UI: routes to (evidence: `frontend/src/App.js`)
- App routing → Orders UI: routes to (evidence: `frontend/src/App.js`)
- Dashboard → API client: requests summary (evidence: `frontend/src/pages/Dashboard.jsx`)
- Products UI → API client: requests products (evidence: `frontend/src/pages/Products.jsx`)
- Customers UI → API client: requests customers (evidence: `frontend/src/pages/Customers.jsx`)
- Orders UI → API client: requests orders (evidence: `frontend/src/pages/Orders.jsx`)
- API client → Product routes: calls endpoints (evidence: `frontend/src/api.js`)
- API client → Customer routes: calls endpoints (evidence: `frontend/src/api.js`)
- API client → Order routes: calls endpoints (evidence: `frontend/src/api.js`)
- API client → Dashboard route: calls endpoint (evidence: `frontend/src/api.js`)
- Product routes → Request schemas: validates and shapes (evidence: `backend/main.py`)
- Customer routes → Request schemas: validates and shapes (evidence: `backend/main.py`)
- Order routes → Request schemas: validates and shapes (evidence: `backend/main.py`)
- Product routes → ORM entities: queries and updates (evidence: `backend/main.py`)
- Customer routes → ORM entities: queries and updates (evidence: `backend/main.py`)
- Order routes → ORM entities: checks and updates (evidence: `backend/main.py`)
- Dashboard route → ORM entities: counts and filters (evidence: `backend/main.py`)
- Product routes → DB connection: uses session (evidence: `backend/main.py`)
- Customer routes → DB connection: uses session (evidence: `backend/main.py`)
- Order routes → DB connection: uses session (evidence: `backend/main.py`)
- Dashboard route → DB connection: uses session (evidence: `backend/main.py`)
- ORM entities → DB connection: imports base (evidence: `backend/models.py`)
- DB connection → PostgreSQL: connects to (evidence: `README.md`)
