# deepmehta06/investiq architecture

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

- Interactive diagram: https://gitdiagram.com/deepmehta06/investiq
- Repository: https://github.com/deepmehta06/investiq

## Overview

Portfolio Optimization Engine is a React dashboard for configuring and comparing historical, ML-enhanced, and Black-Litterman portfolio strategies. The user selects assets, dates, an objective, and optional Black-Litterman views, then runs an optimization request and reviews portfolio metrics; efficient-frontier and allocation charts are documented as planned. The README documents the backend architecture, but the backend directories contain no sampled implementation, so those relationships reflect README claims rather than inspected code. The frontend-to-backend workflow is supported by the sampled frontend source and README.

Main entry points: [`frontend/src/components/ConfigPanel/ConfigPanel.tsx`](https://github.com/deepmehta06/investiq/blob/main/frontend/src/components/ConfigPanel/ConfigPanel.tsx) (Config Panel), [`frontend/src/store/usePortfolioStore.ts`](https://github.com/deepmehta06/investiq/blob/main/frontend/src/store/usePortfolioStore.ts) (Portfolio State), [`backend/optimization`](https://github.com/deepmehta06/investiq/tree/main/backend/optimization) (Optimization Core), [`frontend/src/components/AppShell/AppShell.tsx`](https://github.com/deepmehta06/investiq/blob/main/frontend/src/components/AppShell/AppShell.tsx) (App Shell)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_dashboard["Dashboard"]
  node_app["Application<br/>[App.tsx]"]
  node_shell["App Shell<br/>[AppShell.tsx]"]
  node_topbar["Health Indicator<br/>[TopBar.tsx]"]
  node_results["Results Area<br/>[ResultsArea.tsx]"]
  node_metrics["Risk Metrics<br/>[MetricsRow.tsx]"]
  node_metric_card["Metric Card<br/>[MetricCard.tsx]"]
end

subgraph group_configuration["Configuration"]
  node_config["Config Panel<br/>[ConfigPanel.tsx]"]
  node_assets["Asset Selector<br/>[AssetSelector.tsx]"]
  node_strategy["Strategy Selector<br/>[StrategyToggle.tsx]"]
  node_objective["Objective Selector"]
  node_bl_views["BL Views<br/>[BLViewsTable.tsx]"]
end

subgraph group_request_state["Request and State"]
  node_store["Portfolio State"]
  node_types["API and Domain Types<br/>[index.ts]"]
  node_optimize_hook["Optimization Flow<br/>[useOptimize.ts]"]
  node_api_service["API Client<br/>[apiService.ts]"]
end

subgraph group_optimization["Optimization Backend"]
  node_api["FastAPI"]
  node_optimizer["Optimization Core"]
  node_ml["ML Covariance"]
  node_black_litterman["Black-Litterman"]
  node_market_data["Market Data"]
  node_risk["Risk Metrics Engine"]
end

node_analyst(("Analyst"))

node_analyst -->|"configures"| node_config
node_app -->|"renders"| node_shell
node_shell -->|"renders"| node_topbar
node_shell -->|"renders"| node_config
node_shell -->|"renders"| node_results
node_config -->|"renders"| node_assets
node_config -->|"renders"| node_strategy
node_config -->|"renders"| node_objective
node_config -->|"renders conditionally"| node_bl_views
node_assets -->|"updates"| node_store
node_strategy -->|"updates"| node_store
node_objective -->|"updates"| node_store
node_bl_views -->|"updates"| node_store
node_config -->|"runs"| node_optimize_hook
node_optimize_hook -->|"reads and updates"| node_store
node_optimize_hook -->|"submits request"| node_api_service
node_api_service -->|"sends HTTP request"| node_api
node_api -->|"dispatches optimization"| node_optimizer
node_optimizer -->|"uses covariance estimator"| node_ml
node_optimizer -->|"uses strategy"| node_black_litterman
node_optimizer -->|"retrieves market data"| node_market_data
node_api -->|"returns result"| node_api_service
node_results -->|"reads result state"| node_store
node_results -->|"renders"| node_metrics
node_metrics -->|"reads metrics"| node_store
node_metrics -->|"renders"| node_metric_card
node_topbar -->|"checks health"| node_api_service
node_optimizer -.->|"computes risk metrics"| node_risk

click node_app "https://github.com/deepmehta06/investiq/blob/main/frontend/src/App.tsx"
click node_shell "https://github.com/deepmehta06/investiq/blob/main/frontend/src/components/AppShell/AppShell.tsx"
click node_topbar "https://github.com/deepmehta06/investiq/blob/main/frontend/src/components/TopBar/TopBar.tsx"
click node_results "https://github.com/deepmehta06/investiq/blob/main/frontend/src/components/ResultsArea/ResultsArea.tsx"
click node_metrics "https://github.com/deepmehta06/investiq/blob/main/frontend/src/components/MetricsRow/MetricsRow.tsx"
click node_metric_card "https://github.com/deepmehta06/investiq/blob/main/frontend/src/components/MetricsRow/MetricCard.tsx"
click node_config "https://github.com/deepmehta06/investiq/blob/main/frontend/src/components/ConfigPanel/ConfigPanel.tsx"
click node_assets "https://github.com/deepmehta06/investiq/blob/main/frontend/src/components/ConfigPanel/AssetSelector.tsx"
click node_strategy "https://github.com/deepmehta06/investiq/blob/main/frontend/src/components/ConfigPanel/StrategyToggle.tsx"
click node_objective "https://github.com/deepmehta06/investiq/blob/main/frontend/src/components/ConfigPanel/ObjectiveSelector.tsx"
click node_bl_views "https://github.com/deepmehta06/investiq/blob/main/frontend/src/components/ConfigPanel/BLViewsTable.tsx"
click node_store "https://github.com/deepmehta06/investiq/blob/main/frontend/src/store/usePortfolioStore.ts"
click node_types "https://github.com/deepmehta06/investiq/blob/main/frontend/src/types/index.ts"
click node_optimize_hook "https://github.com/deepmehta06/investiq/blob/main/frontend/src/hooks/useOptimize.ts"
click node_api_service "https://github.com/deepmehta06/investiq/blob/main/frontend/src/services/apiService.ts"
click node_api "https://github.com/deepmehta06/investiq/tree/main/backend/api"
click node_optimizer "https://github.com/deepmehta06/investiq/tree/main/backend/optimization"
click node_ml "https://github.com/deepmehta06/investiq/tree/main/backend/core"
click node_black_litterman "https://github.com/deepmehta06/investiq/tree/main/backend/optimization"
click node_market_data "https://github.com/deepmehta06/investiq/tree/main/backend/data"
click node_risk "https://github.com/deepmehta06/investiq/tree/main/backend/risk"

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_shell,node_topbar,node_results,node_metrics,node_metric_card toneBlue
class node_config,node_assets,node_strategy,node_objective,node_bl_views toneAmber
class node_store,node_types,node_optimize_hook,node_api_service toneMint
class node_api,node_optimizer,node_ml,node_black_litterman,node_market_data,node_risk toneRose
class node_analyst toneIndigo
```

## Components

### Dashboard

- [Application](https://github.com/deepmehta06/investiq/blob/main/frontend/src/App.tsx): `frontend/src/App.tsx`
- [App Shell](https://github.com/deepmehta06/investiq/blob/main/frontend/src/components/AppShell/AppShell.tsx): `frontend/src/components/AppShell/AppShell.tsx`
- [Health Indicator](https://github.com/deepmehta06/investiq/blob/main/frontend/src/components/TopBar/TopBar.tsx): `frontend/src/components/TopBar/TopBar.tsx`
- [Results Area](https://github.com/deepmehta06/investiq/blob/main/frontend/src/components/ResultsArea/ResultsArea.tsx): `frontend/src/components/ResultsArea/ResultsArea.tsx`
- [Risk Metrics](https://github.com/deepmehta06/investiq/blob/main/frontend/src/components/MetricsRow/MetricsRow.tsx): `frontend/src/components/MetricsRow/MetricsRow.tsx`
- [Metric Card](https://github.com/deepmehta06/investiq/blob/main/frontend/src/components/MetricsRow/MetricCard.tsx): `frontend/src/components/MetricsRow/MetricCard.tsx`

### Configuration

- [Config Panel](https://github.com/deepmehta06/investiq/blob/main/frontend/src/components/ConfigPanel/ConfigPanel.tsx): `frontend/src/components/ConfigPanel/ConfigPanel.tsx`
- [Asset Selector](https://github.com/deepmehta06/investiq/blob/main/frontend/src/components/ConfigPanel/AssetSelector.tsx): `frontend/src/components/ConfigPanel/AssetSelector.tsx`
- [Strategy Selector](https://github.com/deepmehta06/investiq/blob/main/frontend/src/components/ConfigPanel/StrategyToggle.tsx): `frontend/src/components/ConfigPanel/StrategyToggle.tsx`
- [Objective Selector](https://github.com/deepmehta06/investiq/blob/main/frontend/src/components/ConfigPanel/ObjectiveSelector.tsx): `frontend/src/components/ConfigPanel/ObjectiveSelector.tsx`
- [BL Views](https://github.com/deepmehta06/investiq/blob/main/frontend/src/components/ConfigPanel/BLViewsTable.tsx): `frontend/src/components/ConfigPanel/BLViewsTable.tsx`

### Request and State

- [Portfolio State](https://github.com/deepmehta06/investiq/blob/main/frontend/src/store/usePortfolioStore.ts): `frontend/src/store/usePortfolioStore.ts`
- [API and Domain Types](https://github.com/deepmehta06/investiq/blob/main/frontend/src/types/index.ts): `frontend/src/types/index.ts`
- [Optimization Flow](https://github.com/deepmehta06/investiq/blob/main/frontend/src/hooks/useOptimize.ts): `frontend/src/hooks/useOptimize.ts`
- [API Client](https://github.com/deepmehta06/investiq/blob/main/frontend/src/services/apiService.ts): `frontend/src/services/apiService.ts`

### Optimization Backend

- [FastAPI](https://github.com/deepmehta06/investiq/tree/main/backend/api): `backend/api`
- [Optimization Core](https://github.com/deepmehta06/investiq/tree/main/backend/optimization): `backend/optimization`
- [ML Covariance](https://github.com/deepmehta06/investiq/tree/main/backend/core): `backend/core`
- [Black-Litterman](https://github.com/deepmehta06/investiq/tree/main/backend/optimization): `backend/optimization`
- [Market Data](https://github.com/deepmehta06/investiq/tree/main/backend/data): `backend/data`
- [Risk Metrics Engine](https://github.com/deepmehta06/investiq/tree/main/backend/risk): `backend/risk`

### Other components

- **Analyst**

## Connections

- Analyst → Config Panel: configures (evidence: `frontend/src/components/ConfigPanel/ConfigPanel.tsx`)
- Application → App Shell: renders (evidence: `frontend/src/App.tsx`)
- App Shell → Health Indicator: renders (evidence: `frontend/src/components/AppShell/AppShell.tsx`)
- App Shell → Config Panel: renders (evidence: `frontend/src/components/AppShell/AppShell.tsx`)
- App Shell → Results Area: renders (evidence: `frontend/src/components/AppShell/AppShell.tsx`)
- Config Panel → Asset Selector: renders (evidence: `frontend/src/components/ConfigPanel/ConfigPanel.tsx`)
- Config Panel → Strategy Selector: renders (evidence: `frontend/src/components/ConfigPanel/ConfigPanel.tsx`)
- Config Panel → Objective Selector: renders (evidence: `frontend/src/components/ConfigPanel/ConfigPanel.tsx`)
- Config Panel → BL Views: renders conditionally (evidence: `frontend/src/components/ConfigPanel/ConfigPanel.tsx`)
- Asset Selector → Portfolio State: updates (evidence: `frontend/src/components/ConfigPanel/AssetSelector.tsx`)
- Strategy Selector → Portfolio State: updates (evidence: `frontend/src/components/ConfigPanel/StrategyToggle.tsx`)
- Objective Selector → Portfolio State: updates (evidence: `frontend/src/components/ConfigPanel/ObjectiveSelector.tsx`)
- BL Views → Portfolio State: updates (evidence: `frontend/src/components/ConfigPanel/BLViewsTable.tsx`)
- Config Panel → Optimization Flow: runs (evidence: `frontend/src/components/ConfigPanel/ConfigPanel.tsx`)
- Optimization Flow → Portfolio State: reads and updates (evidence: `frontend/src/hooks/useOptimize.ts`)
- Optimization Flow → API Client: submits request (evidence: `frontend/src/hooks/useOptimize.ts`)
- API Client → FastAPI: sends HTTP request (evidence: `README.md`)
- FastAPI → Optimization Core: dispatches optimization (evidence: `README.md`)
- Optimization Core → ML Covariance: uses covariance estimator (evidence: `README.md`)
- Optimization Core → Black-Litterman: uses strategy (evidence: `README.md`)
- Optimization Core → Market Data: retrieves market data (evidence: `README.md`)
- FastAPI → API Client: returns result (evidence: `frontend/src/services/apiService.ts`)
- Results Area → Portfolio State: reads result state (evidence: `frontend/src/components/ResultsArea/ResultsArea.tsx`)
- Results Area → Risk Metrics: renders (evidence: `frontend/src/components/ResultsArea/ResultsArea.tsx`)
- Risk Metrics → Portfolio State: reads metrics (evidence: `frontend/src/components/MetricsRow/MetricsRow.tsx`)
- Risk Metrics → Metric Card: renders (evidence: `frontend/src/components/MetricsRow/MetricsRow.tsx`)
- Health Indicator → API Client: checks health (evidence: `frontend/src/components/TopBar/TopBar.tsx`)
- Optimization Core → Risk Metrics Engine: computes risk metrics
