# rahul9136-ai/khyati architecture

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

- Interactive diagram: https://gitdiagram.com/rahul9136-ai/khyati
- Repository: https://github.com/rahul9136-ai/khyati

## Overview

Purvi.AI is a workforce-management product with a frontend that can run offline using simulated workforce data and a FastAPI backend for authenticated, persistent workflows. A typical planning workflow produces forecasts and capacity requirements; schedules are then edited and published, while adherence, reporting, and automation provide operational feedback. The graph preserves major documented capabilities, but the excerpts do not show most page-to-module wiring, so uncertain internal call relationships are omitted.

Main entry points: [`frontend/src/lib/api.ts`](https://github.com/rahul9136-ai/khyati/blob/main/frontend/src/lib/api.ts) (API and sync), [`backend/app/db/session.py`](https://github.com/rahul9136-ai/khyati/blob/main/backend/app/db/session.py) (Relational database), [`frontend/src/pages/Forecasting.tsx`](https://github.com/rahul9136-ai/khyati/blob/main/frontend/src/pages/Forecasting.tsx) (Forecasting), [`frontend/src/App.tsx`](https://github.com/rahul9136-ai/khyati/blob/main/frontend/src/App.tsx) (Product shell)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Workforce client"]
  node_frontend["Product shell<br/>[App.tsx]"]
  node_api_client["API and sync<br/>[api.ts]"]
end

subgraph group_planning["Forecast and planning"]
  node_forecast_ui["Forecasting<br/>[Forecasting.tsx]"]
  node_capacity_ui["Capacity planning<br/>[CapacityModule.tsx]"]
  node_scenario_ui["Scenario studio<br/>[Scenarios.tsx]"]
  node_forecast_engine["Forecast engine<br/>[engine.py]"]
  node_capacity_engine["Capacity engine<br/>[engine.py]"]
  node_hcplanning["Headcount planning<br/>[service.py]"]
end

subgraph group_operations["Scheduling operations"]
  node_schedule_ui["Schedule timeline<br/>[Scheduling.tsx]"]
  node_intraday_ui["Live operations<br/>[Intraday.tsx]"]
  node_report_ui["Reports<br/>[Reports.tsx]"]
  node_automation_ui["Automation<br/>[Automation.tsx]"]
  node_schedule_service["Day-plan service<br/>[dayplan_service.py]"]
  node_attendance["Attendance<br/>[service.py]"]
  node_intraday["Intraday service<br/>[service.py]"]
  node_reporting["Reporting service<br/>[service.py]"]
  node_autonomy["Autonomous agents<br/>[service.py]"]
  node_integrations["Approval integrations<br/>[service.py]"]
end

subgraph group_platform["Backend platform"]
  node_app_entry["FastAPI application<br/>[main.py]"]
  node_identity["Identity and RBAC<br/>[service.py]"]
  node_workforce["Workforce records<br/>[service.py]"]
  node_webhooks["Webhook delivery<br/>[webhooks.py]"]
  node_database[("Relational database<br/>[session.py]")]
end

node_operator(("Workforce user"))
node_bi_consumer(("BI tools"))
node_external_channels(("Slack and Teams"))

node_operator -->|"uses"| node_frontend
node_frontend -.->|"navigates"| node_forecast_ui
node_frontend -.->|"navigates"| node_schedule_ui
node_forecast_ui -.->|"forecasts via"| node_forecast_engine
node_capacity_ui -.->|"calculates with"| node_capacity_engine
node_scenario_ui -.->|"runs scenarios"| node_capacity_engine
node_operator -->|"edits schedules"| node_schedule_ui
node_schedule_ui -->|"syncs plans"| node_api_client
node_api_client -->|"saves day plans"| node_schedule_service
node_api_client -->|"authenticates"| node_identity
node_app_entry -->|"starts dispatcher"| node_webhooks
node_forecast_ui -->|"publishes forecast"| node_api_client
node_api_client -->|"serves forecast"| node_bi_consumer
node_forecast_ui -->|"publishes event"| node_webhooks
node_capacity_ui -.->|"plans headcount"| node_hcplanning
node_intraday_ui -.->|"uses"| node_intraday
node_report_ui -.->|"requests reports"| node_reporting
node_automation_ui -->|"controls agents"| node_autonomy
node_autonomy -->|"dispatches approvals"| node_integrations
node_integrations -->|"routes approvals"| node_external_channels
node_schedule_service -->|"persists plans"| node_database
node_identity -.->|"stores identity"| node_database
node_workforce -.->|"stores workforce"| node_database
node_attendance -.->|"stores attendance"| node_database
node_reporting -.->|"reads records"| node_database

click node_frontend "https://github.com/rahul9136-ai/khyati/blob/main/frontend/src/App.tsx"
click node_forecast_ui "https://github.com/rahul9136-ai/khyati/blob/main/frontend/src/pages/Forecasting.tsx"
click node_capacity_ui "https://github.com/rahul9136-ai/khyati/blob/main/frontend/src/pages/planning/capacity/CapacityModule.tsx"
click node_scenario_ui "https://github.com/rahul9136-ai/khyati/blob/main/frontend/src/pages/Scenarios.tsx"
click node_schedule_ui "https://github.com/rahul9136-ai/khyati/blob/main/frontend/src/pages/Scheduling.tsx"
click node_intraday_ui "https://github.com/rahul9136-ai/khyati/blob/main/frontend/src/pages/Intraday.tsx"
click node_report_ui "https://github.com/rahul9136-ai/khyati/blob/main/frontend/src/pages/Reports.tsx"
click node_automation_ui "https://github.com/rahul9136-ai/khyati/blob/main/frontend/src/pages/Automation.tsx"
click node_api_client "https://github.com/rahul9136-ai/khyati/blob/main/frontend/src/lib/api.ts"
click node_app_entry "https://github.com/rahul9136-ai/khyati/blob/main/backend/app/main.py"
click node_identity "https://github.com/rahul9136-ai/khyati/blob/main/backend/app/modules/identity/service.py"
click node_workforce "https://github.com/rahul9136-ai/khyati/blob/main/backend/app/modules/workforce/service.py"
click node_forecast_engine "https://github.com/rahul9136-ai/khyati/blob/main/backend/app/modules/forecasting/engine.py"
click node_capacity_engine "https://github.com/rahul9136-ai/khyati/blob/main/backend/app/modules/capacity/engine.py"
click node_hcplanning "https://github.com/rahul9136-ai/khyati/blob/main/backend/app/modules/hcplanning/service.py"
click node_schedule_service "https://github.com/rahul9136-ai/khyati/blob/main/backend/app/modules/scheduling/dayplan_service.py"
click node_attendance "https://github.com/rahul9136-ai/khyati/blob/main/backend/app/modules/attendance/service.py"
click node_intraday "https://github.com/rahul9136-ai/khyati/blob/main/backend/app/modules/intraday/service.py"
click node_reporting "https://github.com/rahul9136-ai/khyati/blob/main/backend/app/modules/reporting/service.py"
click node_autonomy "https://github.com/rahul9136-ai/khyati/blob/main/backend/app/modules/autonomy/service.py"
click node_integrations "https://github.com/rahul9136-ai/khyati/blob/main/backend/app/modules/integrations/service.py"
click node_webhooks "https://github.com/rahul9136-ai/khyati/blob/main/backend/app/modules/connect/webhooks.py"
click node_database "https://github.com/rahul9136-ai/khyati/blob/main/backend/app/db/session.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_frontend,node_api_client,node_operator toneBlue
class node_forecast_ui,node_capacity_ui,node_scenario_ui,node_forecast_engine,node_capacity_engine,node_hcplanning toneAmber
class node_schedule_ui,node_intraday_ui,node_report_ui,node_automation_ui,node_schedule_service,node_attendance,node_intraday,node_reporting,node_autonomy,node_integrations toneMint
class node_app_entry,node_identity,node_workforce,node_webhooks,node_database toneRose
class node_bi_consumer,node_external_channels toneIndigo
```

## Components

### Workforce client

- [Product shell](https://github.com/rahul9136-ai/khyati/blob/main/frontend/src/App.tsx): `frontend/src/App.tsx`
- [API and sync](https://github.com/rahul9136-ai/khyati/blob/main/frontend/src/lib/api.ts): `frontend/src/lib/api.ts`

### Forecast and planning

- [Forecasting](https://github.com/rahul9136-ai/khyati/blob/main/frontend/src/pages/Forecasting.tsx): `frontend/src/pages/Forecasting.tsx`
- [Capacity planning](https://github.com/rahul9136-ai/khyati/blob/main/frontend/src/pages/planning/capacity/CapacityModule.tsx): `frontend/src/pages/planning/capacity/CapacityModule.tsx`
- [Scenario studio](https://github.com/rahul9136-ai/khyati/blob/main/frontend/src/pages/Scenarios.tsx): `frontend/src/pages/Scenarios.tsx`
- [Forecast engine](https://github.com/rahul9136-ai/khyati/blob/main/backend/app/modules/forecasting/engine.py): `backend/app/modules/forecasting/engine.py`
- [Capacity engine](https://github.com/rahul9136-ai/khyati/blob/main/backend/app/modules/capacity/engine.py): `backend/app/modules/capacity/engine.py`
- [Headcount planning](https://github.com/rahul9136-ai/khyati/blob/main/backend/app/modules/hcplanning/service.py): `backend/app/modules/hcplanning/service.py`

### Scheduling operations

- [Schedule timeline](https://github.com/rahul9136-ai/khyati/blob/main/frontend/src/pages/Scheduling.tsx): `frontend/src/pages/Scheduling.tsx`
- [Live operations](https://github.com/rahul9136-ai/khyati/blob/main/frontend/src/pages/Intraday.tsx): `frontend/src/pages/Intraday.tsx`
- [Reports](https://github.com/rahul9136-ai/khyati/blob/main/frontend/src/pages/Reports.tsx): `frontend/src/pages/Reports.tsx`
- [Automation](https://github.com/rahul9136-ai/khyati/blob/main/frontend/src/pages/Automation.tsx): `frontend/src/pages/Automation.tsx`
- [Day-plan service](https://github.com/rahul9136-ai/khyati/blob/main/backend/app/modules/scheduling/dayplan_service.py): `backend/app/modules/scheduling/dayplan_service.py`
- [Attendance](https://github.com/rahul9136-ai/khyati/blob/main/backend/app/modules/attendance/service.py): `backend/app/modules/attendance/service.py`
- [Intraday service](https://github.com/rahul9136-ai/khyati/blob/main/backend/app/modules/intraday/service.py): `backend/app/modules/intraday/service.py`
- [Reporting service](https://github.com/rahul9136-ai/khyati/blob/main/backend/app/modules/reporting/service.py): `backend/app/modules/reporting/service.py`
- [Autonomous agents](https://github.com/rahul9136-ai/khyati/blob/main/backend/app/modules/autonomy/service.py): `backend/app/modules/autonomy/service.py`
- [Approval integrations](https://github.com/rahul9136-ai/khyati/blob/main/backend/app/modules/integrations/service.py): `backend/app/modules/integrations/service.py`

### Backend platform

- [FastAPI application](https://github.com/rahul9136-ai/khyati/blob/main/backend/app/main.py): `backend/app/main.py`
- [Identity and RBAC](https://github.com/rahul9136-ai/khyati/blob/main/backend/app/modules/identity/service.py): `backend/app/modules/identity/service.py`
- [Workforce records](https://github.com/rahul9136-ai/khyati/blob/main/backend/app/modules/workforce/service.py): `backend/app/modules/workforce/service.py`
- [Webhook delivery](https://github.com/rahul9136-ai/khyati/blob/main/backend/app/modules/connect/webhooks.py): `backend/app/modules/connect/webhooks.py`
- [Relational database](https://github.com/rahul9136-ai/khyati/blob/main/backend/app/db/session.py): `backend/app/db/session.py`

### Other components

- **Workforce user**
- **BI tools**
- **Slack and Teams**

## Connections

- Workforce user → Product shell: uses
- Product shell → Forecasting: navigates
- Product shell → Schedule timeline: navigates
- Forecasting → Forecast engine: forecasts via
- Capacity planning → Capacity engine: calculates with
- Scenario studio → Capacity engine: runs scenarios
- Workforce user → Schedule timeline: edits schedules
- Schedule timeline → API and sync: syncs plans
- API and sync → Day-plan service: saves day plans
- API and sync → Identity and RBAC: authenticates
- FastAPI application → Webhook delivery: starts dispatcher (evidence: `backend/app/main.py`)
- Forecasting → API and sync: publishes forecast
- API and sync → BI tools: serves forecast
- Forecasting → Webhook delivery: publishes event
- Capacity planning → Headcount planning: plans headcount
- Live operations → Intraday service: uses
- Reports → Reporting service: requests reports
- Automation → Autonomous agents: controls agents
- Autonomous agents → Approval integrations: dispatches approvals (evidence: `backend/app/modules/autonomy/service.py`)
- Approval integrations → Slack and Teams: routes approvals (evidence: `backend/app/modules/integrations/service.py`)
- Day-plan service → Relational database: persists plans (evidence: `backend/app/modules/scheduling/dayplan_service.py`)
- Identity and RBAC → Relational database: stores identity
- Workforce records → Relational database: stores workforce
- Attendance → Relational database: stores attendance
- Reporting service → Relational database: reads records
