# nifelix97/llm-model architecture

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

- Interactive diagram: https://gitdiagram.com/nifelix97/llm-model
- Repository: https://github.com/nifelix97/llm-model

## Overview

DC-TIM is a React workspace for national-development policy analysis. Users enter through public landing/login routes, then protected workspace pages provide dashboard insights, policy optimization and monitoring, model prompting, data ingestion, model configuration, and user administration. Pages use shared authentication/state and a RAG API client to communicate with the backend. The README documents capabilities beyond the sampled implementation; page-to-API edges are supported by the source index, while detailed request behavior is only partially shown.

Main entry points: [`src/components/ProtectedRoute.tsx`](https://github.com/nifelix97/llm-model/blob/main/src/components/ProtectedRoute.tsx) (Access guard), [`src/lib/ragApi.ts`](https://github.com/nifelix97/llm-model/blob/main/src/lib/ragApi.ts) (RAG API client), [`src/routes/AppRoutes.tsx`](https://github.com/nifelix97/llm-model/blob/main/src/routes/AppRoutes.tsx) (Route dispatch), [`src/pages/DashboardPage.tsx`](https://github.com/nifelix97/llm-model/blob/main/src/pages/DashboardPage.tsx) (Indicator dashboard)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["App entry and access"]
  node_main["React bootstrap<br/>[main.tsx]"]
  node_routes["Route dispatch<br/>[AppRoutes.tsx]"]
  node_protected["Access guard<br/>[ProtectedRoute.tsx]"]
  node_landing["Public landing<br/>[LandingPage.tsx]"]
  node_login["Login page<br/>[LoginPage.tsx]"]
  node_notfound["Not found<br/>[NotFoundPage.tsx]"]
end

subgraph group_analysis["Policy analysis"]
  node_dashboard["Indicator dashboard<br/>[DashboardPage.tsx]"]
  node_digital["Digital twin<br/>[DigitalTwin.tsx]"]
  node_optimize["Policy optimization"]
  node_monitor["Policy monitoring"]
  node_prompt["Model prompt<br/>[PromptPage.tsx]"]
end

subgraph group_knowledge["Model and knowledge"]
  node_datalake["Data lake<br/>[DataLakePage.tsx]"]
  node_modelconfig["Model configuration"]
end

subgraph group_workspace["Workspace operations"]
  node_users["User management"]
end

subgraph group_shared["Shared runtime"]
  node_auth["Authentication state<br/>[AuthContext.tsx]"]
  node_layout["Workspace shell<br/>[AppLayout.tsx]"]
  node_analysisstate[("Analysis handoff")]
  node_api["RAG API client<br/>[ragApi.ts]"]
end

node_user(("Policymaker"))
node_backend{{"RAG and auth backend"}}

node_user -.->|"opens app"| node_main
node_main -->|"mounts routes"| node_routes
node_routes -->|"routes public"| node_landing
node_routes -->|"routes public"| node_login
node_routes -->|"guards workspace"| node_protected
node_protected -->|"renders"| node_dashboard
node_protected -->|"renders"| node_prompt
node_protected -->|"renders"| node_optimize
node_protected -->|"renders"| node_datalake
node_protected -->|"renders"| node_digital
node_protected -->|"renders"| node_modelconfig
node_protected -->|"renders"| node_monitor
node_protected -->|"renders"| node_users
node_routes -->|"falls back"| node_notfound
node_login -->|"signs in"| node_auth
node_protected -->|"checks session"| node_auth
node_auth -->|"auth requests"| node_api
node_auth -->|"clears on logout"| node_analysisstate
node_dashboard -->|"uses shell"| node_layout
node_dashboard -->|"requests analysis"| node_api
node_dashboard -->|"loads handoff"| node_analysisstate
node_digital -->|"requests data"| node_api
node_optimize -->|"requests projections"| node_api
node_monitor -->|"loads monitoring"| node_api
node_prompt -->|"queries model"| node_api
node_prompt -.->|"shares analysis"| node_analysisstate
node_datalake -->|"manages training data"| node_api
node_modelconfig -->|"configures models"| node_api
node_users -->|"manages users"| node_api
node_api -->|"sends requests"| node_backend

click node_main "https://github.com/nifelix97/llm-model/blob/main/src/main.tsx"
click node_routes "https://github.com/nifelix97/llm-model/blob/main/src/routes/AppRoutes.tsx"
click node_protected "https://github.com/nifelix97/llm-model/blob/main/src/components/ProtectedRoute.tsx"
click node_landing "https://github.com/nifelix97/llm-model/blob/main/src/pages/LandingPage.tsx"
click node_login "https://github.com/nifelix97/llm-model/blob/main/src/pages/LoginPage.tsx"
click node_auth "https://github.com/nifelix97/llm-model/blob/main/src/context/AuthContext.tsx"
click node_layout "https://github.com/nifelix97/llm-model/blob/main/src/components/AppLayout.tsx"
click node_dashboard "https://github.com/nifelix97/llm-model/blob/main/src/pages/DashboardPage.tsx"
click node_digital "https://github.com/nifelix97/llm-model/blob/main/src/pages/DigitalTwin.tsx"
click node_optimize "https://github.com/nifelix97/llm-model/blob/main/src/pages/PolicyOptimizePage.tsx"
click node_monitor "https://github.com/nifelix97/llm-model/blob/main/src/pages/PolicyMonitoring.tsx"
click node_prompt "https://github.com/nifelix97/llm-model/blob/main/src/pages/PromptPage.tsx"
click node_analysisstate "https://github.com/nifelix97/llm-model/blob/main/src/context/AnalysisContext.tsx"
click node_datalake "https://github.com/nifelix97/llm-model/blob/main/src/pages/DataLakePage.tsx"
click node_modelconfig "https://github.com/nifelix97/llm-model/blob/main/src/pages/ModelConfigPage.tsx"
click node_users "https://github.com/nifelix97/llm-model/blob/main/src/pages/UserManagementPage.tsx"
click node_api "https://github.com/nifelix97/llm-model/blob/main/src/lib/ragApi.ts"
click node_notfound "https://github.com/nifelix97/llm-model/blob/main/src/pages/NotFoundPage.tsx"

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_main,node_routes,node_protected,node_landing,node_login,node_notfound toneBlue
class node_dashboard,node_digital,node_optimize,node_monitor,node_prompt toneAmber
class node_datalake,node_modelconfig toneMint
class node_users toneRose
class node_auth,node_layout,node_analysisstate,node_api,node_user,node_backend toneIndigo
```

## Components

### App entry and access

- [React bootstrap](https://github.com/nifelix97/llm-model/blob/main/src/main.tsx): `src/main.tsx`
- [Route dispatch](https://github.com/nifelix97/llm-model/blob/main/src/routes/AppRoutes.tsx): `src/routes/AppRoutes.tsx`
- [Access guard](https://github.com/nifelix97/llm-model/blob/main/src/components/ProtectedRoute.tsx): `src/components/ProtectedRoute.tsx`
- [Public landing](https://github.com/nifelix97/llm-model/blob/main/src/pages/LandingPage.tsx): `src/pages/LandingPage.tsx`
- [Login page](https://github.com/nifelix97/llm-model/blob/main/src/pages/LoginPage.tsx): `src/pages/LoginPage.tsx`
- [Not found](https://github.com/nifelix97/llm-model/blob/main/src/pages/NotFoundPage.tsx): `src/pages/NotFoundPage.tsx`

### Policy analysis

- [Indicator dashboard](https://github.com/nifelix97/llm-model/blob/main/src/pages/DashboardPage.tsx): `src/pages/DashboardPage.tsx`
- [Digital twin](https://github.com/nifelix97/llm-model/blob/main/src/pages/DigitalTwin.tsx): `src/pages/DigitalTwin.tsx`
- [Policy optimization](https://github.com/nifelix97/llm-model/blob/main/src/pages/PolicyOptimizePage.tsx): `src/pages/PolicyOptimizePage.tsx`
- [Policy monitoring](https://github.com/nifelix97/llm-model/blob/main/src/pages/PolicyMonitoring.tsx): `src/pages/PolicyMonitoring.tsx`
- [Model prompt](https://github.com/nifelix97/llm-model/blob/main/src/pages/PromptPage.tsx): `src/pages/PromptPage.tsx`

### Model and knowledge

- [Data lake](https://github.com/nifelix97/llm-model/blob/main/src/pages/DataLakePage.tsx): `src/pages/DataLakePage.tsx`
- [Model configuration](https://github.com/nifelix97/llm-model/blob/main/src/pages/ModelConfigPage.tsx): `src/pages/ModelConfigPage.tsx`

### Workspace operations

- [User management](https://github.com/nifelix97/llm-model/blob/main/src/pages/UserManagementPage.tsx): `src/pages/UserManagementPage.tsx`

### Shared runtime

- [Authentication state](https://github.com/nifelix97/llm-model/blob/main/src/context/AuthContext.tsx): `src/context/AuthContext.tsx`
- [Workspace shell](https://github.com/nifelix97/llm-model/blob/main/src/components/AppLayout.tsx): `src/components/AppLayout.tsx`
- [Analysis handoff](https://github.com/nifelix97/llm-model/blob/main/src/context/AnalysisContext.tsx): `src/context/AnalysisContext.tsx`
- [RAG API client](https://github.com/nifelix97/llm-model/blob/main/src/lib/ragApi.ts): `src/lib/ragApi.ts`

### Other components

- **Policymaker**
- **RAG and auth backend**

## Connections

- Policymaker → React bootstrap: opens app (evidence: `README.md`)
- React bootstrap → Route dispatch: mounts routes (evidence: `src/main.tsx`)
- Route dispatch → Public landing: routes public (evidence: `src/routes/AppRoutes.tsx`)
- Route dispatch → Login page: routes public (evidence: `src/routes/AppRoutes.tsx`)
- Route dispatch → Access guard: guards workspace (evidence: `src/routes/AppRoutes.tsx`)
- Access guard → Indicator dashboard: renders (evidence: `src/routes/AppRoutes.tsx`)
- Access guard → Model prompt: renders (evidence: `src/routes/AppRoutes.tsx`)
- Access guard → Policy optimization: renders (evidence: `src/routes/AppRoutes.tsx`)
- Access guard → Data lake: renders (evidence: `src/routes/AppRoutes.tsx`)
- Access guard → Digital twin: renders (evidence: `src/routes/AppRoutes.tsx`)
- Access guard → Model configuration: renders (evidence: `src/routes/AppRoutes.tsx`)
- Access guard → Policy monitoring: renders (evidence: `src/routes/AppRoutes.tsx`)
- Access guard → User management: renders (evidence: `src/routes/AppRoutes.tsx`)
- Route dispatch → Not found: falls back (evidence: `src/routes/AppRoutes.tsx`)
- Login page → Authentication state: signs in (evidence: `src/pages/LoginPage.tsx`)
- Access guard → Authentication state: checks session (evidence: `src/components/ProtectedRoute.tsx`)
- Authentication state → RAG API client: auth requests (evidence: `src/context/AuthContext.tsx`)
- Authentication state → Analysis handoff: clears on logout (evidence: `src/context/AuthContext.tsx`)
- Indicator dashboard → Workspace shell: uses shell (evidence: `src/pages/DashboardPage.tsx`)
- Indicator dashboard → RAG API client: requests analysis (evidence: `src/pages/DashboardPage.tsx`)
- Indicator dashboard → Analysis handoff: loads handoff (evidence: `src/pages/DashboardPage.tsx`)
- Digital twin → RAG API client: requests data (evidence: `src/pages/DigitalTwin.tsx`)
- Policy optimization → RAG API client: requests projections (evidence: `src/pages/PolicyOptimizePage.tsx`)
- Policy monitoring → RAG API client: loads monitoring (evidence: `src/pages/PolicyMonitoring.tsx`)
- Model prompt → RAG API client: queries model (evidence: `src/pages/PromptPage.tsx`)
- Model prompt → Analysis handoff: shares analysis (evidence: `README.md`)
- Data lake → RAG API client: manages training data (evidence: `src/pages/DataLakePage.tsx`)
- Model configuration → RAG API client: configures models (evidence: `src/pages/ModelConfigPage.tsx`)
- User management → RAG API client: manages users (evidence: `src/pages/UserManagementPage.tsx`)
- RAG API client → RAG and auth backend: sends requests (evidence: `src/lib/ragApi.ts`)
