# wafiur06/pharma-b2b-react-fastapi-postgres architecture

> Architecture diagram of the GitHub repository wafiur06/pharma-b2b-react-fastapi-postgres, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-27). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/wafiur06/pharma-b2b-react-fastapi-postgres
- Repository: https://github.com/wafiur06/pharma-b2b-react-fastapi-postgres

## Overview

This is a Pharma B2B procurement platform: pharmacy users browse a supplier catalog, build a cart, and check out into a master order split by supplier; the wider application also covers identity, organizations, inventory, invoices, returns, offers, support, and tracking. The frontend route map and backend router registration are visible, but most page-to-API wiring and unsampled router/service relationships are not, so those links are omitted. The sampled services show database-backed catalog, cart, inventory, organization, and order behavior.

Main entry points: [`backend/app/main.py`](https://github.com/wafiur06/pharma-b2b-react-fastapi-postgres/blob/main/backend/app/main.py) (FastAPI app), [`frontend/src/App.jsx`](https://github.com/wafiur06/pharma-b2b-react-fastapi-postgres/blob/main/frontend/src/App.jsx) (Web routes), [`backend/app/modules/auth/router.py`](https://github.com/wafiur06/pharma-b2b-react-fastapi-postgres/blob/main/backend/app/modules/auth/router.py) (Auth endpoints), [`backend/app/modules/orders/service.py`](https://github.com/wafiur06/pharma-b2b-react-fastapi-postgres/blob/main/backend/app/modules/orders/service.py) (Order service)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_frontend["Web application"]
  node_web_app["Web routes<br/>[App.jsx]"]
  node_layout["App layout<br/>[Layout.jsx]"]
  node_login_page["Login and signup<br/>[Login.jsx]"]
  node_dashboard_page["Dashboard<br/>[Dashboard.jsx]"]
  node_catalog_page["Catalog<br/>[Catalog.jsx]"]
  node_inventory_page["Inventory<br/>[Inventory.jsx]"]
  node_orders_page["Orders<br/>[Orders.jsx]"]
  node_service_pages["Service pages<br/>[Returns.jsx]"]
end

subgraph group_identity["Identity and organizations"]
  node_auth_router["Auth endpoints<br/>[router.py]"]
  node_auth_service["Auth service<br/>[service.py]"]
  node_users_router["User endpoints<br/>[router.py]"]
  node_organizations["Organizations<br/>[service.py]"]
end

subgraph group_procurement["Procurement"]
  node_catalog_service["Catalog service<br/>[service.py]"]
  node_cart_service["Cart service<br/>[service.py]"]
  node_orders_service["Order service<br/>[service.py]"]
end

subgraph group_operations["Operations and services"]
  node_inventory_service["Inventory service<br/>[service.py]"]
  node_client_services["Client services<br/>[router.py]"]
  node_invoices["Invoices<br/>[router.py]"]
end

subgraph group_runtime["API and persistence"]
  node_api_app["FastAPI app<br/>[main.py]"]
  node_database[("PostgreSQL")]
end

node_pharmacy_user(("Pharmacy user"))

node_pharmacy_user -->|"uses"| node_web_app
node_web_app -->|"routes"| node_login_page
node_web_app -->|"wraps pages"| node_layout
node_web_app -->|"routes"| node_dashboard_page
node_web_app -->|"routes"| node_catalog_page
node_web_app -->|"routes"| node_inventory_page
node_web_app -->|"routes"| node_orders_page
node_web_app -->|"routes"| node_service_pages
node_api_app -->|"registers"| node_auth_router
node_api_app -->|"registers"| node_users_router
node_api_app -->|"registers router"| node_organizations
node_api_app -->|"registers router"| node_catalog_service
node_api_app -->|"registers router"| node_cart_service
node_api_app -->|"registers router"| node_orders_service
node_api_app -->|"registers router"| node_inventory_service
node_api_app -->|"registers"| node_client_services
node_api_app -->|"registers"| node_invoices
node_auth_router -->|"calls"| node_auth_service
node_auth_router -->|"calls user service"| node_organizations
node_catalog_service -->|"reads and writes"| node_database
node_cart_service -->|"reads and writes"| node_database
node_orders_service -->|"reads and writes"| node_database
node_orders_service -->|"updates lots"| node_inventory_service
node_inventory_service -->|"reads and writes"| node_database
node_organizations -->|"reads and writes"| node_database
node_client_services -->|"reads and writes"| node_database
node_invoices -->|"uses"| node_database

click node_web_app "https://github.com/wafiur06/pharma-b2b-react-fastapi-postgres/blob/main/frontend/src/App.jsx"
click node_layout "https://github.com/wafiur06/pharma-b2b-react-fastapi-postgres/blob/main/frontend/src/components/Layout.jsx"
click node_login_page "https://github.com/wafiur06/pharma-b2b-react-fastapi-postgres/blob/main/frontend/src/pages/Login.jsx"
click node_dashboard_page "https://github.com/wafiur06/pharma-b2b-react-fastapi-postgres/blob/main/frontend/src/pages/Dashboard.jsx"
click node_catalog_page "https://github.com/wafiur06/pharma-b2b-react-fastapi-postgres/blob/main/frontend/src/pages/Catalog.jsx"
click node_inventory_page "https://github.com/wafiur06/pharma-b2b-react-fastapi-postgres/blob/main/frontend/src/pages/Inventory.jsx"
click node_orders_page "https://github.com/wafiur06/pharma-b2b-react-fastapi-postgres/blob/main/frontend/src/pages/Orders.jsx"
click node_service_pages "https://github.com/wafiur06/pharma-b2b-react-fastapi-postgres/blob/main/frontend/src/pages/Returns.jsx"
click node_auth_router "https://github.com/wafiur06/pharma-b2b-react-fastapi-postgres/blob/main/backend/app/modules/auth/router.py"
click node_auth_service "https://github.com/wafiur06/pharma-b2b-react-fastapi-postgres/blob/main/backend/app/modules/auth/service.py"
click node_users_router "https://github.com/wafiur06/pharma-b2b-react-fastapi-postgres/blob/main/backend/app/modules/users/router.py"
click node_organizations "https://github.com/wafiur06/pharma-b2b-react-fastapi-postgres/blob/main/backend/app/modules/organizations/service.py"
click node_catalog_service "https://github.com/wafiur06/pharma-b2b-react-fastapi-postgres/blob/main/backend/app/modules/catalog/service.py"
click node_cart_service "https://github.com/wafiur06/pharma-b2b-react-fastapi-postgres/blob/main/backend/app/modules/cart/service.py"
click node_orders_service "https://github.com/wafiur06/pharma-b2b-react-fastapi-postgres/blob/main/backend/app/modules/orders/service.py"
click node_inventory_service "https://github.com/wafiur06/pharma-b2b-react-fastapi-postgres/blob/main/backend/app/modules/inventory/service.py"
click node_client_services "https://github.com/wafiur06/pharma-b2b-react-fastapi-postgres/blob/main/backend/app/modules/client_services/router.py"
click node_invoices "https://github.com/wafiur06/pharma-b2b-react-fastapi-postgres/blob/main/backend/app/modules/invoices/router.py"
click node_api_app "https://github.com/wafiur06/pharma-b2b-react-fastapi-postgres/blob/main/backend/app/main.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_web_app,node_layout,node_login_page,node_dashboard_page,node_catalog_page,node_inventory_page,node_orders_page,node_service_pages,node_pharmacy_user toneBlue
class node_auth_router,node_auth_service,node_users_router,node_organizations toneAmber
class node_catalog_service,node_cart_service,node_orders_service toneMint
class node_inventory_service,node_client_services,node_invoices toneRose
class node_api_app,node_database toneIndigo
```

## Components

### Web application

- [Web routes](https://github.com/wafiur06/pharma-b2b-react-fastapi-postgres/blob/main/frontend/src/App.jsx): `frontend/src/App.jsx`
- [App layout](https://github.com/wafiur06/pharma-b2b-react-fastapi-postgres/blob/main/frontend/src/components/Layout.jsx): `frontend/src/components/Layout.jsx`
- [Login and signup](https://github.com/wafiur06/pharma-b2b-react-fastapi-postgres/blob/main/frontend/src/pages/Login.jsx): `frontend/src/pages/Login.jsx`
- [Dashboard](https://github.com/wafiur06/pharma-b2b-react-fastapi-postgres/blob/main/frontend/src/pages/Dashboard.jsx): `frontend/src/pages/Dashboard.jsx`
- [Catalog](https://github.com/wafiur06/pharma-b2b-react-fastapi-postgres/blob/main/frontend/src/pages/Catalog.jsx): `frontend/src/pages/Catalog.jsx`
- [Inventory](https://github.com/wafiur06/pharma-b2b-react-fastapi-postgres/blob/main/frontend/src/pages/Inventory.jsx): `frontend/src/pages/Inventory.jsx`
- [Orders](https://github.com/wafiur06/pharma-b2b-react-fastapi-postgres/blob/main/frontend/src/pages/Orders.jsx): `frontend/src/pages/Orders.jsx`
- [Service pages](https://github.com/wafiur06/pharma-b2b-react-fastapi-postgres/blob/main/frontend/src/pages/Returns.jsx): `frontend/src/pages/Returns.jsx`

### Identity and organizations

- [Auth endpoints](https://github.com/wafiur06/pharma-b2b-react-fastapi-postgres/blob/main/backend/app/modules/auth/router.py): `backend/app/modules/auth/router.py`
- [Auth service](https://github.com/wafiur06/pharma-b2b-react-fastapi-postgres/blob/main/backend/app/modules/auth/service.py): `backend/app/modules/auth/service.py`
- [User endpoints](https://github.com/wafiur06/pharma-b2b-react-fastapi-postgres/blob/main/backend/app/modules/users/router.py): `backend/app/modules/users/router.py`
- [Organizations](https://github.com/wafiur06/pharma-b2b-react-fastapi-postgres/blob/main/backend/app/modules/organizations/service.py): `backend/app/modules/organizations/service.py`

### Procurement

- [Catalog service](https://github.com/wafiur06/pharma-b2b-react-fastapi-postgres/blob/main/backend/app/modules/catalog/service.py): `backend/app/modules/catalog/service.py`
- [Cart service](https://github.com/wafiur06/pharma-b2b-react-fastapi-postgres/blob/main/backend/app/modules/cart/service.py): `backend/app/modules/cart/service.py`
- [Order service](https://github.com/wafiur06/pharma-b2b-react-fastapi-postgres/blob/main/backend/app/modules/orders/service.py): `backend/app/modules/orders/service.py`

### Operations and services

- [Inventory service](https://github.com/wafiur06/pharma-b2b-react-fastapi-postgres/blob/main/backend/app/modules/inventory/service.py): `backend/app/modules/inventory/service.py`
- [Client services](https://github.com/wafiur06/pharma-b2b-react-fastapi-postgres/blob/main/backend/app/modules/client_services/router.py): `backend/app/modules/client_services/router.py`
- [Invoices](https://github.com/wafiur06/pharma-b2b-react-fastapi-postgres/blob/main/backend/app/modules/invoices/router.py): `backend/app/modules/invoices/router.py`

### API and persistence

- [FastAPI app](https://github.com/wafiur06/pharma-b2b-react-fastapi-postgres/blob/main/backend/app/main.py): `backend/app/main.py`
- **PostgreSQL**

### Other components

- **Pharmacy user**

## Connections

- Pharmacy user → Web routes: uses
- Web routes → Login and signup: routes
- Web routes → App layout: wraps pages
- Web routes → Dashboard: routes
- Web routes → Catalog: routes
- Web routes → Inventory: routes
- Web routes → Orders: routes
- Web routes → Service pages: routes
- FastAPI app → Auth endpoints: registers
- FastAPI app → User endpoints: registers
- FastAPI app → Organizations: registers router
- FastAPI app → Catalog service: registers router
- FastAPI app → Cart service: registers router
- FastAPI app → Order service: registers router
- FastAPI app → Inventory service: registers router
- FastAPI app → Client services: registers
- FastAPI app → Invoices: registers
- Auth endpoints → Auth service: calls
- Auth endpoints → Organizations: calls user service
- Catalog service → PostgreSQL: reads and writes
- Cart service → PostgreSQL: reads and writes
- Order service → PostgreSQL: reads and writes
- Order service → Inventory service: updates lots
- Inventory service → PostgreSQL: reads and writes
- Organizations → PostgreSQL: reads and writes
- Client services → PostgreSQL: reads and writes
- Invoices → PostgreSQL: uses
