# jahanvi11-1/ecovia architecture

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

- Interactive diagram: https://gitdiagram.com/jahanvi11-1/ecovia
- Repository: https://github.com/jahanvi11-1/ecovia

## Overview

Ecovia is a PLM application whose central workflow is to propose product or BoM changes as ECOs, move them through configurable approvals and validation, then apply them; application can archive and version product or BoM state. Users also browse products and BoMs, manage stages and approval rules, and review audit and version reports. The React app calls a FastAPI API backed by PostgreSQL. Core lifecycle links are supported by the ECO router’s indexed references; some frontend and reporting details are documented but their implementation was not sampled.

Main entry points: [`frontend/src/api/client.js`](https://github.com/jahanvi11-1/ecovia/blob/main/frontend/src/api/client.js) (API client), [`frontend/src/App.jsx`](https://github.com/jahanvi11-1/ecovia/blob/main/frontend/src/App.jsx) (Application routes), [`backend/app/routers/ecos.py`](https://github.com/jahanvi11-1/ecovia/blob/main/backend/app/routers/ecos.py) (ECO API), [`backend/app/database.py`](https://github.com/jahanvi11-1/ecovia/blob/main/backend/app/database.py) (Async database session)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_ui["PLM interface"]
  node_app["Application routes<br/>[App.jsx]"]
  node_client["API client<br/>[client.js]"]
  node_authstate["Auth state<br/>[authStore.js]"]
  node_productui["Product views<br/>[ProductList.jsx]"]
  node_bomui["BoM views<br/>[BomList.jsx]"]
  node_ecoui["ECO views<br/>[EcoDetail.jsx]"]
  node_settingsui["Workflow settings"]
  node_reportsui["Reports<br/>[AuditLogReport.jsx]"]
end

subgraph group_api["API routes"]
  node_authapi["Authentication API<br/>[auth.py]"]
  node_productapi["Product API<br/>[products.py]"]
  node_bomapi["BoM API<br/>[boms.py]"]
  node_ecoapi["ECO API<br/>[ecos.py]"]
  node_settingsapi["Settings API<br/>[settings.py]"]
  node_reportsapi["Reports API<br/>[reports.py]"]
end

subgraph group_workflow["Change workflow"]
  node_stage["Stage machine<br/>[stage_machine.py]"]
  node_versions["Version manager<br/>[version_manager.py]"]
  node_diff["Change diff<br/>[diff_engine.py]"]
end

subgraph group_identity["Identity and access"]
  node_security["JWT and RBAC<br/>[deps.py]"]
end

subgraph group_data["PLM data"]
  node_productdata[("Product versions<br/>[product.py]")]
  node_bomdata[("BoM records<br/>[bom.py]")]
  node_ecodata[("ECO and approvals<br/>[eco.py]")]
  node_userdata[("User records<br/>[user.py]")]
  node_db[("Async database session<br/>[database.py]")]
end

node_user(("PLM user"))
node_postgres[("PostgreSQL")]

node_user -->|"uses"| node_app
node_app -->|"loads identity"| node_client
node_app -->|"checks session"| node_authstate
node_app -->|"routes to"| node_productui
node_app -->|"routes to"| node_bomui
node_app -->|"routes to"| node_ecoui
node_app -->|"routes to"| node_settingsui
node_app -->|"routes to"| node_reportsui
node_productui -->|"requests data"| node_client
node_bomui -->|"requests data"| node_client
node_ecoui -->|"requests lifecycle"| node_client
node_settingsui -->|"configures stages"| node_client
node_reportsui -->|"requests reports"| node_client
node_client -->|"calls API"| node_authapi
node_client -->|"calls API"| node_productapi
node_client -->|"calls API"| node_bomapi
node_client -->|"calls API"| node_ecoapi
node_client -->|"calls API"| node_settingsapi
node_client -->|"calls API"| node_reportsapi
node_authapi -->|"authenticates"| node_security
node_authapi -->|"reads and writes"| node_userdata
node_productapi -->|"queries"| node_productdata
node_bomapi -->|"queries"| node_bomdata
node_ecoapi -->|"advances stages"| node_stage
node_ecoapi -->|"applies changes"| node_versions
node_ecoapi -->|"computes diff"| node_diff
node_ecoapi -->|"records lifecycle"| node_ecodata
node_ecoapi -->|"targets product"| node_productdata
node_ecoapi -->|"targets BoM"| node_bomdata
node_settingsapi -->|"configures stages"| node_ecodata
node_versions -->|"versions product"| node_productdata
node_versions -->|"versions BoM"| node_bomdata
node_versions -->|"reads proposal"| node_ecodata
node_security -->|"resolves user"| node_userdata
node_security -.->|"issues JWT"| node_authstate
node_productdata -->|"maps records"| node_db
node_bomdata -->|"maps records"| node_db
node_ecodata -->|"maps records"| node_db
node_userdata -->|"maps records"| node_db
node_db -->|"persists data"| node_postgres

click node_app "https://github.com/jahanvi11-1/ecovia/blob/main/frontend/src/App.jsx"
click node_client "https://github.com/jahanvi11-1/ecovia/blob/main/frontend/src/api/client.js"
click node_authstate "https://github.com/jahanvi11-1/ecovia/blob/main/frontend/src/store/authStore.js"
click node_productui "https://github.com/jahanvi11-1/ecovia/blob/main/frontend/src/components/products/ProductList.jsx"
click node_bomui "https://github.com/jahanvi11-1/ecovia/blob/main/frontend/src/components/bom/BomList.jsx"
click node_ecoui "https://github.com/jahanvi11-1/ecovia/blob/main/frontend/src/components/eco/EcoDetail.jsx"
click node_settingsui "https://github.com/jahanvi11-1/ecovia/blob/main/frontend/src/components/settings/EcoStageSettings.jsx"
click node_reportsui "https://github.com/jahanvi11-1/ecovia/blob/main/frontend/src/components/reports/AuditLogReport.jsx"
click node_authapi "https://github.com/jahanvi11-1/ecovia/blob/main/backend/app/routers/auth.py"
click node_productapi "https://github.com/jahanvi11-1/ecovia/blob/main/backend/app/routers/products.py"
click node_bomapi "https://github.com/jahanvi11-1/ecovia/blob/main/backend/app/routers/boms.py"
click node_ecoapi "https://github.com/jahanvi11-1/ecovia/blob/main/backend/app/routers/ecos.py"
click node_settingsapi "https://github.com/jahanvi11-1/ecovia/blob/main/backend/app/routers/settings.py"
click node_reportsapi "https://github.com/jahanvi11-1/ecovia/blob/main/backend/app/routers/reports.py"
click node_stage "https://github.com/jahanvi11-1/ecovia/blob/main/backend/app/core/stage_machine.py"
click node_versions "https://github.com/jahanvi11-1/ecovia/blob/main/backend/app/core/version_manager.py"
click node_diff "https://github.com/jahanvi11-1/ecovia/blob/main/backend/app/core/diff_engine.py"
click node_security "https://github.com/jahanvi11-1/ecovia/blob/main/backend/app/core/deps.py"
click node_productdata "https://github.com/jahanvi11-1/ecovia/blob/main/backend/app/models/product.py"
click node_bomdata "https://github.com/jahanvi11-1/ecovia/blob/main/backend/app/models/bom.py"
click node_ecodata "https://github.com/jahanvi11-1/ecovia/blob/main/backend/app/models/eco.py"
click node_userdata "https://github.com/jahanvi11-1/ecovia/blob/main/backend/app/models/user.py"
click node_db "https://github.com/jahanvi11-1/ecovia/blob/main/backend/app/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_client,node_authstate,node_productui,node_bomui,node_ecoui,node_settingsui,node_reportsui,node_user toneBlue
class node_authapi,node_productapi,node_bomapi,node_ecoapi,node_settingsapi,node_reportsapi,node_postgres toneAmber
class node_stage,node_versions,node_diff toneMint
class node_security toneRose
class node_productdata,node_bomdata,node_ecodata,node_userdata,node_db toneIndigo
```

## Components

### PLM interface

- [Application routes](https://github.com/jahanvi11-1/ecovia/blob/main/frontend/src/App.jsx): `frontend/src/App.jsx`
- [API client](https://github.com/jahanvi11-1/ecovia/blob/main/frontend/src/api/client.js): `frontend/src/api/client.js`
- [Auth state](https://github.com/jahanvi11-1/ecovia/blob/main/frontend/src/store/authStore.js): `frontend/src/store/authStore.js`
- [Product views](https://github.com/jahanvi11-1/ecovia/blob/main/frontend/src/components/products/ProductList.jsx): `frontend/src/components/products/ProductList.jsx`
- [BoM views](https://github.com/jahanvi11-1/ecovia/blob/main/frontend/src/components/bom/BomList.jsx): `frontend/src/components/bom/BomList.jsx`
- [ECO views](https://github.com/jahanvi11-1/ecovia/blob/main/frontend/src/components/eco/EcoDetail.jsx): `frontend/src/components/eco/EcoDetail.jsx`
- [Workflow settings](https://github.com/jahanvi11-1/ecovia/blob/main/frontend/src/components/settings/EcoStageSettings.jsx): `frontend/src/components/settings/EcoStageSettings.jsx`
- [Reports](https://github.com/jahanvi11-1/ecovia/blob/main/frontend/src/components/reports/AuditLogReport.jsx): `frontend/src/components/reports/AuditLogReport.jsx`

### API routes

- [Authentication API](https://github.com/jahanvi11-1/ecovia/blob/main/backend/app/routers/auth.py): `backend/app/routers/auth.py`
- [Product API](https://github.com/jahanvi11-1/ecovia/blob/main/backend/app/routers/products.py): `backend/app/routers/products.py`
- [BoM API](https://github.com/jahanvi11-1/ecovia/blob/main/backend/app/routers/boms.py): `backend/app/routers/boms.py`
- [ECO API](https://github.com/jahanvi11-1/ecovia/blob/main/backend/app/routers/ecos.py): `backend/app/routers/ecos.py`
- [Settings API](https://github.com/jahanvi11-1/ecovia/blob/main/backend/app/routers/settings.py): `backend/app/routers/settings.py`
- [Reports API](https://github.com/jahanvi11-1/ecovia/blob/main/backend/app/routers/reports.py): `backend/app/routers/reports.py`

### Change workflow

- [Stage machine](https://github.com/jahanvi11-1/ecovia/blob/main/backend/app/core/stage_machine.py): `backend/app/core/stage_machine.py`
- [Version manager](https://github.com/jahanvi11-1/ecovia/blob/main/backend/app/core/version_manager.py): `backend/app/core/version_manager.py`
- [Change diff](https://github.com/jahanvi11-1/ecovia/blob/main/backend/app/core/diff_engine.py): `backend/app/core/diff_engine.py`

### Identity and access

- [JWT and RBAC](https://github.com/jahanvi11-1/ecovia/blob/main/backend/app/core/deps.py): `backend/app/core/deps.py`

### PLM data

- [Product versions](https://github.com/jahanvi11-1/ecovia/blob/main/backend/app/models/product.py): `backend/app/models/product.py`
- [BoM records](https://github.com/jahanvi11-1/ecovia/blob/main/backend/app/models/bom.py): `backend/app/models/bom.py`
- [ECO and approvals](https://github.com/jahanvi11-1/ecovia/blob/main/backend/app/models/eco.py): `backend/app/models/eco.py`
- [User records](https://github.com/jahanvi11-1/ecovia/blob/main/backend/app/models/user.py): `backend/app/models/user.py`
- [Async database session](https://github.com/jahanvi11-1/ecovia/blob/main/backend/app/database.py): `backend/app/database.py`

### Other components

- **PLM user**
- **PostgreSQL**

## Connections

- PLM user → Application routes: uses (evidence: `frontend/src/App.jsx`)
- Application routes → API client: loads identity (evidence: `frontend/src/App.jsx`)
- Application routes → Auth state: checks session (evidence: `frontend/src/App.jsx`)
- Application routes → Product views: routes to (evidence: `frontend/src/App.jsx`)
- Application routes → BoM views: routes to (evidence: `frontend/src/App.jsx`)
- Application routes → ECO views: routes to (evidence: `frontend/src/App.jsx`)
- Application routes → Workflow settings: routes to (evidence: `frontend/src/App.jsx`)
- Application routes → Reports: routes to (evidence: `frontend/src/App.jsx`)
- Product views → API client: requests data (evidence: `frontend/src/components/products/ProductList.jsx`)
- BoM views → API client: requests data (evidence: `frontend/src/components/bom/BomList.jsx`)
- ECO views → API client: requests lifecycle (evidence: `frontend/src/components/eco/EcoDetail.jsx`)
- Workflow settings → API client: configures stages (evidence: `frontend/src/components/settings/EcoStageSettings.jsx`)
- Reports → API client: requests reports (evidence: `frontend/src/components/reports/AuditLogReport.jsx`)
- API client → Authentication API: calls API (evidence: `README.md`)
- API client → Product API: calls API (evidence: `README.md`)
- API client → BoM API: calls API (evidence: `README.md`)
- API client → ECO API: calls API (evidence: `README.md`)
- API client → Settings API: calls API (evidence: `README.md`)
- API client → Reports API: calls API (evidence: `README.md`)
- Authentication API → JWT and RBAC: authenticates (evidence: `backend/app/routers/auth.py`)
- Authentication API → User records: reads and writes (evidence: `backend/app/routers/auth.py`)
- Product API → Product versions: queries (evidence: `backend/app/routers/products.py`)
- BoM API → BoM records: queries (evidence: `backend/app/routers/boms.py`)
- ECO API → Stage machine: advances stages (evidence: `backend/app/routers/ecos.py`)
- ECO API → Version manager: applies changes (evidence: `backend/app/routers/ecos.py`)
- ECO API → Change diff: computes diff (evidence: `backend/app/routers/ecos.py`)
- ECO API → ECO and approvals: records lifecycle (evidence: `backend/app/routers/ecos.py`)
- ECO API → Product versions: targets product (evidence: `backend/app/routers/ecos.py`)
- ECO API → BoM records: targets BoM (evidence: `backend/app/routers/ecos.py`)
- Settings API → ECO and approvals: configures stages (evidence: `backend/app/routers/settings.py`)
- Version manager → Product versions: versions product (evidence: `backend/app/core/version_manager.py`)
- Version manager → BoM records: versions BoM (evidence: `backend/app/core/version_manager.py`)
- Version manager → ECO and approvals: reads proposal (evidence: `backend/app/core/version_manager.py`)
- JWT and RBAC → User records: resolves user (evidence: `backend/app/core/deps.py`)
- JWT and RBAC → Auth state: issues JWT
- Product versions → Async database session: maps records (evidence: `backend/app/models/product.py`)
- BoM records → Async database session: maps records (evidence: `backend/app/models/bom.py`)
- ECO and approvals → Async database session: maps records (evidence: `backend/app/models/eco.py`)
- User records → Async database session: maps records (evidence: `backend/app/models/user.py`)
- Async database session → PostgreSQL: persists data (evidence: `README.md`)
