# hus-king/finpulse architecture

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

- Interactive diagram: https://gitdiagram.com/hus-king/finpulse
- Repository: https://github.com/hus-king/finpulse

## Overview

FinPulse is a stock-news research platform: users browse or search stocks, collect historical prices and news, review cleaned materials and AI analysis, and explore community sentiment and briefings. The React interface calls a FastAPI backend; the research service coordinates data collection, cleaning, analysis, and persistence. Authentication, account-scoped watchlists, administration, and scheduled briefings are supporting capabilities. Some backend modules are unsampled, so edges for those are included only where the README or source index supports the relationship.

Main entry points: [`backend/research.py`](https://github.com/hus-king/finpulse/blob/main/backend/research.py) (Research service), [`src/App.tsx`](https://github.com/hus-king/finpulse/blob/main/src/App.tsx) (Main dashboard), [`backend/app.py`](https://github.com/hus-king/finpulse/blob/main/backend/app.py) (FastAPI application), [`src/api.ts`](https://github.com/hus-king/finpulse/blob/main/src/api.ts) (API client)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_frontend["Web interface"]
  node_app_ui["Main dashboard<br/>[App.tsx]"]
  node_dashboard["Research dashboard"]
  node_stock_search["Stock search<br/>[StockSearch.tsx]"]
  node_chart["Price chart<br/>[PriceChart.tsx]"]
  node_community_ui["Community card<br/>[CommunityCard.tsx]"]
  node_briefing_ui["Briefing panel<br/>[BriefingPanel.tsx]"]
  node_admin_ui["Admin panel<br/>[AdminPanel.tsx]"]
  node_auth_ui["Authentication context<br/>[AuthContext.tsx]"]
  node_api_client["API client<br/>[api.ts]"]
end

subgraph group_api["API and access"]
  node_fastapi["FastAPI application<br/>[app.py]"]
  node_auth["Authentication<br/>[auth.py]"]
  node_research_api["Research routes<br/>[research_api.py]"]
end

subgraph group_research["Research pipeline"]
  node_research_service["Research service<br/>[research.py]"]
  node_providers["Live data providers<br/>[providers.py]"]
  node_cleaning["News cleaning<br/>[news_cleaning.py]"]
  node_prompts["Analysis prompts<br/>[prompts.py]"]
  node_model_service["Chat-completions model"]
end

subgraph group_data["Data and insights"]
  node_stock_catalog["Stock catalog<br/>[stock_catalog.py]"]
  node_community["Community analysis<br/>[community.py]"]
  node_recommendations["Recommendation ranking<br/>[recommendations.py]"]
  node_research_store[("Research records<br/>[research_store.py]")]
  node_auth_store[("Account storage<br/>[database.py]")]
end

subgraph group_briefings["Briefings"]
  node_morning["Morning scheduler<br/>[morning.py]"]
  node_briefing["Briefing builder<br/>[briefing.py]"]
  node_notification["Email / PushPlus"]
end

node_user(("Investor"))

node_user -->|"uses"| node_app_ui
node_app_ui -->|"renders"| node_dashboard
node_app_ui -->|"opens"| node_stock_search
node_app_ui -->|"shows"| node_briefing_ui
node_app_ui -->|"shows"| node_admin_ui
node_app_ui -->|"uses"| node_auth_ui
node_dashboard -->|"renders"| node_chart
node_dashboard -->|"renders"| node_community_ui
node_app_ui -->|"requests data"| node_api_client
node_auth_ui -->|"manages session"| node_api_client
node_briefing_ui -->|"requests briefings"| node_api_client
node_stock_search -->|"searches stocks"| node_api_client
node_api_client -->|"HTTP requests"| node_fastapi
node_fastapi -->|"registers routes"| node_auth
node_fastapi -->|"registers routes"| node_research_api
node_fastapi -->|"initializes"| node_research_service
node_auth -->|"stores accounts"| node_auth_store
node_research_api -->|"dispatches research"| node_research_service
node_research_service -->|"fetches data"| node_providers
node_providers -->|"normalizes sources"| node_cleaning
node_research_service -->|"cleans news"| node_cleaning
node_research_service -->|"builds analysis"| node_prompts
node_research_service -->|"requests analysis"| node_model_service
node_research_service -->|"persists results"| node_research_store
node_research_service -->|"resolves stocks"| node_stock_catalog
node_research_service -->|"collects sentiment"| node_community
node_research_service -->|"ranks stocks"| node_recommendations
node_fastapi -->|"starts scheduler"| node_morning
node_morning -->|"builds daily report"| node_briefing
node_briefing -->|"orders candidates"| node_recommendations
node_morning -.->|"sends results"| node_notification

click node_app_ui "https://github.com/hus-king/finpulse/blob/main/src/App.tsx"
click node_dashboard "https://github.com/hus-king/finpulse/blob/main/src/ResearchDashboard.tsx"
click node_stock_search "https://github.com/hus-king/finpulse/blob/main/src/StockSearch.tsx"
click node_chart "https://github.com/hus-king/finpulse/blob/main/src/PriceChart.tsx"
click node_community_ui "https://github.com/hus-king/finpulse/blob/main/src/CommunityCard.tsx"
click node_briefing_ui "https://github.com/hus-king/finpulse/blob/main/src/BriefingPanel.tsx"
click node_admin_ui "https://github.com/hus-king/finpulse/blob/main/src/AdminPanel.tsx"
click node_auth_ui "https://github.com/hus-king/finpulse/blob/main/src/AuthContext.tsx"
click node_api_client "https://github.com/hus-king/finpulse/blob/main/src/api.ts"
click node_fastapi "https://github.com/hus-king/finpulse/blob/main/backend/app.py"
click node_auth "https://github.com/hus-king/finpulse/blob/main/backend/auth.py"
click node_research_api "https://github.com/hus-king/finpulse/blob/main/backend/research_api.py"
click node_research_service "https://github.com/hus-king/finpulse/blob/main/backend/research.py"
click node_providers "https://github.com/hus-king/finpulse/blob/main/backend/providers.py"
click node_cleaning "https://github.com/hus-king/finpulse/blob/main/backend/news_cleaning.py"
click node_prompts "https://github.com/hus-king/finpulse/blob/main/backend/prompts.py"
click node_stock_catalog "https://github.com/hus-king/finpulse/blob/main/backend/stock_catalog.py"
click node_community "https://github.com/hus-king/finpulse/blob/main/backend/community.py"
click node_recommendations "https://github.com/hus-king/finpulse/blob/main/backend/recommendations.py"
click node_research_store "https://github.com/hus-king/finpulse/blob/main/backend/research_store.py"
click node_auth_store "https://github.com/hus-king/finpulse/blob/main/backend/database.py"
click node_morning "https://github.com/hus-king/finpulse/blob/main/backend/morning.py"
click node_briefing "https://github.com/hus-king/finpulse/blob/main/backend/briefing.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_app_ui,node_dashboard,node_stock_search,node_chart,node_community_ui,node_briefing_ui,node_admin_ui,node_auth_ui,node_api_client toneBlue
class node_fastapi,node_auth,node_research_api toneAmber
class node_research_service,node_providers,node_cleaning,node_prompts,node_model_service toneMint
class node_stock_catalog,node_community,node_recommendations,node_research_store,node_auth_store toneRose
class node_morning,node_briefing,node_notification,node_user toneIndigo
```

## Components

### Web interface

- [Main dashboard](https://github.com/hus-king/finpulse/blob/main/src/App.tsx): `src/App.tsx`
- [Research dashboard](https://github.com/hus-king/finpulse/blob/main/src/ResearchDashboard.tsx): `src/ResearchDashboard.tsx`
- [Stock search](https://github.com/hus-king/finpulse/blob/main/src/StockSearch.tsx): `src/StockSearch.tsx`
- [Price chart](https://github.com/hus-king/finpulse/blob/main/src/PriceChart.tsx): `src/PriceChart.tsx`
- [Community card](https://github.com/hus-king/finpulse/blob/main/src/CommunityCard.tsx): `src/CommunityCard.tsx`
- [Briefing panel](https://github.com/hus-king/finpulse/blob/main/src/BriefingPanel.tsx): `src/BriefingPanel.tsx`
- [Admin panel](https://github.com/hus-king/finpulse/blob/main/src/AdminPanel.tsx): `src/AdminPanel.tsx`
- [Authentication context](https://github.com/hus-king/finpulse/blob/main/src/AuthContext.tsx): `src/AuthContext.tsx`
- [API client](https://github.com/hus-king/finpulse/blob/main/src/api.ts): `src/api.ts`

### API and access

- [FastAPI application](https://github.com/hus-king/finpulse/blob/main/backend/app.py): `backend/app.py`
- [Authentication](https://github.com/hus-king/finpulse/blob/main/backend/auth.py): `backend/auth.py`
- [Research routes](https://github.com/hus-king/finpulse/blob/main/backend/research_api.py): `backend/research_api.py`

### Research pipeline

- [Research service](https://github.com/hus-king/finpulse/blob/main/backend/research.py): `backend/research.py`
- [Live data providers](https://github.com/hus-king/finpulse/blob/main/backend/providers.py): `backend/providers.py`
- [News cleaning](https://github.com/hus-king/finpulse/blob/main/backend/news_cleaning.py): `backend/news_cleaning.py`
- [Analysis prompts](https://github.com/hus-king/finpulse/blob/main/backend/prompts.py): `backend/prompts.py`
- **Chat-completions model**

### Data and insights

- [Stock catalog](https://github.com/hus-king/finpulse/blob/main/backend/stock_catalog.py): `backend/stock_catalog.py`
- [Community analysis](https://github.com/hus-king/finpulse/blob/main/backend/community.py): `backend/community.py`
- [Recommendation ranking](https://github.com/hus-king/finpulse/blob/main/backend/recommendations.py): `backend/recommendations.py`
- [Research records](https://github.com/hus-king/finpulse/blob/main/backend/research_store.py): `backend/research_store.py`
- [Account storage](https://github.com/hus-king/finpulse/blob/main/backend/database.py): `backend/database.py`

### Briefings

- [Morning scheduler](https://github.com/hus-king/finpulse/blob/main/backend/morning.py): `backend/morning.py`
- [Briefing builder](https://github.com/hus-king/finpulse/blob/main/backend/briefing.py): `backend/briefing.py`
- **Email / PushPlus**

### Other components

- **Investor**

## Connections

- Investor → Main dashboard: uses (evidence: `README.md`)
- Main dashboard → Research dashboard: renders (evidence: `src/App.tsx`)
- Main dashboard → Stock search: opens (evidence: `src/App.tsx`)
- Main dashboard → Briefing panel: shows (evidence: `src/App.tsx`)
- Main dashboard → Admin panel: shows (evidence: `src/App.tsx`)
- Main dashboard → Authentication context: uses (evidence: `src/App.tsx`)
- Research dashboard → Price chart: renders (evidence: `src/ResearchDashboard.tsx`)
- Research dashboard → Community card: renders (evidence: `src/ResearchDashboard.tsx`)
- Main dashboard → API client: requests data (evidence: `src/App.tsx`)
- Authentication context → API client: manages session (evidence: `src/AuthContext.tsx`)
- Briefing panel → API client: requests briefings (evidence: `src/BriefingPanel.tsx`)
- Stock search → API client: searches stocks (evidence: `src/StockSearch.tsx`)
- API client → FastAPI application: HTTP requests (evidence: `README.md`)
- FastAPI application → Authentication: registers routes (evidence: `backend/app.py`)
- FastAPI application → Research routes: registers routes (evidence: `backend/app.py`)
- FastAPI application → Research service: initializes (evidence: `backend/app.py`)
- Authentication → Account storage: stores accounts (evidence: `backend/database.py`)
- Research routes → Research service: dispatches research (evidence: `backend/research_api.py`)
- Research service → Live data providers: fetches data (evidence: `backend/research.py`)
- Live data providers → News cleaning: normalizes sources (evidence: `backend/providers.py`)
- Research service → News cleaning: cleans news (evidence: `backend/research.py`)
- Research service → Analysis prompts: builds analysis (evidence: `backend/research.py`)
- Research service → Chat-completions model: requests analysis
- Research service → Research records: persists results (evidence: `backend/research.py`)
- Research service → Stock catalog: resolves stocks (evidence: `backend/research.py`)
- Research service → Community analysis: collects sentiment (evidence: `backend/research.py`)
- Research service → Recommendation ranking: ranks stocks (evidence: `backend/recommendations.py`)
- FastAPI application → Morning scheduler: starts scheduler (evidence: `backend/app.py`)
- Morning scheduler → Briefing builder: builds daily report (evidence: `backend/morning.py`)
- Briefing builder → Recommendation ranking: orders candidates (evidence: `backend/briefing.py`)
- Morning scheduler → Email / PushPlus: sends results (evidence: `README.md`)
