# bilalchaudhry1122/mindpulse architecture

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

- Interactive diagram: https://gitdiagram.com/bilalchaudhry1122/mindpulse
- Repository: https://github.com/bilalchaudhry1122/mindpulse

## Overview

MindPulse is a web-based text analysis product for sentiment and psychological indicators. A user reaches the dashboard, submits text, and receives model-derived sentiment, risk levels, and sarcasm indicators; results can also be exported as a PDF. The README also documents Roman Urdu and NRC lexicon support, plus dashboard charts and presets. The graph includes the documented model and lexicon capabilities, but source excerpts do not establish every internal inference step; those are represented within the inference component rather than as speculative calls.

Main entry points: [`frontend/src/App.tsx`](https://github.com/bilalchaudhry1122/mindpulse/blob/main/frontend/src/App.tsx) (Web routes), [`frontend/src/api/analyze.ts`](https://github.com/bilalchaudhry1122/mindpulse/blob/main/frontend/src/api/analyze.ts) (Analysis API client), [`backend/src/routes/analyze.py`](https://github.com/bilalchaudhry1122/mindpulse/blob/main/backend/src/routes/analyze.py) (Analysis endpoint), [`backend/src/inference.py`](https://github.com/bilalchaudhry1122/mindpulse/blob/main/backend/src/inference.py) (Hybrid inference)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_experience["Web experience"]
  node_web_app["Web routes<br/>[App.tsx]"]
  node_landing["Landing experience<br/>[Home.jsx]"]
  node_scroll_canvas["Scroll canvas<br/>[ScrollCanvas.jsx]"]
  node_dashboard["Analysis dashboard<br/>[DashboardPage.tsx]"]
  node_tweets["Tweets analysis<br/>[TweetsPage.tsx]"]
end

subgraph group_identity["Identity"]
  node_auth_context["Auth state<br/>[AuthContext.tsx]"]
  node_auth_pages["Sign-in and signup<br/>[SignInPage.tsx]"]
  node_firebase_config["Firebase setup<br/>[firebase.ts]"]
end

subgraph group_analysis["Text analysis"]
  node_analysis_client["Analysis API client<br/>[analyze.ts]"]
  node_api_app["Flask app<br/>[app.py]"]
  node_analyze_route["Analysis endpoint<br/>[analyze.py]"]
  node_inference["Hybrid inference<br/>[inference.py]"]
  node_preprocessing["Text preprocessing"]
  node_lexicon_features["Lexicon features"]
end

subgraph group_reporting["Results and reports"]
  node_pdf_route["PDF endpoint<br/>[analyze.py]"]
  node_pdf_generator["PDF report generation<br/>[pdf_generator.py]"]
end

node_user(("User"))
node_firebase_auth["Firebase Authentication"]

node_user -->|"opens"| node_web_app
node_web_app -->|"routes to"| node_landing
node_web_app -->|"routes to"| node_dashboard
node_web_app -->|"routes to"| node_tweets
node_web_app -->|"routes to"| node_auth_pages
node_landing -->|"renders"| node_scroll_canvas
node_web_app -->|"provides"| node_auth_context
node_auth_pages -->|"uses"| node_auth_context
node_auth_context -->|"imports auth"| node_firebase_config
node_firebase_config -->|"configures"| node_firebase_auth
node_dashboard -->|"submits text"| node_analysis_client
node_tweets -->|"uses"| node_analysis_client
node_analysis_client -->|"POSTs analysis"| node_analyze_route
node_api_app -->|"registers"| node_analyze_route
node_api_app -->|"preloads models"| node_inference
node_analyze_route -->|"predicts text"| node_inference
node_analyze_route -->|"generates report"| node_pdf_generator
node_analysis_client -->|"POSTs report data"| node_pdf_route
node_preprocessing -.->|"prepares text"| node_inference
node_lexicon_features -.->|"supplies features"| node_inference

click node_web_app "https://github.com/bilalchaudhry1122/mindpulse/blob/main/frontend/src/App.tsx"
click node_landing "https://github.com/bilalchaudhry1122/mindpulse/blob/main/frontend/src/pages/Home.jsx"
click node_scroll_canvas "https://github.com/bilalchaudhry1122/mindpulse/blob/main/frontend/src/components/ScrollAnimation/ScrollCanvas.jsx"
click node_dashboard "https://github.com/bilalchaudhry1122/mindpulse/blob/main/frontend/src/pages/DashboardPage.tsx"
click node_tweets "https://github.com/bilalchaudhry1122/mindpulse/blob/main/frontend/src/pages/TweetsPage.tsx"
click node_auth_context "https://github.com/bilalchaudhry1122/mindpulse/blob/main/frontend/src/context/AuthContext.tsx"
click node_auth_pages "https://github.com/bilalchaudhry1122/mindpulse/blob/main/frontend/src/pages/SignInPage.tsx"
click node_firebase_config "https://github.com/bilalchaudhry1122/mindpulse/blob/main/frontend/src/lib/firebase.ts"
click node_analysis_client "https://github.com/bilalchaudhry1122/mindpulse/blob/main/frontend/src/api/analyze.ts"
click node_api_app "https://github.com/bilalchaudhry1122/mindpulse/blob/main/backend/src/app.py"
click node_analyze_route "https://github.com/bilalchaudhry1122/mindpulse/blob/main/backend/src/routes/analyze.py"
click node_inference "https://github.com/bilalchaudhry1122/mindpulse/blob/main/backend/src/inference.py"
click node_preprocessing "https://github.com/bilalchaudhry1122/mindpulse/blob/main/backend/src/data_preprocessing.py"
click node_lexicon_features "https://github.com/bilalchaudhry1122/mindpulse/blob/main/backend/src/lexicon_feature_extraction.py"
click node_pdf_route "https://github.com/bilalchaudhry1122/mindpulse/blob/main/backend/src/routes/analyze.py"
click node_pdf_generator "https://github.com/bilalchaudhry1122/mindpulse/blob/main/backend/src/pdf_generator.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_web_app,node_landing,node_scroll_canvas,node_dashboard,node_tweets,node_user toneBlue
class node_auth_context,node_auth_pages,node_firebase_config toneAmber
class node_analysis_client,node_api_app,node_analyze_route,node_inference,node_preprocessing,node_lexicon_features toneMint
class node_pdf_route,node_pdf_generator toneRose
class node_firebase_auth toneIndigo
```

## Components

### Web experience

- [Web routes](https://github.com/bilalchaudhry1122/mindpulse/blob/main/frontend/src/App.tsx): `frontend/src/App.tsx`
- [Landing experience](https://github.com/bilalchaudhry1122/mindpulse/blob/main/frontend/src/pages/Home.jsx): `frontend/src/pages/Home.jsx`
- [Scroll canvas](https://github.com/bilalchaudhry1122/mindpulse/blob/main/frontend/src/components/ScrollAnimation/ScrollCanvas.jsx): `frontend/src/components/ScrollAnimation/ScrollCanvas.jsx`
- [Analysis dashboard](https://github.com/bilalchaudhry1122/mindpulse/blob/main/frontend/src/pages/DashboardPage.tsx): `frontend/src/pages/DashboardPage.tsx`
- [Tweets analysis](https://github.com/bilalchaudhry1122/mindpulse/blob/main/frontend/src/pages/TweetsPage.tsx): `frontend/src/pages/TweetsPage.tsx`

### Identity

- [Auth state](https://github.com/bilalchaudhry1122/mindpulse/blob/main/frontend/src/context/AuthContext.tsx): `frontend/src/context/AuthContext.tsx`
- [Sign-in and signup](https://github.com/bilalchaudhry1122/mindpulse/blob/main/frontend/src/pages/SignInPage.tsx): `frontend/src/pages/SignInPage.tsx`
- [Firebase setup](https://github.com/bilalchaudhry1122/mindpulse/blob/main/frontend/src/lib/firebase.ts): `frontend/src/lib/firebase.ts`

### Text analysis

- [Analysis API client](https://github.com/bilalchaudhry1122/mindpulse/blob/main/frontend/src/api/analyze.ts): `frontend/src/api/analyze.ts`
- [Flask app](https://github.com/bilalchaudhry1122/mindpulse/blob/main/backend/src/app.py): `backend/src/app.py`
- [Analysis endpoint](https://github.com/bilalchaudhry1122/mindpulse/blob/main/backend/src/routes/analyze.py): `backend/src/routes/analyze.py`
- [Hybrid inference](https://github.com/bilalchaudhry1122/mindpulse/blob/main/backend/src/inference.py): `backend/src/inference.py`
- [Text preprocessing](https://github.com/bilalchaudhry1122/mindpulse/blob/main/backend/src/data_preprocessing.py): `backend/src/data_preprocessing.py`
- [Lexicon features](https://github.com/bilalchaudhry1122/mindpulse/blob/main/backend/src/lexicon_feature_extraction.py): `backend/src/lexicon_feature_extraction.py`

### Results and reports

- [PDF endpoint](https://github.com/bilalchaudhry1122/mindpulse/blob/main/backend/src/routes/analyze.py): `backend/src/routes/analyze.py`
- [PDF report generation](https://github.com/bilalchaudhry1122/mindpulse/blob/main/backend/src/pdf_generator.py): `backend/src/pdf_generator.py`

### Other components

- **User**
- **Firebase Authentication**

## Connections

- User → Web routes: opens (evidence: `frontend/src/App.tsx`)
- Web routes → Landing experience: routes to (evidence: `frontend/src/App.tsx`)
- Web routes → Analysis dashboard: routes to (evidence: `frontend/src/App.tsx`)
- Web routes → Tweets analysis: routes to (evidence: `frontend/src/App.tsx`)
- Web routes → Sign-in and signup: routes to (evidence: `frontend/src/App.tsx`)
- Landing experience → Scroll canvas: renders (evidence: `frontend/src/pages/Home.jsx`)
- Web routes → Auth state: provides (evidence: `frontend/src/App.tsx`)
- Sign-in and signup → Auth state: uses (evidence: `frontend/src/pages/SignInPage.tsx`)
- Auth state → Firebase setup: imports auth (evidence: `frontend/src/context/AuthContext.tsx`)
- Firebase setup → Firebase Authentication: configures (evidence: `frontend/src/lib/firebase.ts`)
- Analysis dashboard → Analysis API client: submits text (evidence: `frontend/src/pages/DashboardPage.tsx`)
- Tweets analysis → Analysis API client: uses (evidence: `frontend/src/pages/TweetsPage.tsx`)
- Analysis API client → Analysis endpoint: POSTs analysis (evidence: `frontend/src/api/analyze.ts`)
- Flask app → Analysis endpoint: registers (evidence: `backend/src/app.py`)
- Flask app → Hybrid inference: preloads models (evidence: `backend/src/app.py`)
- Analysis endpoint → Hybrid inference: predicts text (evidence: `backend/src/routes/analyze.py`)
- Analysis endpoint → PDF report generation: generates report (evidence: `backend/src/routes/analyze.py`)
- Analysis API client → PDF endpoint: POSTs report data (evidence: `frontend/src/api/analyze.ts`)
- Text preprocessing → Hybrid inference: prepares text
- Lexicon features → Hybrid inference: supplies features
