# vansh28v/janus-ai architecture

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

- Interactive diagram: https://gitdiagram.com/vansh28v/janus-ai
- Repository: https://github.com/vansh28v/janus-ai

## Overview

GridStock AI is a utility inventory-planning application: users inspect or upload datasets, select an active dataset, then explore demand forecasts, inventory, optimization, supplier intelligence, scenarios, and model evaluation in a Next.js dashboard. The FastAPI backend routes requests to dataset-management and domain services, with generated master data and workspace checks supporting analysis. The README is only the default Next.js template and documents no product capabilities. Edges below are limited to relationships shown in excerpts or the source index; unsampled frontend/API wiring is omitted where it cannot be established.

Main entry points: [`backend/app/main.py`](https://github.com/vansh28v/janus-ai/blob/master/backend/app/main.py) (FastAPI application), [`backend/app/core/dataset_manager.py`](https://github.com/vansh28v/janus-ai/blob/master/backend/app/core/dataset_manager.py) (Dataset registry and files), [`src/app/dashboard/page.tsx`](https://github.com/vansh28v/janus-ai/blob/master/src/app/dashboard/page.tsx) (Planning dashboard), [`backend/app/api/routes/dataset_lifecycle.py`](https://github.com/vansh28v/janus-ai/blob/master/backend/app/api/routes/dataset_lifecycle.py) (Dataset lifecycle routes)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_ui["Dashboard"]
  node_dash["Planning dashboard<br/>[page.tsx]"]
  node_inventory_ui["Inventory workspace<br/>[page.tsx]"]
  node_scenario_ui["Scenario workspace<br/>[page.tsx]"]
  node_forecast_ui["Forecast workspace<br/>[page.tsx]"]
  node_eval_ui["Model evaluation<br/>[page.tsx]"]
  node_data_ui["Data intelligence UI<br/>[page.tsx]"]
  node_dataset_ui["Dataset workspace<br/>[page.tsx]"]
  node_materials_ui["Materials workspace<br/>[page.tsx]"]
  node_locations_ui["Locations workspace<br/>[page.tsx]"]
  node_suppliers_ui["Supplier workspace<br/>[page.tsx]"]
  node_models_ui["Model workspace<br/>[page.tsx]"]
  node_calendar_ui["Planning calendar<br/>[page.tsx]"]
  node_active_source["Active source indicator"]
  node_supabase_client["Supabase browser client<br/>[client.ts]"]
end

subgraph group_api["API and Access"]
  node_api_app["FastAPI application<br/>[main.py]"]
  node_data_routes["Dataset intelligence routes"]
  node_lifecycle_routes["Dataset lifecycle routes"]
  node_forecast_routes["Forecast routes<br/>[forecasts.py]"]
  node_inventory_routes["Inventory routes<br/>[inventory.py]"]
  node_optimization_routes["Optimization routes<br/>[optimization.py]"]
  node_scenario_routes["Scenario routes<br/>[scenarios.py]"]
  node_supplier_routes["Supplier routes<br/>[suppliers.py]"]
  node_workspace_routes["Workspace status routes"]
  node_workspace_access["Workspace access control"]
end

subgraph group_datasets["Dataset Lifecycle"]
  node_dataset_manager[("Dataset registry and files<br/>[dataset_manager.py]")]
  node_normalizer["Dataset normalization"]
  node_quality["Dataset quality checks<br/>[dataset_quality.py]"]
  node_data_intel["Dataset intelligence"]
end

subgraph group_planning["Planning Intelligence"]
  node_forecasting["Forecast engine<br/>[forecasting.py]"]
  node_optimization["Inventory optimization<br/>[optimization.py]"]
  node_scenario_engine["Scenario intelligence"]
  node_supplier_intel["Supplier intelligence"]
end

subgraph group_domain["Utility Data"]
  node_master_data["Master data generator<br/>[master_data.py]"]
end

node_user(("Utility planner"))

node_user -->|"opens"| node_dash
node_dash -.->|"navigates"| node_inventory_ui
node_dash -->|"navigates"| node_forecast_ui
node_dash -->|"navigates"| node_scenario_ui
node_scenario_ui -->|"renders"| node_active_source
node_eval_ui -->|"renders"| node_active_source
node_forecast_ui -->|"uses"| node_active_source
node_inventory_ui -.->|"requests data"| node_api_app
node_scenario_ui -.->|"requests data"| node_api_app
node_forecast_ui -.->|"requests data"| node_api_app
node_active_source -->|"fetches active workspace"| node_workspace_routes
node_api_app -->|"registers"| node_forecast_routes
node_api_app -->|"registers"| node_inventory_routes
node_api_app -->|"registers"| node_optimization_routes
node_api_app -->|"registers"| node_scenario_routes
node_api_app -->|"registers"| node_supplier_routes
node_api_app -->|"registers"| node_data_routes
node_api_app -->|"registers"| node_lifecycle_routes
node_api_app -->|"registers"| node_workspace_routes
node_api_app -->|"installs middleware"| node_workspace_access
node_data_routes -->|"reads and updates"| node_dataset_manager
node_data_routes -->|"analyzes schema"| node_data_intel
node_lifecycle_routes -->|"manages datasets"| node_dataset_manager
node_lifecycle_routes -->|"normalizes dataset"| node_normalizer
node_lifecycle_routes -->|"validates dataset"| node_quality
node_forecast_routes -->|"loads dataset"| node_dataset_manager
node_forecast_routes -->|"generates forecasts"| node_forecasting
node_inventory_routes -->|"loads dataset"| node_dataset_manager
node_optimization_routes -->|"computes recommendations"| node_optimization
node_scenario_routes -->|"runs scenarios"| node_scenario_engine
node_supplier_routes -->|"analyzes suppliers"| node_supplier_intel
node_workspace_routes -->|"reads dataset state"| node_dataset_manager
node_workspace_routes -->|"checks permissions"| node_workspace_access
node_workspace_access -->|"checks active dataset"| node_dataset_manager
node_scenario_engine -->|"reads active dataset"| node_dataset_manager
node_master_data -.->|"supplies records"| node_inventory_routes
node_supabase_client -.->|"auth support"| node_user

click node_dash "https://github.com/vansh28v/janus-ai/blob/master/src/app/dashboard/page.tsx"
click node_inventory_ui "https://github.com/vansh28v/janus-ai/blob/master/src/app/dashboard/inventory/page.tsx"
click node_scenario_ui "https://github.com/vansh28v/janus-ai/blob/master/src/app/dashboard/scenarios/page.tsx"
click node_forecast_ui "https://github.com/vansh28v/janus-ai/blob/master/src/app/dashboard/forecasting/page.tsx"
click node_eval_ui "https://github.com/vansh28v/janus-ai/blob/master/src/app/dashboard/evaluation/page.tsx"
click node_data_ui "https://github.com/vansh28v/janus-ai/blob/master/src/app/dashboard/data-intelligence/page.tsx"
click node_dataset_ui "https://github.com/vansh28v/janus-ai/blob/master/src/app/dashboard/dataset/page.tsx"
click node_materials_ui "https://github.com/vansh28v/janus-ai/blob/master/src/app/dashboard/materials/page.tsx"
click node_locations_ui "https://github.com/vansh28v/janus-ai/blob/master/src/app/dashboard/locations/page.tsx"
click node_suppliers_ui "https://github.com/vansh28v/janus-ai/blob/master/src/app/dashboard/suppliers/page.tsx"
click node_models_ui "https://github.com/vansh28v/janus-ai/blob/master/src/app/dashboard/models/page.tsx"
click node_calendar_ui "https://github.com/vansh28v/janus-ai/blob/master/src/app/dashboard/calendar/page.tsx"
click node_active_source "https://github.com/vansh28v/janus-ai/blob/master/src/components/active-data-source.tsx"
click node_supabase_client "https://github.com/vansh28v/janus-ai/blob/master/src/utils/supabase/client.ts"
click node_api_app "https://github.com/vansh28v/janus-ai/blob/master/backend/app/main.py"
click node_data_routes "https://github.com/vansh28v/janus-ai/blob/master/backend/app/api/routes/data_intelligence.py"
click node_lifecycle_routes "https://github.com/vansh28v/janus-ai/blob/master/backend/app/api/routes/dataset_lifecycle.py"
click node_forecast_routes "https://github.com/vansh28v/janus-ai/blob/master/backend/app/api/routes/forecasts.py"
click node_inventory_routes "https://github.com/vansh28v/janus-ai/blob/master/backend/app/api/routes/inventory.py"
click node_optimization_routes "https://github.com/vansh28v/janus-ai/blob/master/backend/app/api/routes/optimization.py"
click node_scenario_routes "https://github.com/vansh28v/janus-ai/blob/master/backend/app/api/routes/scenarios.py"
click node_supplier_routes "https://github.com/vansh28v/janus-ai/blob/master/backend/app/api/routes/suppliers.py"
click node_workspace_routes "https://github.com/vansh28v/janus-ai/blob/master/backend/app/api/routes/workspace_status.py"
click node_workspace_access "https://github.com/vansh28v/janus-ai/blob/master/backend/app/core/workspace_access.py"
click node_dataset_manager "https://github.com/vansh28v/janus-ai/blob/master/backend/app/core/dataset_manager.py"
click node_normalizer "https://github.com/vansh28v/janus-ai/blob/master/backend/app/services/dataset_normalizer.py"
click node_quality "https://github.com/vansh28v/janus-ai/blob/master/backend/app/services/dataset_quality.py"
click node_data_intel "https://github.com/vansh28v/janus-ai/blob/master/backend/app/services/dataset_intelligence.py"
click node_forecasting "https://github.com/vansh28v/janus-ai/blob/master/backend/app/services/forecasting.py"
click node_optimization "https://github.com/vansh28v/janus-ai/blob/master/backend/app/services/optimization.py"
click node_scenario_engine "https://github.com/vansh28v/janus-ai/blob/master/backend/app/services/scenario_intelligence.py"
click node_supplier_intel "https://github.com/vansh28v/janus-ai/blob/master/backend/app/services/supplier_intelligence.py"
click node_master_data "https://github.com/vansh28v/janus-ai/blob/master/backend/app/data/master_data.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_dash,node_inventory_ui,node_scenario_ui,node_forecast_ui,node_eval_ui,node_data_ui,node_dataset_ui,node_materials_ui,node_locations_ui,node_suppliers_ui,node_models_ui,node_calendar_ui,node_active_source,node_supabase_client toneBlue
class node_api_app,node_data_routes,node_lifecycle_routes,node_forecast_routes,node_inventory_routes,node_optimization_routes,node_scenario_routes,node_supplier_routes,node_workspace_routes,node_workspace_access toneAmber
class node_dataset_manager,node_normalizer,node_quality,node_data_intel toneMint
class node_forecasting,node_optimization,node_scenario_engine,node_supplier_intel toneRose
class node_master_data,node_user toneIndigo
```

## Components

### Dashboard

- [Planning dashboard](https://github.com/vansh28v/janus-ai/blob/master/src/app/dashboard/page.tsx): `src/app/dashboard/page.tsx`
- [Inventory workspace](https://github.com/vansh28v/janus-ai/blob/master/src/app/dashboard/inventory/page.tsx): `src/app/dashboard/inventory/page.tsx`
- [Scenario workspace](https://github.com/vansh28v/janus-ai/blob/master/src/app/dashboard/scenarios/page.tsx): `src/app/dashboard/scenarios/page.tsx`
- [Forecast workspace](https://github.com/vansh28v/janus-ai/blob/master/src/app/dashboard/forecasting/page.tsx): `src/app/dashboard/forecasting/page.tsx`
- [Model evaluation](https://github.com/vansh28v/janus-ai/blob/master/src/app/dashboard/evaluation/page.tsx): `src/app/dashboard/evaluation/page.tsx`
- [Data intelligence UI](https://github.com/vansh28v/janus-ai/blob/master/src/app/dashboard/data-intelligence/page.tsx): `src/app/dashboard/data-intelligence/page.tsx`
- [Dataset workspace](https://github.com/vansh28v/janus-ai/blob/master/src/app/dashboard/dataset/page.tsx): `src/app/dashboard/dataset/page.tsx`
- [Materials workspace](https://github.com/vansh28v/janus-ai/blob/master/src/app/dashboard/materials/page.tsx): `src/app/dashboard/materials/page.tsx`
- [Locations workspace](https://github.com/vansh28v/janus-ai/blob/master/src/app/dashboard/locations/page.tsx): `src/app/dashboard/locations/page.tsx`
- [Supplier workspace](https://github.com/vansh28v/janus-ai/blob/master/src/app/dashboard/suppliers/page.tsx): `src/app/dashboard/suppliers/page.tsx`
- [Model workspace](https://github.com/vansh28v/janus-ai/blob/master/src/app/dashboard/models/page.tsx): `src/app/dashboard/models/page.tsx`
- [Planning calendar](https://github.com/vansh28v/janus-ai/blob/master/src/app/dashboard/calendar/page.tsx): `src/app/dashboard/calendar/page.tsx`
- [Active source indicator](https://github.com/vansh28v/janus-ai/blob/master/src/components/active-data-source.tsx): `src/components/active-data-source.tsx`
- [Supabase browser client](https://github.com/vansh28v/janus-ai/blob/master/src/utils/supabase/client.ts): `src/utils/supabase/client.ts`

### API and Access

- [FastAPI application](https://github.com/vansh28v/janus-ai/blob/master/backend/app/main.py): `backend/app/main.py`
- [Dataset intelligence routes](https://github.com/vansh28v/janus-ai/blob/master/backend/app/api/routes/data_intelligence.py): `backend/app/api/routes/data_intelligence.py`
- [Dataset lifecycle routes](https://github.com/vansh28v/janus-ai/blob/master/backend/app/api/routes/dataset_lifecycle.py): `backend/app/api/routes/dataset_lifecycle.py`
- [Forecast routes](https://github.com/vansh28v/janus-ai/blob/master/backend/app/api/routes/forecasts.py): `backend/app/api/routes/forecasts.py`
- [Inventory routes](https://github.com/vansh28v/janus-ai/blob/master/backend/app/api/routes/inventory.py): `backend/app/api/routes/inventory.py`
- [Optimization routes](https://github.com/vansh28v/janus-ai/blob/master/backend/app/api/routes/optimization.py): `backend/app/api/routes/optimization.py`
- [Scenario routes](https://github.com/vansh28v/janus-ai/blob/master/backend/app/api/routes/scenarios.py): `backend/app/api/routes/scenarios.py`
- [Supplier routes](https://github.com/vansh28v/janus-ai/blob/master/backend/app/api/routes/suppliers.py): `backend/app/api/routes/suppliers.py`
- [Workspace status routes](https://github.com/vansh28v/janus-ai/blob/master/backend/app/api/routes/workspace_status.py): `backend/app/api/routes/workspace_status.py`
- [Workspace access control](https://github.com/vansh28v/janus-ai/blob/master/backend/app/core/workspace_access.py): `backend/app/core/workspace_access.py`

### Dataset Lifecycle

- [Dataset registry and files](https://github.com/vansh28v/janus-ai/blob/master/backend/app/core/dataset_manager.py): `backend/app/core/dataset_manager.py`
- [Dataset normalization](https://github.com/vansh28v/janus-ai/blob/master/backend/app/services/dataset_normalizer.py): `backend/app/services/dataset_normalizer.py`
- [Dataset quality checks](https://github.com/vansh28v/janus-ai/blob/master/backend/app/services/dataset_quality.py): `backend/app/services/dataset_quality.py`
- [Dataset intelligence](https://github.com/vansh28v/janus-ai/blob/master/backend/app/services/dataset_intelligence.py): `backend/app/services/dataset_intelligence.py`

### Planning Intelligence

- [Forecast engine](https://github.com/vansh28v/janus-ai/blob/master/backend/app/services/forecasting.py): `backend/app/services/forecasting.py`
- [Inventory optimization](https://github.com/vansh28v/janus-ai/blob/master/backend/app/services/optimization.py): `backend/app/services/optimization.py`
- [Scenario intelligence](https://github.com/vansh28v/janus-ai/blob/master/backend/app/services/scenario_intelligence.py): `backend/app/services/scenario_intelligence.py`
- [Supplier intelligence](https://github.com/vansh28v/janus-ai/blob/master/backend/app/services/supplier_intelligence.py): `backend/app/services/supplier_intelligence.py`

### Utility Data

- [Master data generator](https://github.com/vansh28v/janus-ai/blob/master/backend/app/data/master_data.py): `backend/app/data/master_data.py`

### Other components

- **Utility planner**

## Connections

- Utility planner → Planning dashboard: opens
- Planning dashboard → Inventory workspace: navigates
- Planning dashboard → Forecast workspace: navigates (evidence: `src/app/dashboard/page.tsx`)
- Planning dashboard → Scenario workspace: navigates (evidence: `src/app/dashboard/page.tsx`)
- Scenario workspace → Active source indicator: renders (evidence: `src/app/dashboard/scenarios/page.tsx`)
- Model evaluation → Active source indicator: renders (evidence: `src/app/dashboard/evaluation/page.tsx`)
- Forecast workspace → Active source indicator: uses (evidence: `src/app/dashboard/forecasting/page.tsx`)
- Inventory workspace → FastAPI application: requests data
- Scenario workspace → FastAPI application: requests data
- Forecast workspace → FastAPI application: requests data
- Active source indicator → Workspace status routes: fetches active workspace (evidence: `src/components/active-data-source.tsx`)
- FastAPI application → Forecast routes: registers (evidence: `backend/app/main.py`)
- FastAPI application → Inventory routes: registers (evidence: `backend/app/main.py`)
- FastAPI application → Optimization routes: registers (evidence: `backend/app/main.py`)
- FastAPI application → Scenario routes: registers (evidence: `backend/app/main.py`)
- FastAPI application → Supplier routes: registers (evidence: `backend/app/main.py`)
- FastAPI application → Dataset intelligence routes: registers (evidence: `backend/app/main.py`)
- FastAPI application → Dataset lifecycle routes: registers (evidence: `backend/app/main.py`)
- FastAPI application → Workspace status routes: registers (evidence: `backend/app/main.py`)
- FastAPI application → Workspace access control: installs middleware (evidence: `backend/app/main.py`)
- Dataset intelligence routes → Dataset registry and files: reads and updates (evidence: `backend/app/api/routes/data_intelligence.py`)
- Dataset intelligence routes → Dataset intelligence: analyzes schema (evidence: `backend/app/api/routes/data_intelligence.py`)
- Dataset lifecycle routes → Dataset registry and files: manages datasets (evidence: `backend/app/api/routes/dataset_lifecycle.py`)
- Dataset lifecycle routes → Dataset normalization: normalizes dataset (evidence: `backend/app/api/routes/dataset_lifecycle.py`)
- Dataset lifecycle routes → Dataset quality checks: validates dataset (evidence: `backend/app/api/routes/dataset_lifecycle.py`)
- Forecast routes → Dataset registry and files: loads dataset (evidence: `backend/app/api/routes/forecasts.py`)
- Forecast routes → Forecast engine: generates forecasts (evidence: `backend/app/api/routes/forecasts.py`)
- Inventory routes → Dataset registry and files: loads dataset (evidence: `backend/app/api/routes/inventory.py`)
- Optimization routes → Inventory optimization: computes recommendations (evidence: `backend/app/api/routes/optimization.py`)
- Scenario routes → Scenario intelligence: runs scenarios (evidence: `backend/app/api/routes/scenarios.py`)
- Supplier routes → Supplier intelligence: analyzes suppliers (evidence: `backend/app/api/routes/suppliers.py`)
- Workspace status routes → Dataset registry and files: reads dataset state (evidence: `backend/app/api/routes/workspace_status.py`)
- Workspace status routes → Workspace access control: checks permissions (evidence: `backend/app/api/routes/workspace_status.py`)
- Workspace access control → Dataset registry and files: checks active dataset (evidence: `backend/app/core/workspace_access.py`)
- Scenario intelligence → Dataset registry and files: reads active dataset (evidence: `backend/app/services/scenario_intelligence.py`)
- Master data generator → Inventory routes: supplies records
- Supabase browser client → Utility planner: auth support
