# lakshaysawhney/stockpulse architecture

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

- Interactive diagram: https://gitdiagram.com/lakshaysawhney/stockpulse
- Repository: https://github.com/lakshaysawhney/stockpulse

## Overview

StockPulse is a market-analysis web application: users authenticate, then use portfolio analysis, market forecasts and video discovery, an AI finance chat, community discussions, and portfolio backtesting. The Next.js client sends API requests through a shared client to Django services; portfolio analysis is implemented with CrewAI agents and market-data tools. The README documents major capabilities not fully visible in the excerpts, so those branches are represented at their documented feature level. Some backend routing and storage interactions are unsampled; those relationships are omitted or marked unverified.

Main entry points: [`client/utils/api.js`](https://github.com/lakshaysawhney/stockpulse/blob/main/client/utils/api.js) (API client), [`client/app/analyzer/page.js`](https://github.com/lakshaysawhney/stockpulse/blob/main/client/app/analyzer/page.js) (Portfolio analyzer), [`client/app/chat/page.js`](https://github.com/lakshaysawhney/stockpulse/blob/main/client/app/chat/page.js) (Finance assistant), [`client/app/community/page.js`](https://github.com/lakshaysawhney/stockpulse/blob/main/client/app/community/page.js) (Community feed)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Web client"]
  node_authui["Sign in<br/>[AuthProvider.js]"]
  node_apiclient["API client<br/>[api.js]"]
  node_dashboard["Dashboard<br/>[page.js]"]
  node_analyzer["Portfolio analyzer<br/>[page.js]"]
  node_market["Market explorer<br/>[page.js]"]
  node_chat["Finance assistant<br/>[page.js]"]
  node_community["Community feed<br/>[page.js]"]
  node_markdown["Report renderer<br/>[Markdown.js]"]
end

subgraph group_server["Django services"]
  node_authsvc["Authentication API<br/>[views.py]"]
  node_portfolioapi["Portfolio API<br/>[views.py]"]
  node_portfoliorecords[("Portfolio records<br/>[models.py]")]
  node_investment["Investment services<br/>[views.py]"]
  node_forum["Live discussions<br/>[consumers.py]"]
end

subgraph group_ai["AI and market data"]
  node_crewview["Agent endpoints<br/>[views.py]"]
  node_crews["Analysis crews<br/>[crews.py]"]
  node_tools["Market data tools<br/>[tools.py]"]
end

subgraph group_state["Application state"]
  node_database[("PostgreSQL")]
end

node_investor(("Investor"))
node_marketdata["Market data providers"]

node_investor -->|"signs in"| node_authui
node_authui -->|"authenticates through"| node_apiclient
node_investor -.->|"explores"| node_dashboard
node_dashboard -.->|"requests data"| node_apiclient
node_investor -->|"submits holdings"| node_analyzer
node_analyzer -->|"requests analysis"| node_apiclient
node_analyzer -->|"renders report"| node_markdown
node_investor -->|"explores trends"| node_market
node_market -->|"requests forecasts"| node_apiclient
node_investor -->|"asks questions"| node_chat
node_chat -->|"sends queries"| node_apiclient
node_chat -->|"renders replies"| node_markdown
node_investor -->|"posts messages"| node_community
node_community -->|"opens live connection"| node_apiclient
node_apiclient -->|"calls auth endpoints"| node_authsvc
node_authsvc -.->|"accesses user data"| node_database
node_apiclient -.->|"calls portfolio endpoints"| node_portfolioapi
node_portfolioapi -->|"uses portfolio records"| node_portfoliorecords
node_investor -.->|"backtests portfolio"| node_investment
node_investor -.->|"searches videos"| node_market
node_apiclient -.->|"requests investment data"| node_investment
node_apiclient -.->|"requests AI analysis"| node_crewview
node_crewview -->|"invokes crews"| node_crews
node_crews -->|"uses analysis tools"| node_tools
node_tools -.->|"fetches prices and news"| node_marketdata
node_community -.->|"exchanges live messages"| node_forum
node_forum -.->|"persists discussions"| node_database

click node_authui "https://github.com/lakshaysawhney/stockpulse/blob/main/client/app/AuthProvider.js"
click node_apiclient "https://github.com/lakshaysawhney/stockpulse/blob/main/client/utils/api.js"
click node_dashboard "https://github.com/lakshaysawhney/stockpulse/blob/main/client/app/page.js"
click node_analyzer "https://github.com/lakshaysawhney/stockpulse/blob/main/client/app/analyzer/page.js"
click node_market "https://github.com/lakshaysawhney/stockpulse/blob/main/client/app/market/page.js"
click node_chat "https://github.com/lakshaysawhney/stockpulse/blob/main/client/app/chat/page.js"
click node_community "https://github.com/lakshaysawhney/stockpulse/blob/main/client/app/community/page.js"
click node_markdown "https://github.com/lakshaysawhney/stockpulse/blob/main/client/app/components/Markdown.js"
click node_authsvc "https://github.com/lakshaysawhney/stockpulse/blob/main/server/Stock_pulse/Auth/views.py"
click node_portfolioapi "https://github.com/lakshaysawhney/stockpulse/blob/main/server/Stock_pulse/Portfolios/views.py"
click node_portfoliorecords "https://github.com/lakshaysawhney/stockpulse/blob/main/server/Stock_pulse/Portfolios/models.py"
click node_investment "https://github.com/lakshaysawhney/stockpulse/blob/main/server/Stock_pulse/InvestmentSection/views.py"
click node_forum "https://github.com/lakshaysawhney/stockpulse/blob/main/server/Stock_pulse/InvestmentSection/consumers.py"
click node_crewview "https://github.com/lakshaysawhney/stockpulse/blob/main/server/Stock_pulse/Agents/views.py"
click node_crews "https://github.com/lakshaysawhney/stockpulse/blob/main/server/Stock_pulse/Agents/Crews/crews.py"
click node_tools "https://github.com/lakshaysawhney/stockpulse/blob/main/server/Stock_pulse/Agents/Crews/tools.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_authui,node_apiclient,node_dashboard,node_analyzer,node_market,node_chat,node_community,node_markdown toneBlue
class node_authsvc,node_portfolioapi,node_portfoliorecords,node_investment,node_forum toneAmber
class node_crewview,node_crews,node_tools toneMint
class node_database toneRose
class node_investor,node_marketdata toneIndigo
```

## Components

### Web client

- [Sign in](https://github.com/lakshaysawhney/stockpulse/blob/main/client/app/AuthProvider.js): `client/app/AuthProvider.js`
- [API client](https://github.com/lakshaysawhney/stockpulse/blob/main/client/utils/api.js): `client/utils/api.js`
- [Dashboard](https://github.com/lakshaysawhney/stockpulse/blob/main/client/app/page.js): `client/app/page.js`
- [Portfolio analyzer](https://github.com/lakshaysawhney/stockpulse/blob/main/client/app/analyzer/page.js): `client/app/analyzer/page.js`
- [Market explorer](https://github.com/lakshaysawhney/stockpulse/blob/main/client/app/market/page.js): `client/app/market/page.js`
- [Finance assistant](https://github.com/lakshaysawhney/stockpulse/blob/main/client/app/chat/page.js): `client/app/chat/page.js`
- [Community feed](https://github.com/lakshaysawhney/stockpulse/blob/main/client/app/community/page.js): `client/app/community/page.js`
- [Report renderer](https://github.com/lakshaysawhney/stockpulse/blob/main/client/app/components/Markdown.js): `client/app/components/Markdown.js`

### Django services

- [Authentication API](https://github.com/lakshaysawhney/stockpulse/blob/main/server/Stock_pulse/Auth/views.py): `server/Stock_pulse/Auth/views.py`
- [Portfolio API](https://github.com/lakshaysawhney/stockpulse/blob/main/server/Stock_pulse/Portfolios/views.py): `server/Stock_pulse/Portfolios/views.py`
- [Portfolio records](https://github.com/lakshaysawhney/stockpulse/blob/main/server/Stock_pulse/Portfolios/models.py): `server/Stock_pulse/Portfolios/models.py`
- [Investment services](https://github.com/lakshaysawhney/stockpulse/blob/main/server/Stock_pulse/InvestmentSection/views.py): `server/Stock_pulse/InvestmentSection/views.py`
- [Live discussions](https://github.com/lakshaysawhney/stockpulse/blob/main/server/Stock_pulse/InvestmentSection/consumers.py): `server/Stock_pulse/InvestmentSection/consumers.py`

### AI and market data

- [Agent endpoints](https://github.com/lakshaysawhney/stockpulse/blob/main/server/Stock_pulse/Agents/views.py): `server/Stock_pulse/Agents/views.py`
- [Analysis crews](https://github.com/lakshaysawhney/stockpulse/blob/main/server/Stock_pulse/Agents/Crews/crews.py): `server/Stock_pulse/Agents/Crews/crews.py`
- [Market data tools](https://github.com/lakshaysawhney/stockpulse/blob/main/server/Stock_pulse/Agents/Crews/tools.py): `server/Stock_pulse/Agents/Crews/tools.py`

### Application state

- **PostgreSQL**

### Other components

- **Investor**
- **Market data providers**

## Connections

- Investor → Sign in: signs in (evidence: `client/app/AuthProvider.js`)
- Sign in → API client: authenticates through (evidence: `client/app/AuthProvider.js`)
- Investor → Dashboard: explores (evidence: `README.md`)
- Dashboard → API client: requests data (evidence: `client/app/page.js`)
- Investor → Portfolio analyzer: submits holdings (evidence: `client/app/analyzer/page.js`)
- Portfolio analyzer → API client: requests analysis (evidence: `client/app/analyzer/page.js`)
- Portfolio analyzer → Report renderer: renders report (evidence: `client/app/analyzer/page.js`)
- Investor → Market explorer: explores trends (evidence: `README.md`)
- Market explorer → API client: requests forecasts (evidence: `client/app/market/page.js`)
- Investor → Finance assistant: asks questions (evidence: `README.md`)
- Finance assistant → API client: sends queries (evidence: `client/app/chat/page.js`)
- Finance assistant → Report renderer: renders replies (evidence: `client/app/chat/page.js`)
- Investor → Community feed: posts messages (evidence: `README.md`)
- Community feed → API client: opens live connection (evidence: `client/app/community/page.js`)
- API client → Authentication API: calls auth endpoints
- Authentication API → PostgreSQL: accesses user data
- API client → Portfolio API: calls portfolio endpoints
- Portfolio API → Portfolio records: uses portfolio records (evidence: `server/Stock_pulse/Portfolios/views.py`)
- Investor → Investment services: backtests portfolio (evidence: `README.md`)
- Investor → Market explorer: searches videos (evidence: `README.md`)
- API client → Investment services: requests investment data
- API client → Agent endpoints: requests AI analysis
- Agent endpoints → Analysis crews: invokes crews (evidence: `server/Stock_pulse/Agents/views.py`)
- Analysis crews → Market data tools: uses analysis tools (evidence: `server/Stock_pulse/Agents/Crews/crews.py`)
- Market data tools → Market data providers: fetches prices and news
- Community feed → Live discussions: exchanges live messages (evidence: `README.md`)
- Live discussions → PostgreSQL: persists discussions
