# jeevanmgowda/ipolens architecture

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

- Interactive diagram: https://gitdiagram.com/jeevanmgowda/ipolens
- Repository: https://github.com/jeevanmgowda/ipolens

## Overview

IPOLENS is an IPO discovery and live-market platform. Users explore upcoming, active, closed, and listed IPOs, inspect subscription and GMP data, then use research, prediction, bidding/allotment, and portfolio tools. Its runtime combines Next.js API routes and React views with market-data services, AI analysis, authentication, and persistence. The README documents the provider-based live-feed flow and scraper capabilities; source excerpts confirm selected route-to-service and worker-to-Redis relationships. Other links are omitted where sampled evidence does not establish the caller or wiring.

Main entry points: [`src/app/api/market/stream/route.ts`](https://github.com/jeevanmgowda/ipolens/blob/main/src/app/api/market/stream/route.ts) (Market Routes), [`src/lib/services/db-repository.service.ts`](https://github.com/jeevanmgowda/ipolens/blob/main/src/lib/services/db-repository.service.ts) (Database Repository), [`src/app/api/analysis/route.ts`](https://github.com/jeevanmgowda/ipolens/blob/main/src/app/api/analysis/route.ts) (Prospectus Analysis Route), [`src/app/api/applications/route.ts`](https://github.com/jeevanmgowda/ipolens/blob/main/src/app/api/applications/route.ts) (Applications Route)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_discovery["IPO Discovery"]
  node_ipo_ui["IPO Radar<br/>[LiveIpoRadar.tsx]"]
  node_ipo_routes["IPO Routes"]
  node_ipo_service["IPO Data Services<br/>[ipoDataProvider.ts]"]
  node_nse_service["NSE IPO Feed<br/>[nseIpoService.ts]"]
  node_scraper["Exchange Scrapers"]
end

subgraph group_market["Live Market"]
  node_live_ui["Live Market Dashboard<br/>[page.tsx]"]
  node_market_routes["Market Routes<br/>[route.ts]"]
  node_market_service["Market Services<br/>[marketService.ts]"]
  node_listed_service["Listed IPO Charts"]
  node_feed_worker["Price Feed Worker"]
  node_redis[("Redis Cache<br/>[redis.ts]")]
end

subgraph group_research["Research &amp; Analytics"]
  node_research_ui["AI Research View<br/>[AiResearchView.tsx]"]
  node_analysis_route["Prospectus Analysis Route<br/>[route.ts]"]
  node_gemini["AI Analyst<br/>[geminiAnalyst.ts]"]
  node_rag["DRHP RAG"]
  node_prediction_route["Gain Prediction Route<br/>[route.ts]"]
  node_prediction_model["Listing Gain Model"]
end

subgraph group_bidding["Bidding &amp; Allotment"]
  node_pan_ui["Family PAN Manager<br/>[PanManager.tsx]"]
  node_pan_route["PAN Routes<br/>[route.ts]"]
  node_application_route["Applications Route<br/>[route.ts]"]
  node_duplicate_check["Duplicate Bid Guard"]
  node_allotment["Allotment Checker"]
  node_allotment_ui["Allotment UI"]
end

subgraph group_account["Accounts &amp; Portfolio"]
  node_auth_ui["Authentication<br/>[AuthContext.tsx]"]
  node_portfolio_ui["Portfolio Dashboard"]
  node_portfolio_routes["Portfolio Routes<br/>[route.ts]"]
  node_repository["Database Repository"]
  node_database[("Application Database<br/>[schema.ts]")]
end

node_investor(("Investor"))
node_exchange(("NSE / BSE"))
node_upstox(("Upstox Feed"))
node_gemini_service(("Gemini AI"))

node_investor -->|"explores"| node_ipo_ui
node_ipo_ui -.->|"requests IPO data"| node_ipo_routes
node_ipo_routes -->|"fetches IPO detail"| node_nse_service
node_nse_service -.->|"fetches exchange data"| node_exchange
node_scraper -->|"collects feeds"| node_exchange
node_investor -->|"views telemetry"| node_live_ui
node_live_ui -->|"opens stream"| node_market_routes
node_market_routes -->|"uses"| node_market_service
node_market_routes -->|"uses"| node_listed_service
node_market_routes -->|"uses cache"| node_redis
node_feed_worker -->|"publishes ticks"| node_redis
node_upstox -.->|"supplies market feed"| node_live_ui
node_investor -->|"researches IPOs"| node_research_ui
node_research_ui -.->|"requests analysis"| node_analysis_route
node_analysis_route -->|"analyzes filing"| node_gemini
node_gemini -.->|"uses AI service"| node_gemini_service
node_analysis_route -.->|"queries prospectus"| node_rag
node_prediction_route -->|"predicts gains"| node_prediction_model
node_prediction_route -->|"loads IPO details"| node_ipo_service
node_investor -->|"manages family bids"| node_pan_ui
node_pan_ui -.->|"manages PANs"| node_pan_route
node_pan_route -->|"saves PAN"| node_repository
node_application_route -->|"checks duplicate bid"| node_duplicate_check
node_application_route -->|"reads and writes applications"| node_repository
node_allotment_ui -.->|"checks allotment"| node_allotment
node_allotment -->|"reads applications"| node_application_route
node_auth_ui -.->|"authenticates"| node_investor
node_portfolio_ui -.->|"loads holdings"| node_portfolio_routes
node_portfolio_routes -.->|"accesses records"| node_repository
node_repository -.->|"persists data"| node_database

click node_ipo_ui "https://github.com/jeevanmgowda/ipolens/blob/main/src/components/radar/LiveIpoRadar.tsx"
click node_ipo_routes "https://github.com/jeevanmgowda/ipolens/tree/main/src/app/api/ipos"
click node_ipo_service "https://github.com/jeevanmgowda/ipolens/blob/main/src/services/ipoDataProvider.ts"
click node_nse_service "https://github.com/jeevanmgowda/ipolens/blob/main/src/services/nseIpoService.ts"
click node_scraper "https://github.com/jeevanmgowda/ipolens/tree/main/scripts/scraper"
click node_live_ui "https://github.com/jeevanmgowda/ipolens/blob/main/src/app/live-market/page.tsx"
click node_market_routes "https://github.com/jeevanmgowda/ipolens/blob/main/src/app/api/market/stream/route.ts"
click node_market_service "https://github.com/jeevanmgowda/ipolens/blob/main/src/services/marketService.ts"
click node_listed_service "https://github.com/jeevanmgowda/ipolens/blob/main/src/services/listedIpoService.ts"
click node_feed_worker "https://github.com/jeevanmgowda/ipolens/blob/main/workers/market-feed-worker.ts"
click node_redis "https://github.com/jeevanmgowda/ipolens/blob/main/src/lib/redis.ts"
click node_research_ui "https://github.com/jeevanmgowda/ipolens/blob/main/src/components/research/AiResearchView.tsx"
click node_analysis_route "https://github.com/jeevanmgowda/ipolens/blob/main/src/app/api/analysis/route.ts"
click node_gemini "https://github.com/jeevanmgowda/ipolens/blob/main/src/services/geminiAnalyst.ts"
click node_rag "https://github.com/jeevanmgowda/ipolens/blob/main/src/lib/services/drhp-rag.service.ts"
click node_prediction_route "https://github.com/jeevanmgowda/ipolens/blob/main/src/app/api/analysis/ml-prediction/route.ts"
click node_prediction_model "https://github.com/jeevanmgowda/ipolens/blob/main/src/services/mlListingGainModel.ts"
click node_pan_ui "https://github.com/jeevanmgowda/ipolens/blob/main/src/components/pans/PanManager.tsx"
click node_pan_route "https://github.com/jeevanmgowda/ipolens/blob/main/src/app/api/pans/route.ts"
click node_application_route "https://github.com/jeevanmgowda/ipolens/blob/main/src/app/api/applications/route.ts"
click node_duplicate_check "https://github.com/jeevanmgowda/ipolens/blob/main/src/services/duplicateEnforcer.ts"
click node_allotment "https://github.com/jeevanmgowda/ipolens/blob/main/src/lib/services/allotment/allotment.service.ts"
click node_allotment_ui "https://github.com/jeevanmgowda/ipolens/blob/main/src/components/allotment/AllotmentChecker.tsx"
click node_auth_ui "https://github.com/jeevanmgowda/ipolens/blob/main/src/context/AuthContext.tsx"
click node_portfolio_ui "https://github.com/jeevanmgowda/ipolens/blob/main/src/components/portfolio/PortfolioDashboard.tsx"
click node_portfolio_routes "https://github.com/jeevanmgowda/ipolens/blob/main/src/app/api/portfolio/holdings/route.ts"
click node_repository "https://github.com/jeevanmgowda/ipolens/blob/main/src/lib/services/db-repository.service.ts"
click node_database "https://github.com/jeevanmgowda/ipolens/blob/main/src/db/schema.ts"

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_ipo_ui,node_ipo_routes,node_ipo_service,node_nse_service,node_scraper toneBlue
class node_live_ui,node_market_routes,node_market_service,node_listed_service,node_feed_worker,node_redis toneAmber
class node_research_ui,node_analysis_route,node_gemini,node_rag,node_prediction_route,node_prediction_model toneMint
class node_pan_ui,node_pan_route,node_application_route,node_duplicate_check,node_allotment,node_allotment_ui toneRose
class node_auth_ui,node_portfolio_ui,node_portfolio_routes,node_repository,node_database,node_investor,node_exchange,node_upstox,node_gemini_service toneIndigo
```

## Components

### IPO Discovery

- [IPO Radar](https://github.com/jeevanmgowda/ipolens/blob/main/src/components/radar/LiveIpoRadar.tsx): `src/components/radar/LiveIpoRadar.tsx`
- [IPO Routes](https://github.com/jeevanmgowda/ipolens/tree/main/src/app/api/ipos): `src/app/api/ipos`
- [IPO Data Services](https://github.com/jeevanmgowda/ipolens/blob/main/src/services/ipoDataProvider.ts): `src/services/ipoDataProvider.ts`
- [NSE IPO Feed](https://github.com/jeevanmgowda/ipolens/blob/main/src/services/nseIpoService.ts): `src/services/nseIpoService.ts`
- [Exchange Scrapers](https://github.com/jeevanmgowda/ipolens/tree/main/scripts/scraper): `scripts/scraper`

### Live Market

- [Live Market Dashboard](https://github.com/jeevanmgowda/ipolens/blob/main/src/app/live-market/page.tsx): `src/app/live-market/page.tsx`
- [Market Routes](https://github.com/jeevanmgowda/ipolens/blob/main/src/app/api/market/stream/route.ts): `src/app/api/market/stream/route.ts`
- [Market Services](https://github.com/jeevanmgowda/ipolens/blob/main/src/services/marketService.ts): `src/services/marketService.ts`
- [Listed IPO Charts](https://github.com/jeevanmgowda/ipolens/blob/main/src/services/listedIpoService.ts): `src/services/listedIpoService.ts`
- [Price Feed Worker](https://github.com/jeevanmgowda/ipolens/blob/main/workers/market-feed-worker.ts): `workers/market-feed-worker.ts`
- [Redis Cache](https://github.com/jeevanmgowda/ipolens/blob/main/src/lib/redis.ts): `src/lib/redis.ts`

### Research & Analytics

- [AI Research View](https://github.com/jeevanmgowda/ipolens/blob/main/src/components/research/AiResearchView.tsx): `src/components/research/AiResearchView.tsx`
- [Prospectus Analysis Route](https://github.com/jeevanmgowda/ipolens/blob/main/src/app/api/analysis/route.ts): `src/app/api/analysis/route.ts`
- [AI Analyst](https://github.com/jeevanmgowda/ipolens/blob/main/src/services/geminiAnalyst.ts): `src/services/geminiAnalyst.ts`
- [DRHP RAG](https://github.com/jeevanmgowda/ipolens/blob/main/src/lib/services/drhp-rag.service.ts): `src/lib/services/drhp-rag.service.ts`
- [Gain Prediction Route](https://github.com/jeevanmgowda/ipolens/blob/main/src/app/api/analysis/ml-prediction/route.ts): `src/app/api/analysis/ml-prediction/route.ts`
- [Listing Gain Model](https://github.com/jeevanmgowda/ipolens/blob/main/src/services/mlListingGainModel.ts): `src/services/mlListingGainModel.ts`

### Bidding & Allotment

- [Family PAN Manager](https://github.com/jeevanmgowda/ipolens/blob/main/src/components/pans/PanManager.tsx): `src/components/pans/PanManager.tsx`
- [PAN Routes](https://github.com/jeevanmgowda/ipolens/blob/main/src/app/api/pans/route.ts): `src/app/api/pans/route.ts`
- [Applications Route](https://github.com/jeevanmgowda/ipolens/blob/main/src/app/api/applications/route.ts): `src/app/api/applications/route.ts`
- [Duplicate Bid Guard](https://github.com/jeevanmgowda/ipolens/blob/main/src/services/duplicateEnforcer.ts): `src/services/duplicateEnforcer.ts`
- [Allotment Checker](https://github.com/jeevanmgowda/ipolens/blob/main/src/lib/services/allotment/allotment.service.ts): `src/lib/services/allotment/allotment.service.ts`
- [Allotment UI](https://github.com/jeevanmgowda/ipolens/blob/main/src/components/allotment/AllotmentChecker.tsx): `src/components/allotment/AllotmentChecker.tsx`

### Accounts & Portfolio

- [Authentication](https://github.com/jeevanmgowda/ipolens/blob/main/src/context/AuthContext.tsx): `src/context/AuthContext.tsx`
- [Portfolio Dashboard](https://github.com/jeevanmgowda/ipolens/blob/main/src/components/portfolio/PortfolioDashboard.tsx): `src/components/portfolio/PortfolioDashboard.tsx`
- [Portfolio Routes](https://github.com/jeevanmgowda/ipolens/blob/main/src/app/api/portfolio/holdings/route.ts): `src/app/api/portfolio/holdings/route.ts`
- [Database Repository](https://github.com/jeevanmgowda/ipolens/blob/main/src/lib/services/db-repository.service.ts): `src/lib/services/db-repository.service.ts`
- [Application Database](https://github.com/jeevanmgowda/ipolens/blob/main/src/db/schema.ts): `src/db/schema.ts`

### Other components

- **Investor**
- **NSE / BSE**
- **Upstox Feed**
- **Gemini AI**

## Connections

- Investor → IPO Radar: explores (evidence: `README.md`)
- IPO Radar → IPO Routes: requests IPO data
- IPO Routes → NSE IPO Feed: fetches IPO detail (evidence: `src/app/api/ipos/[symbol]/route.ts`)
- NSE IPO Feed → NSE / BSE: fetches exchange data
- Exchange Scrapers → NSE / BSE: collects feeds (evidence: `README.md`)
- Investor → Live Market Dashboard: views telemetry (evidence: `README.md`)
- Live Market Dashboard → Market Routes: opens stream (evidence: `README.md`)
- Market Routes → Market Services: uses (evidence: `src/app/api/market/stream/route.ts`)
- Market Routes → Listed IPO Charts: uses (evidence: `src/app/api/market/stream/route.ts`)
- Market Routes → Redis Cache: uses cache (evidence: `src/app/api/market/stream/route.ts`)
- Price Feed Worker → Redis Cache: publishes ticks (evidence: `workers/market-feed-worker.ts`)
- Upstox Feed → Live Market Dashboard: supplies market feed
- Investor → AI Research View: researches IPOs (evidence: `README.md`)
- AI Research View → Prospectus Analysis Route: requests analysis
- Prospectus Analysis Route → AI Analyst: analyzes filing (evidence: `src/app/api/analysis/route.ts`)
- AI Analyst → Gemini AI: uses AI service
- Prospectus Analysis Route → DRHP RAG: queries prospectus
- Gain Prediction Route → Listing Gain Model: predicts gains (evidence: `src/app/api/analysis/ml-prediction/route.ts`)
- Gain Prediction Route → IPO Data Services: loads IPO details (evidence: `src/app/api/analysis/ml-prediction/route.ts`)
- Investor → Family PAN Manager: manages family bids (evidence: `README.md`)
- Family PAN Manager → PAN Routes: manages PANs
- PAN Routes → Database Repository: saves PAN (evidence: `src/app/api/pans/route.ts`)
- Applications Route → Duplicate Bid Guard: checks duplicate bid (evidence: `src/app/api/applications/route.ts`)
- Applications Route → Database Repository: reads and writes applications (evidence: `src/app/api/applications/route.ts`)
- Allotment UI → Allotment Checker: checks allotment
- Allotment Checker → Applications Route: reads applications (evidence: `src/lib/services/allotment/allotment.service.ts`)
- Authentication → Investor: authenticates
- Portfolio Dashboard → Portfolio Routes: loads holdings
- Portfolio Routes → Database Repository: accesses records
- Database Repository → Application Database: persists data
