# c1earnote/major architecture

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

- Interactive diagram: https://gitdiagram.com/c1earnote/major
- Repository: https://github.com/c1earnote/major

## Overview

Major is a Telegram message-monitoring and suspicious-activity project: messages can be collected from Telegram, analyzed for outliers, and presented in a dashboard with channel and user views. The repository contains separate scraper, notebook-based analysis, Flask file endpoints, and React UI code; the UI’s documented API calls do not match the sampled Flask routes, so no connection between them is asserted. The README also names an ML model, but the unsampled nlp.py implementation and its integration cannot be verified from the excerpts.

Main entry points: [`Frontend/projectMain/src/App.jsx`](https://github.com/c1earnote/major/blob/main/Frontend/projectMain/src/App.jsx) (React app), [`Frontend/projectMain/src/components/Dashboard.jsx`](https://github.com/c1earnote/major/blob/main/Frontend/projectMain/src/components/Dashboard.jsx) (Dashboard view), [`Backend2/main_major.py`](https://github.com/c1earnote/major/blob/main/Backend2/main_major.py) (Outlier analysis), [`Backend/Telethon Scraper/Scraper.py`](https://github.com/c1earnote/major/blob/main/Backend/Telethon%20Scraper/Scraper.py) (Telethon scraper)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_collection["Telegram collection"]
  node_scraper["Telethon scraper<br/>[Scraper.py]"]
  node_messages["Collected messages<br/>[messages.txt]"]
end

subgraph group_analysis["Message analysis"]
  node_analysis_input["Chat input"]
  node_analysis["Outlier analysis<br/>[main_major.py]"]
  node_analysis_output["Suspicious results"]
  node_nlp["NLP model logic<br/>[nlp.py]"]
end

subgraph group_backend["File services"]
  node_flask["Flask endpoints<br/>[server.py]"]
  node_message_store["Message file<br/>[messages.txt]"]
  node_link_store["Saved link<br/>[Link.txt]"]
end

subgraph group_frontend["React dashboard"]
  node_app["React app<br/>[App.jsx]"]
  node_navbar["Tab navigation<br/>[Navbar.jsx]"]
  node_dashboard["Dashboard view<br/>[Dashboard.jsx]"]
  node_channels["Channel view"]
  node_users["Suspicious-user view"]
  node_legacy_ui["Legacy dashboard UI"]
end

node_operator(("Operator"))
node_telegram{{"Telegram"}}
node_user(("Dashboard user"))

node_operator -->|"starts scrape"| node_scraper
node_scraper -->|"joins and reads"| node_telegram
node_scraper -->|"writes messages"| node_messages
node_operator -->|"uploads chat"| node_analysis
node_analysis_input -->|"parses and scores"| node_analysis
node_analysis -->|"exports results"| node_analysis_output
node_user -.->|"opens dashboard"| node_app
node_app -->|"renders navigation"| node_navbar
node_app -->|"renders tab"| node_dashboard
node_app -->|"renders tab"| node_channels
node_app -->|"renders tab"| node_users
node_dashboard -->|"renders channels"| node_channels
node_dashboard -->|"renders users"| node_users
node_dashboard -.->|"requests API"| node_flask
node_flask -->|"reads and writes"| node_message_store
node_flask -->|"writes link"| node_link_store
node_legacy_ui -->|"fetches messages"| node_messages
node_nlp -.->|"integration unknown"| node_analysis

click node_scraper "https://github.com/c1earnote/major/blob/main/Backend/Telethon%20Scraper/Scraper.py"
click node_messages "https://github.com/c1earnote/major/blob/main/messages.txt"
click node_analysis "https://github.com/c1earnote/major/blob/main/Backend2/main_major.py"
click node_analysis_output "https://github.com/c1earnote/major/blob/main/Backend2/suspicious_messages_detailed.csv"
click node_nlp "https://github.com/c1earnote/major/blob/main/nlp.py"
click node_flask "https://github.com/c1earnote/major/blob/main/server.py"
click node_message_store "https://github.com/c1earnote/major/blob/main/messages.txt"
click node_link_store "https://github.com/c1earnote/major/blob/main/Link.txt"
click node_app "https://github.com/c1earnote/major/blob/main/Frontend/projectMain/src/App.jsx"
click node_navbar "https://github.com/c1earnote/major/blob/main/Frontend/projectMain/src/components/Navbar.jsx"
click node_dashboard "https://github.com/c1earnote/major/blob/main/Frontend/projectMain/src/components/Dashboard.jsx"
click node_channels "https://github.com/c1earnote/major/blob/main/Frontend/projectMain/src/components/DetectedChannels.jsx"
click node_users "https://github.com/c1earnote/major/blob/main/Frontend/projectMain/src/components/SuspiciousUsers.jsx"
click node_legacy_ui "https://github.com/c1earnote/major/blob/main/dashboard-script.js"

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_scraper,node_messages,node_user toneBlue
class node_analysis_input,node_analysis,node_analysis_output,node_nlp toneAmber
class node_flask,node_message_store,node_link_store toneMint
class node_app,node_navbar,node_dashboard,node_channels,node_users,node_legacy_ui toneRose
class node_operator,node_telegram toneIndigo
```

## Components

### Telegram collection

- [Telethon scraper](https://github.com/c1earnote/major/blob/main/Backend/Telethon%20Scraper/Scraper.py): `Backend/Telethon Scraper/Scraper.py`
- [Collected messages](https://github.com/c1earnote/major/blob/main/messages.txt): `messages.txt`

### Message analysis

- **Chat input**
- [Outlier analysis](https://github.com/c1earnote/major/blob/main/Backend2/main_major.py): `Backend2/main_major.py`
- [Suspicious results](https://github.com/c1earnote/major/blob/main/Backend2/suspicious_messages_detailed.csv): `Backend2/suspicious_messages_detailed.csv`
- [NLP model logic](https://github.com/c1earnote/major/blob/main/nlp.py): `nlp.py`

### File services

- [Flask endpoints](https://github.com/c1earnote/major/blob/main/server.py): `server.py`
- [Message file](https://github.com/c1earnote/major/blob/main/messages.txt): `messages.txt`
- [Saved link](https://github.com/c1earnote/major/blob/main/Link.txt): `Link.txt`

### React dashboard

- [React app](https://github.com/c1earnote/major/blob/main/Frontend/projectMain/src/App.jsx): `Frontend/projectMain/src/App.jsx`
- [Tab navigation](https://github.com/c1earnote/major/blob/main/Frontend/projectMain/src/components/Navbar.jsx): `Frontend/projectMain/src/components/Navbar.jsx`
- [Dashboard view](https://github.com/c1earnote/major/blob/main/Frontend/projectMain/src/components/Dashboard.jsx): `Frontend/projectMain/src/components/Dashboard.jsx`
- [Channel view](https://github.com/c1earnote/major/blob/main/Frontend/projectMain/src/components/DetectedChannels.jsx): `Frontend/projectMain/src/components/DetectedChannels.jsx`
- [Suspicious-user view](https://github.com/c1earnote/major/blob/main/Frontend/projectMain/src/components/SuspiciousUsers.jsx): `Frontend/projectMain/src/components/SuspiciousUsers.jsx`
- [Legacy dashboard UI](https://github.com/c1earnote/major/blob/main/dashboard-script.js): `dashboard-script.js`

### Other components

- **Operator**
- **Telegram**
- **Dashboard user**

## Connections

- Operator → Telethon scraper: starts scrape (evidence: `Backend/Telethon Scraper/Scraper.py`)
- Telethon scraper → Telegram: joins and reads (evidence: `Backend/Telethon Scraper/Scraper.py`)
- Telethon scraper → Collected messages: writes messages (evidence: `Backend/Telethon Scraper/Scraper.py`)
- Operator → Outlier analysis: uploads chat (evidence: `Backend2/main_major.py`)
- Chat input → Outlier analysis: parses and scores (evidence: `Backend2/main_major.py`)
- Outlier analysis → Suspicious results: exports results (evidence: `Backend2/main_major.py`)
- Dashboard user → React app: opens dashboard
- React app → Tab navigation: renders navigation (evidence: `Frontend/projectMain/src/App.jsx`)
- React app → Dashboard view: renders tab (evidence: `Frontend/projectMain/src/App.jsx`)
- React app → Channel view: renders tab (evidence: `Frontend/projectMain/src/App.jsx`)
- React app → Suspicious-user view: renders tab (evidence: `Frontend/projectMain/src/App.jsx`)
- Dashboard view → Channel view: renders channels (evidence: `Frontend/projectMain/src/components/Dashboard.jsx`)
- Dashboard view → Suspicious-user view: renders users (evidence: `Frontend/projectMain/src/components/Dashboard.jsx`)
- Dashboard view → Flask endpoints: requests API (evidence: `Frontend/projectMain/src/components/Dashboard.jsx`)
- Flask endpoints → Message file: reads and writes (evidence: `server.py`)
- Flask endpoints → Saved link: writes link (evidence: `server.py`)
- Legacy dashboard UI → Collected messages: fetches messages (evidence: `dashboard-script.js`)
- NLP model logic → Outlier analysis: integration unknown
