# ritskhair/cmmsproject architecture

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

- Interactive diagram: https://gitdiagram.com/ritskhair/cmmsproject
- Repository: https://github.com/ritskhair/cmmsproject

## Overview

CMMS is a computerized maintenance-management application for equipment, accounts, dashboards, and electronic work orders. Users sign in through the frontend; role-gated pages call the FastAPI API, which authenticates requests, performs domain operations, and reads or writes relational records. Operators have a separate, factory-network-restricted login and work-order experience. The README gives no further capability detail; major branches are represented from the source index, while relationships between unsampled modules are omitted unless documented or directly evidenced.

Main entry points: [`frontend/src/App.tsx`](https://github.com/ritskhair/cmmsproject/blob/main/frontend/src/App.tsx) (Routes and layouts), [`backend/app/core/security.py`](https://github.com/ritskhair/cmmsproject/blob/main/backend/app/core/security.py) (Sessions and role checks), [`backend/app/main.py`](https://github.com/ritskhair/cmmsproject/blob/main/backend/app/main.py) (API router), [`frontend/src/utils/api.ts`](https://github.com/ritskhair/cmmsproject/blob/main/frontend/src/utils/api.ts) (API client)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Web application"]
  node_app["Routes and layouts<br/>[App.tsx]"]
  node_login["Login<br/>[01 - Login.tsx]"]
  node_session["Session and roles<br/>[auth.ts]"]
  node_dashboard["Maintenance dashboard"]
  node_equipment_ui["Equipment detail"]
  node_equipment_list["Equipment list and import"]
  node_users_ui["User management"]
  node_maintenance_ui["Maintenance work orders"]
  node_operator_ui["Operator work orders"]
  node_api_client["API client<br/>[api.ts]"]
end

subgraph group_api["API and access"]
  node_server["API router<br/>[main.py]"]
  node_auth_routes["Authentication routes<br/>[auth.py]"]
  node_security["Sessions and role checks<br/>[security.py]"]
end

subgraph group_domain["Maintenance operations"]
  node_account_routes["Account management<br/>[accounts.py]"]
  node_equipment_routes["Equipment and components<br/>[equipment.py]"]
  node_ewo_routes["Work-order requests<br/>[ewo_requests.py]"]
  node_maintenance_routes["Maintenance records<br/>[maintenance.py]"]
  node_dashboard_routes["Dashboard summary<br/>[dashboard.py]"]
end

subgraph group_persistence["Relational data"]
  node_db_session["Database sessions<br/>[database.py]"]
  node_accounts[("Accounts<br/>[account.py]")]
  node_equipment[("Equipment<br/>[equipment.py]")]
  node_components[("Components<br/>[component.py]")]
  node_sections[("Sections<br/>[section.py]")]
  node_ewo_requests[("EWO requests<br/>[ewo_request.py]")]
  node_ewo_maintenance[("EWO maintenance<br/>[ewo_maintenance.py]")]
end

node_user(("User"))

node_user -->|"uses"| node_app
node_app -->|"routes to"| node_login
node_app -->|"routes to"| node_dashboard
node_app -->|"routes to"| node_equipment_list
node_app -->|"routes to"| node_equipment_ui
node_app -->|"routes to"| node_maintenance_ui
node_app -->|"routes to"| node_operator_ui
node_app -->|"routes to"| node_users_ui
node_login -->|"calls"| node_api_client
node_login -->|"saves session"| node_session
node_app -->|"guards routes"| node_session
node_dashboard -->|"calls"| node_api_client
node_equipment_ui -->|"calls"| node_api_client
node_users_ui -->|"calls"| node_api_client
node_maintenance_ui -->|"calls"| node_api_client
node_operator_ui -->|"calls"| node_api_client
node_api_client -.->|"HTTP requests"| node_server
node_server -->|"registers"| node_auth_routes
node_server -->|"registers"| node_account_routes
node_server -->|"registers"| node_equipment_routes
node_server -->|"registers"| node_ewo_routes
node_server -->|"registers"| node_maintenance_routes
node_server -->|"registers"| node_dashboard_routes
node_auth_routes -->|"creates sessions"| node_security
node_auth_routes -->|"queries with"| node_db_session
node_security -->|"checks account"| node_accounts
node_security -->|"queries with"| node_db_session
node_account_routes -->|"queries with"| node_db_session
node_account_routes -->|"checks access"| node_security
node_equipment_routes -->|"queries with"| node_db_session
node_equipment_routes -->|"checks access"| node_security
node_equipment_routes -->|"reads and writes"| node_equipment
node_equipment_routes -->|"reads and writes"| node_components
node_equipment_routes -->|"queries"| node_sections
node_ewo_routes -->|"queries with"| node_db_session
node_ewo_routes -->|"checks access"| node_security
node_ewo_routes -->|"queries"| node_equipment
node_ewo_routes -->|"queries"| node_components
node_ewo_routes -->|"reads and writes"| node_ewo_requests
node_maintenance_routes -->|"queries with"| node_db_session
node_maintenance_routes -->|"checks access"| node_security
node_maintenance_routes -->|"queries"| node_equipment
node_maintenance_routes -->|"queries"| node_ewo_requests
node_maintenance_routes -->|"reads and writes"| node_ewo_maintenance
node_dashboard_routes -->|"queries with"| node_db_session
node_dashboard_routes -->|"checks access"| node_security
node_dashboard_routes -->|"queries"| node_equipment
node_dashboard_routes -->|"queries"| node_ewo_requests

click node_app "https://github.com/ritskhair/cmmsproject/blob/main/frontend/src/App.tsx"
click node_login "https://github.com/ritskhair/cmmsproject/blob/main/frontend/src/pages/Section%201%20-%20Autentification/01%20-%20Login.tsx"
click node_session "https://github.com/ritskhair/cmmsproject/blob/main/frontend/src/utils/auth.ts"
click node_dashboard "https://github.com/ritskhair/cmmsproject/blob/main/frontend/src/pages/Section%202%20-%20Dashboard/01%20-%20Main%20Dashboard.tsx"
click node_equipment_ui "https://github.com/ritskhair/cmmsproject/blob/main/frontend/src/pages/Section%203%20-%20Equipment/02%20-%20DetailEquipment.tsx"
click node_equipment_list "https://github.com/ritskhair/cmmsproject/tree/main/frontend/src/pages/Section%203%20-%20Equipment"
click node_users_ui "https://github.com/ritskhair/cmmsproject/blob/main/frontend/src/pages/Section%204%20-%20User%20Management/01%20-%20User%20Management.tsx"
click node_maintenance_ui "https://github.com/ritskhair/cmmsproject/blob/main/frontend/src/pages/Section%205%20-%20Work%20Orders/01%20-%20Maintenance%20Work%20Orders.tsx"
click node_operator_ui "https://github.com/ritskhair/cmmsproject/blob/main/frontend/src/pages/Section%205%20-%20Work%20Orders/02%20-%20Operator%20Work%20Orders.tsx"
click node_api_client "https://github.com/ritskhair/cmmsproject/blob/main/frontend/src/utils/api.ts"
click node_server "https://github.com/ritskhair/cmmsproject/blob/main/backend/app/main.py"
click node_auth_routes "https://github.com/ritskhair/cmmsproject/blob/main/backend/app/routers/auth.py"
click node_security "https://github.com/ritskhair/cmmsproject/blob/main/backend/app/core/security.py"
click node_account_routes "https://github.com/ritskhair/cmmsproject/blob/main/backend/app/routers/accounts.py"
click node_equipment_routes "https://github.com/ritskhair/cmmsproject/blob/main/backend/app/routers/equipment.py"
click node_ewo_routes "https://github.com/ritskhair/cmmsproject/blob/main/backend/app/routers/ewo_requests.py"
click node_maintenance_routes "https://github.com/ritskhair/cmmsproject/blob/main/backend/app/routers/maintenance.py"
click node_dashboard_routes "https://github.com/ritskhair/cmmsproject/blob/main/backend/app/routers/dashboard.py"
click node_db_session "https://github.com/ritskhair/cmmsproject/blob/main/backend/app/core/database.py"
click node_accounts "https://github.com/ritskhair/cmmsproject/blob/main/backend/app/models/account.py"
click node_equipment "https://github.com/ritskhair/cmmsproject/blob/main/backend/app/models/equipment.py"
click node_components "https://github.com/ritskhair/cmmsproject/blob/main/backend/app/models/component.py"
click node_sections "https://github.com/ritskhair/cmmsproject/blob/main/backend/app/models/section.py"
click node_ewo_requests "https://github.com/ritskhair/cmmsproject/blob/main/backend/app/models/ewo_request.py"
click node_ewo_maintenance "https://github.com/ritskhair/cmmsproject/blob/main/backend/app/models/ewo_maintenance.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_login,node_session,node_dashboard,node_equipment_ui,node_equipment_list,node_users_ui,node_maintenance_ui,node_operator_ui,node_api_client,node_user toneBlue
class node_server,node_auth_routes,node_security toneAmber
class node_account_routes,node_equipment_routes,node_ewo_routes,node_maintenance_routes,node_dashboard_routes toneMint
class node_db_session,node_accounts,node_equipment,node_components,node_sections,node_ewo_requests,node_ewo_maintenance toneRose
```

## Components

### Web application

- [Routes and layouts](https://github.com/ritskhair/cmmsproject/blob/main/frontend/src/App.tsx): `frontend/src/App.tsx`
- [Login](https://github.com/ritskhair/cmmsproject/blob/main/frontend/src/pages/Section%201%20-%20Autentification/01%20-%20Login.tsx): `frontend/src/pages/Section 1 - Autentification/01 - Login.tsx`
- [Session and roles](https://github.com/ritskhair/cmmsproject/blob/main/frontend/src/utils/auth.ts): `frontend/src/utils/auth.ts`
- [Maintenance dashboard](https://github.com/ritskhair/cmmsproject/blob/main/frontend/src/pages/Section%202%20-%20Dashboard/01%20-%20Main%20Dashboard.tsx): `frontend/src/pages/Section 2 - Dashboard/01 - Main Dashboard.tsx`
- [Equipment detail](https://github.com/ritskhair/cmmsproject/blob/main/frontend/src/pages/Section%203%20-%20Equipment/02%20-%20DetailEquipment.tsx): `frontend/src/pages/Section 3 - Equipment/02 - DetailEquipment.tsx`
- [Equipment list and import](https://github.com/ritskhair/cmmsproject/tree/main/frontend/src/pages/Section%203%20-%20Equipment): `frontend/src/pages/Section 3 - Equipment`
- [User management](https://github.com/ritskhair/cmmsproject/blob/main/frontend/src/pages/Section%204%20-%20User%20Management/01%20-%20User%20Management.tsx): `frontend/src/pages/Section 4 - User Management/01 - User Management.tsx`
- [Maintenance work orders](https://github.com/ritskhair/cmmsproject/blob/main/frontend/src/pages/Section%205%20-%20Work%20Orders/01%20-%20Maintenance%20Work%20Orders.tsx): `frontend/src/pages/Section 5 - Work Orders/01 - Maintenance Work Orders.tsx`
- [Operator work orders](https://github.com/ritskhair/cmmsproject/blob/main/frontend/src/pages/Section%205%20-%20Work%20Orders/02%20-%20Operator%20Work%20Orders.tsx): `frontend/src/pages/Section 5 - Work Orders/02 - Operator Work Orders.tsx`
- [API client](https://github.com/ritskhair/cmmsproject/blob/main/frontend/src/utils/api.ts): `frontend/src/utils/api.ts`

### API and access

- [API router](https://github.com/ritskhair/cmmsproject/blob/main/backend/app/main.py): `backend/app/main.py`
- [Authentication routes](https://github.com/ritskhair/cmmsproject/blob/main/backend/app/routers/auth.py): `backend/app/routers/auth.py`
- [Sessions and role checks](https://github.com/ritskhair/cmmsproject/blob/main/backend/app/core/security.py): `backend/app/core/security.py`

### Maintenance operations

- [Account management](https://github.com/ritskhair/cmmsproject/blob/main/backend/app/routers/accounts.py): `backend/app/routers/accounts.py`
- [Equipment and components](https://github.com/ritskhair/cmmsproject/blob/main/backend/app/routers/equipment.py): `backend/app/routers/equipment.py`
- [Work-order requests](https://github.com/ritskhair/cmmsproject/blob/main/backend/app/routers/ewo_requests.py): `backend/app/routers/ewo_requests.py`
- [Maintenance records](https://github.com/ritskhair/cmmsproject/blob/main/backend/app/routers/maintenance.py): `backend/app/routers/maintenance.py`
- [Dashboard summary](https://github.com/ritskhair/cmmsproject/blob/main/backend/app/routers/dashboard.py): `backend/app/routers/dashboard.py`

### Relational data

- [Database sessions](https://github.com/ritskhair/cmmsproject/blob/main/backend/app/core/database.py): `backend/app/core/database.py`
- [Accounts](https://github.com/ritskhair/cmmsproject/blob/main/backend/app/models/account.py): `backend/app/models/account.py`
- [Equipment](https://github.com/ritskhair/cmmsproject/blob/main/backend/app/models/equipment.py): `backend/app/models/equipment.py`
- [Components](https://github.com/ritskhair/cmmsproject/blob/main/backend/app/models/component.py): `backend/app/models/component.py`
- [Sections](https://github.com/ritskhair/cmmsproject/blob/main/backend/app/models/section.py): `backend/app/models/section.py`
- [EWO requests](https://github.com/ritskhair/cmmsproject/blob/main/backend/app/models/ewo_request.py): `backend/app/models/ewo_request.py`
- [EWO maintenance](https://github.com/ritskhair/cmmsproject/blob/main/backend/app/models/ewo_maintenance.py): `backend/app/models/ewo_maintenance.py`

### Other components

- **User**

## Connections

- User → Routes and layouts: uses (evidence: `frontend/src/App.tsx`)
- Routes and layouts → Login: routes to (evidence: `frontend/src/App.tsx`)
- Routes and layouts → Maintenance dashboard: routes to (evidence: `frontend/src/App.tsx`)
- Routes and layouts → Equipment list and import: routes to (evidence: `frontend/src/App.tsx`)
- Routes and layouts → Equipment detail: routes to (evidence: `frontend/src/App.tsx`)
- Routes and layouts → Maintenance work orders: routes to (evidence: `frontend/src/App.tsx`)
- Routes and layouts → Operator work orders: routes to (evidence: `frontend/src/App.tsx`)
- Routes and layouts → User management: routes to (evidence: `frontend/src/App.tsx`)
- Login → API client: calls (evidence: `frontend/src/pages/Section 1 - Autentification/01 - Login.tsx`)
- Login → Session and roles: saves session (evidence: `frontend/src/pages/Section 1 - Autentification/01 - Login.tsx`)
- Routes and layouts → Session and roles: guards routes (evidence: `frontend/src/App.tsx`)
- Maintenance dashboard → API client: calls (evidence: `frontend/src/pages/Section 2 - Dashboard/01 - Main Dashboard.tsx`)
- Equipment detail → API client: calls (evidence: `frontend/src/pages/Section 3 - Equipment/02 - DetailEquipment.tsx`)
- User management → API client: calls (evidence: `frontend/src/pages/Section 4 - User Management/01 - User Management.tsx`)
- Maintenance work orders → API client: calls (evidence: `frontend/src/pages/Section 5 - Work Orders/01 - Maintenance Work Orders.tsx`)
- Operator work orders → API client: calls (evidence: `frontend/src/pages/Section 5 - Work Orders/02 - Operator Work Orders.tsx`)
- API client → API router: HTTP requests
- API router → Authentication routes: registers (evidence: `backend/app/main.py`)
- API router → Account management: registers (evidence: `backend/app/main.py`)
- API router → Equipment and components: registers (evidence: `backend/app/main.py`)
- API router → Work-order requests: registers (evidence: `backend/app/main.py`)
- API router → Maintenance records: registers (evidence: `backend/app/main.py`)
- API router → Dashboard summary: registers (evidence: `backend/app/main.py`)
- Authentication routes → Sessions and role checks: creates sessions (evidence: `backend/app/routers/auth.py`)
- Authentication routes → Database sessions: queries with (evidence: `backend/app/routers/auth.py`)
- Sessions and role checks → Accounts: checks account (evidence: `backend/app/core/security.py`)
- Sessions and role checks → Database sessions: queries with (evidence: `backend/app/core/security.py`)
- Account management → Database sessions: queries with (evidence: `backend/app/routers/accounts.py`)
- Account management → Sessions and role checks: checks access (evidence: `backend/app/routers/accounts.py`)
- Equipment and components → Database sessions: queries with (evidence: `backend/app/routers/equipment.py`)
- Equipment and components → Sessions and role checks: checks access (evidence: `backend/app/routers/equipment.py`)
- Equipment and components → Equipment: reads and writes (evidence: `backend/app/routers/equipment.py`)
- Equipment and components → Components: reads and writes (evidence: `backend/app/routers/equipment.py`)
- Equipment and components → Sections: queries (evidence: `backend/app/routers/equipment.py`)
- Work-order requests → Database sessions: queries with (evidence: `backend/app/routers/ewo_requests.py`)
- Work-order requests → Sessions and role checks: checks access (evidence: `backend/app/routers/ewo_requests.py`)
- Work-order requests → Equipment: queries (evidence: `backend/app/routers/ewo_requests.py`)
- Work-order requests → Components: queries (evidence: `backend/app/routers/ewo_requests.py`)
- Work-order requests → EWO requests: reads and writes (evidence: `backend/app/routers/ewo_requests.py`)
- Maintenance records → Database sessions: queries with (evidence: `backend/app/routers/maintenance.py`)
- Maintenance records → Sessions and role checks: checks access (evidence: `backend/app/routers/maintenance.py`)
- Maintenance records → Equipment: queries (evidence: `backend/app/routers/maintenance.py`)
- Maintenance records → EWO requests: queries (evidence: `backend/app/routers/maintenance.py`)
- Maintenance records → EWO maintenance: reads and writes (evidence: `backend/app/routers/maintenance.py`)
- Dashboard summary → Database sessions: queries with (evidence: `backend/app/routers/dashboard.py`)
- Dashboard summary → Sessions and role checks: checks access (evidence: `backend/app/routers/dashboard.py`)
- Dashboard summary → Equipment: queries (evidence: `backend/app/routers/dashboard.py`)
- Dashboard summary → EWO requests: queries (evidence: `backend/app/routers/dashboard.py`)
