# dhvani30/netra-platform architecture

> Architecture diagram of the GitHub repository dhvani30/netra-platform, 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/dhvani30/netra-platform
- Repository: https://github.com/dhvani30/netra-platform

## Overview

NETRA turns social-platform observations into narrative, sentiment, trend, and network intelligence, then serves those results to an investigation dashboard. The principal path is platform collection into MongoDB, analytics and graph construction, FastAPI endpoints or live events, and React views. README capabilities also include mutation tracking, cross-platform correlation, alerts, privacy-safe demographics, network analysis, investigation, and coverage. Relationship evidence is limited to the README and indexed excerpts; uncertain subsystem wiring is omitted rather than inferred.

Main entry points: [`frontend/src/App.jsx`](https://github.com/dhvani30/netra-platform/blob/main/frontend/src/App.jsx) (React dashboard), [`backend/main.py`](https://github.com/dhvani30/netra-platform/blob/main/backend/main.py) (FastAPI service), [`backend/app/pipeline.py`](https://github.com/dhvani30/netra-platform/blob/main/backend/app/pipeline.py) (Analytics pipeline), [`backend/app/collectors`](https://github.com/dhvani30/netra-platform/tree/main/backend/app/collectors) (Platform collectors)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_collection["Collection"]
  node_collectors["Platform collectors"]
  node_raw["Raw post schema<br/>[schema.py]"]
end

subgraph group_analysis["Analysis"]
  node_pipeline["Analytics pipeline<br/>[pipeline.py]"]
  node_sentiment["Sentiment analysis<br/>[sentiment.py]"]
  node_nlp["Entity and text NLP<br/>[infer.py]"]
  node_demographics["Privacy-safe profiles<br/>[profiler.py]"]
  node_trends["Narrative trends<br/>[engine.py]"]
  node_timeline["Narrative timelines<br/>[timeline.py]"]
  node_watchlist["Watchlists<br/>[watchlist.py]"]
  node_graphbuild["Graph construction<br/>[graph_builder.py]"]
end

subgraph group_serving["API and storage"]
  node_mongo[("MongoDB")]
  node_neo4j[("Neo4j graph")]
  node_api["FastAPI service<br/>[main.py]"]
  node_events["Live event stream<br/>[live_events.py]"]
end

subgraph group_dashboard["Dashboard"]
  node_frontend["React dashboard<br/>[App.jsx]"]
  node_livefeed["Live feed<br/>[LiveFeedView.jsx]"]
  node_narrativeui["Narrative tracker"]
  node_crossplatform["Cross-platform view"]
  node_alerts["Intelligence alerts<br/>[AlertsView.jsx]"]
  node_demoui["Demographics view"]
  node_networkui["Network intelligence"]
  node_networkgraph["Interactive graph<br/>[NetworkGraph.jsx]"]
  node_investigation["Investigation view"]
  node_provenance["Provenance details"]
  node_sources["Coverage and sources<br/>[CoverageView.jsx]"]
  node_status["Sentiment timeline"]
end

node_operator(("Analyst"))
node_platforms["Social platforms"]

node_platforms -->|"provide posts"| node_collectors
node_collectors -->|"normalize records"| node_raw
node_collectors -->|"ingest posts"| node_mongo
node_pipeline -->|"process posts"| node_mongo
node_pipeline -->|"analyze sentiment"| node_sentiment
node_pipeline -->|"infer text signals"| node_nlp
node_mongo -->|"supply observations"| node_pipeline
node_mongo -.->|"supply post history"| node_trends
node_mongo -.->|"supply observations"| node_demographics
node_mongo -->|"supply observations"| node_graphbuild
node_graphbuild -->|"store relationships"| node_neo4j
node_api -->|"query analytics"| node_mongo
node_api -->|"serve graph data"| node_neo4j
node_api -->|"stream updates"| node_events
node_operator -->|"investigate narratives"| node_frontend
node_frontend -->|"request intelligence"| node_api
node_frontend -->|"renders"| node_livefeed
node_frontend -->|"renders"| node_narrativeui
node_frontend -->|"renders"| node_crossplatform
node_frontend -->|"renders"| node_alerts
node_frontend -->|"renders"| node_demoui
node_frontend -->|"renders"| node_networkui
node_frontend -->|"renders"| node_networkgraph
node_frontend -->|"renders"| node_investigation
node_investigation -.->|"shows evidence"| node_provenance
node_frontend -.->|"renders"| node_sources
node_frontend -.->|"renders"| node_status
node_livefeed -->|"fetches feed"| node_api
node_events -.->|"pushes events"| node_livefeed
node_trends -.->|"serve trend results"| node_api
node_watchlist -.->|"serve watchlist"| node_api

click node_collectors "https://github.com/dhvani30/netra-platform/tree/main/backend/app/collectors"
click node_raw "https://github.com/dhvani30/netra-platform/blob/main/backend/app/schema.py"
click node_pipeline "https://github.com/dhvani30/netra-platform/blob/main/backend/app/pipeline.py"
click node_sentiment "https://github.com/dhvani30/netra-platform/blob/main/backend/app/sentiment.py"
click node_nlp "https://github.com/dhvani30/netra-platform/blob/main/backend/app/nlp/infer.py"
click node_demographics "https://github.com/dhvani30/netra-platform/blob/main/backend/app/demographics/profiler.py"
click node_trends "https://github.com/dhvani30/netra-platform/blob/main/backend/app/trends/engine.py"
click node_timeline "https://github.com/dhvani30/netra-platform/blob/main/backend/app/timeline.py"
click node_watchlist "https://github.com/dhvani30/netra-platform/blob/main/backend/app/watchlist.py"
click node_graphbuild "https://github.com/dhvani30/netra-platform/blob/main/backend/app/graph_builder.py"
click node_api "https://github.com/dhvani30/netra-platform/blob/main/backend/main.py"
click node_events "https://github.com/dhvani30/netra-platform/blob/main/backend/app/core/live_events.py"
click node_frontend "https://github.com/dhvani30/netra-platform/blob/main/frontend/src/App.jsx"
click node_livefeed "https://github.com/dhvani30/netra-platform/blob/main/frontend/src/components/LiveFeedView.jsx"
click node_narrativeui "https://github.com/dhvani30/netra-platform/blob/main/frontend/src/components/NarrativeTracker.jsx"
click node_crossplatform "https://github.com/dhvani30/netra-platform/blob/main/frontend/src/components/CrossPlatformView.jsx"
click node_alerts "https://github.com/dhvani30/netra-platform/blob/main/frontend/src/components/AlertsView.jsx"
click node_demoui "https://github.com/dhvani30/netra-platform/blob/main/frontend/src/components/DemographicsView.jsx"
click node_networkui "https://github.com/dhvani30/netra-platform/blob/main/frontend/src/components/NetworkIntelligenceView.jsx"
click node_networkgraph "https://github.com/dhvani30/netra-platform/blob/main/frontend/src/components/NetworkGraph.jsx"
click node_investigation "https://github.com/dhvani30/netra-platform/blob/main/frontend/src/components/InvestigationView.jsx"
click node_provenance "https://github.com/dhvani30/netra-platform/blob/main/frontend/src/components/ProvenanceDrawer.jsx"
click node_sources "https://github.com/dhvani30/netra-platform/blob/main/frontend/src/components/CoverageView.jsx"
click node_status "https://github.com/dhvani30/netra-platform/blob/main/frontend/src/components/SentimentTimelineView.jsx"

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_collectors,node_raw toneBlue
class node_pipeline,node_sentiment,node_nlp,node_demographics,node_trends,node_timeline,node_watchlist,node_graphbuild toneAmber
class node_mongo,node_neo4j,node_api,node_events toneMint
class node_frontend,node_livefeed,node_narrativeui,node_crossplatform,node_alerts,node_demoui,node_networkui,node_networkgraph,node_investigation,node_provenance,node_sources,node_status toneRose
class node_operator,node_platforms toneIndigo
```

## Components

### Collection

- [Platform collectors](https://github.com/dhvani30/netra-platform/tree/main/backend/app/collectors): `backend/app/collectors`
- [Raw post schema](https://github.com/dhvani30/netra-platform/blob/main/backend/app/schema.py): `backend/app/schema.py`

### Analysis

- [Analytics pipeline](https://github.com/dhvani30/netra-platform/blob/main/backend/app/pipeline.py): `backend/app/pipeline.py`
- [Sentiment analysis](https://github.com/dhvani30/netra-platform/blob/main/backend/app/sentiment.py): `backend/app/sentiment.py`
- [Entity and text NLP](https://github.com/dhvani30/netra-platform/blob/main/backend/app/nlp/infer.py): `backend/app/nlp/infer.py`
- [Privacy-safe profiles](https://github.com/dhvani30/netra-platform/blob/main/backend/app/demographics/profiler.py): `backend/app/demographics/profiler.py`
- [Narrative trends](https://github.com/dhvani30/netra-platform/blob/main/backend/app/trends/engine.py): `backend/app/trends/engine.py`
- [Narrative timelines](https://github.com/dhvani30/netra-platform/blob/main/backend/app/timeline.py): `backend/app/timeline.py`
- [Watchlists](https://github.com/dhvani30/netra-platform/blob/main/backend/app/watchlist.py): `backend/app/watchlist.py`
- [Graph construction](https://github.com/dhvani30/netra-platform/blob/main/backend/app/graph_builder.py): `backend/app/graph_builder.py`

### API and storage

- **MongoDB**
- **Neo4j graph**
- [FastAPI service](https://github.com/dhvani30/netra-platform/blob/main/backend/main.py): `backend/main.py`
- [Live event stream](https://github.com/dhvani30/netra-platform/blob/main/backend/app/core/live_events.py): `backend/app/core/live_events.py`

### Dashboard

- [React dashboard](https://github.com/dhvani30/netra-platform/blob/main/frontend/src/App.jsx): `frontend/src/App.jsx`
- [Live feed](https://github.com/dhvani30/netra-platform/blob/main/frontend/src/components/LiveFeedView.jsx): `frontend/src/components/LiveFeedView.jsx`
- [Narrative tracker](https://github.com/dhvani30/netra-platform/blob/main/frontend/src/components/NarrativeTracker.jsx): `frontend/src/components/NarrativeTracker.jsx`
- [Cross-platform view](https://github.com/dhvani30/netra-platform/blob/main/frontend/src/components/CrossPlatformView.jsx): `frontend/src/components/CrossPlatformView.jsx`
- [Intelligence alerts](https://github.com/dhvani30/netra-platform/blob/main/frontend/src/components/AlertsView.jsx): `frontend/src/components/AlertsView.jsx`
- [Demographics view](https://github.com/dhvani30/netra-platform/blob/main/frontend/src/components/DemographicsView.jsx): `frontend/src/components/DemographicsView.jsx`
- [Network intelligence](https://github.com/dhvani30/netra-platform/blob/main/frontend/src/components/NetworkIntelligenceView.jsx): `frontend/src/components/NetworkIntelligenceView.jsx`
- [Interactive graph](https://github.com/dhvani30/netra-platform/blob/main/frontend/src/components/NetworkGraph.jsx): `frontend/src/components/NetworkGraph.jsx`
- [Investigation view](https://github.com/dhvani30/netra-platform/blob/main/frontend/src/components/InvestigationView.jsx): `frontend/src/components/InvestigationView.jsx`
- [Provenance details](https://github.com/dhvani30/netra-platform/blob/main/frontend/src/components/ProvenanceDrawer.jsx): `frontend/src/components/ProvenanceDrawer.jsx`
- [Coverage and sources](https://github.com/dhvani30/netra-platform/blob/main/frontend/src/components/CoverageView.jsx): `frontend/src/components/CoverageView.jsx`
- [Sentiment timeline](https://github.com/dhvani30/netra-platform/blob/main/frontend/src/components/SentimentTimelineView.jsx): `frontend/src/components/SentimentTimelineView.jsx`

### Other components

- **Analyst**
- **Social platforms**

## Connections

- Social platforms → Platform collectors: provide posts
- Platform collectors → Raw post schema: normalize records (evidence: `backend/app/collectors/meta_ingestor.py`)
- Platform collectors → MongoDB: ingest posts
- Analytics pipeline → MongoDB: process posts
- Analytics pipeline → Sentiment analysis: analyze sentiment
- Analytics pipeline → Entity and text NLP: infer text signals
- MongoDB → Analytics pipeline: supply observations
- MongoDB → Narrative trends: supply post history
- MongoDB → Privacy-safe profiles: supply observations
- MongoDB → Graph construction: supply observations
- Graph construction → Neo4j graph: store relationships
- FastAPI service → MongoDB: query analytics (evidence: `backend/main.py`)
- FastAPI service → Neo4j graph: serve graph data
- FastAPI service → Live event stream: stream updates (evidence: `backend/main.py`)
- Analyst → React dashboard: investigate narratives
- React dashboard → FastAPI service: request intelligence
- React dashboard → Live feed: renders (evidence: `frontend/src/App.jsx`)
- React dashboard → Narrative tracker: renders (evidence: `frontend/src/App.jsx`)
- React dashboard → Cross-platform view: renders (evidence: `frontend/src/App.jsx`)
- React dashboard → Intelligence alerts: renders (evidence: `frontend/src/App.jsx`)
- React dashboard → Demographics view: renders (evidence: `frontend/src/App.jsx`)
- React dashboard → Network intelligence: renders (evidence: `frontend/src/App.jsx`)
- React dashboard → Interactive graph: renders (evidence: `frontend/src/App.jsx`)
- React dashboard → Investigation view: renders (evidence: `frontend/src/App.jsx`)
- Investigation view → Provenance details: shows evidence
- React dashboard → Coverage and sources: renders (evidence: `frontend/src/App.jsx`)
- React dashboard → Sentiment timeline: renders (evidence: `frontend/src/App.jsx`)
- Live feed → FastAPI service: fetches feed (evidence: `frontend/src/components/LiveFeedView.jsx`)
- Live event stream → Live feed: pushes events
- Narrative trends → FastAPI service: serve trend results (evidence: `backend/main.py`)
- Watchlists → FastAPI service: serve watchlist (evidence: `backend/main.py`)
