# rayaan-khan428/leetr architecture

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

- Interactive diagram: https://gitdiagram.com/rayaan-khan428/leetr
- Repository: https://github.com/rayaan-khan428/leetr

## Overview

##### Main Components Identification

a) Frontend (React Application)
b) Backend (Node.js Server)
c) Chrome Extension
d) Database Layer

##### Component Breakdown and Relationships

Frontend Layer:
- Components Module (containing Nav, Footer, LeetCodeStatsCard, etc.)
- Pages Module (Homepage and Main)
- Data Visualization Components (DifficultyDistributionChart)
- Problem Management (ProblemsTable, CheckProblemsButton)

Backend Layer:
- Main Server (index.js)
- Problem Handler (Problem.js)
- Scheduled Tasks Service (scheduledTasks.js)
- Environment Configuration (.env)

Chrome Extension Layer:
- Background Script (background.js)
- Content Script (content.js)
- Popup Interface (popup.html, popup.js)
- Extension Configuration (manifest.json)

Database Layer:
- A database symbol showing data storage

##### Interaction Flows

- Frontend ↔ Backend (REST API calls)
- Chrome Extension ↔ Backend (Data synchronization)
- Backend ↔ Database (Data persistence)
- Chrome Extension ↔ LeetCode Website (External interaction)

##### Technical Stack Indicators

Technology badges or labels for:
- React.js (Frontend)
- Node.js (Backend)
- Chrome Extensions API
- Any database technology being used (based on basic.txt presence)

##### Additional Elements

Include:
- Version/environment indicators
- Data flow direction indicators
- API endpoints (if specific ones are crucial)

## Diagram (Mermaid)

```mermaid
graph TB
    %% Title
    title[leetr System Architecture]:::title
    
    %% Main Layers
    subgraph ChromeExtension[Chrome Extension Layer]
        BG[Background Script]
        CS[Content Script]
        subgraph Popup[Popup Interface]
            PH[Popup HTML]
            PJ[Popup JS]
            PC[Popup CSS]
        end
        MC[Manifest Config]
    end

    subgraph FrontendLayer[Frontend Layer]
        subgraph Components[React Components]
            Nav[Navigation]
            Footer[Footer]
            Stats[LeetCode Stats Card]
            Chart[Difficulty Distribution]
            PT[Problems Table]
            CPB[Check Problems Button]
        end
        
        subgraph Pages[React Pages]
            HP[Homepage]
            MP[Main Page]
        end
    end

    subgraph BackendLayer[Backend Layer]
        Server[Main Server]
        PH2[Problem Handler]
        ST[Scheduled Tasks]
        EC[Environment Config]
    end

    subgraph DBLayer[Database Layer]
        DB[(Database Storage)]
    end

    %% External Service
    LC[LeetCode Website]:::external

    %% Relationships
    ChromeExtension --> LC
    ChromeExtension --> BackendLayer
    FrontendLayer --> BackendLayer
    BackendLayer --> DB
    
    %% Click Events
    click Nav "https://github.com/Rayaan-khan428/leetr/blob/main/frontend/src/components/Nav.jsx"
    click Footer "https://github.com/Rayaan-khan428/leetr/blob/main/frontend/src/components/Footer.jsx"
    click Stats "https://github.com/Rayaan-khan428/leetr/blob/main/frontend/src/components/LeetCodeStatsCard.jsx"
    click Chart "https://github.com/Rayaan-khan428/leetr/blob/main/frontend/src/components/DifficultyDistributionChart.jsx"
    click PT "https://github.com/Rayaan-khan428/leetr/blob/main/frontend/src/components/ProblemsTable.jsx"
    click CPB "https://github.com/Rayaan-khan428/leetr/blob/main/frontend/src/components/CheckProblemsButton.jsx"
    click HP "https://github.com/Rayaan-khan428/leetr/blob/main/frontend/src/pages/Homepage.jsx"
    click MP "https://github.com/Rayaan-khan428/leetr/blob/main/frontend/src/pages/Main.jsx"
    click Server "https://github.com/Rayaan-khan428/leetr/blob/main/backend/index.js"
    click PH2 "https://github.com/Rayaan-khan428/leetr/blob/main/backend/Problem.js"
    click ST "https://github.com/Rayaan-khan428/leetr/blob/main/backend/scheduledTasks.js"
    click EC "https://github.com/Rayaan-khan428/leetr/blob/main/backend/.env"
    click BG "https://github.com/Rayaan-khan428/leetr/blob/main/chrome_extension/background.js"
    click CS "https://github.com/Rayaan-khan428/leetr/blob/main/chrome_extension/content.js"
    click PH "https://github.com/Rayaan-khan428/leetr/blob/main/chrome_extension/popup.html"
    click PJ "https://github.com/Rayaan-khan428/leetr/blob/main/chrome_extension/popup.js"
    click PC "https://github.com/Rayaan-khan428/leetr/blob/main/chrome_extension/popup.css"
    click MC "https://github.com/Rayaan-khan428/leetr/blob/main/chrome_extension/manifest.json"
    click DB "https://github.com/Rayaan-khan428/leetr/blob/main/database/basic.txt"

    %% Styling
    classDef default fill:#f9f9f9,stroke:#333,stroke-width:2px
    classDef frontend fill:#dae8fc,stroke:#6c8ebf
    classDef backend fill:#d5e8d4,stroke:#82b366
    classDef extension fill:#ffe6cc,stroke:#d79b00
    classDef database fill:#fff2cc,stroke:#d6b656
    classDef external fill:#f5f5f5,stroke:#666666
    classDef title fill:none,stroke:none
    
    %% Apply styles
    class Nav,Footer,Stats,Chart,PT,CPB,HP,MP frontend
    class Server,PH2,ST,EC backend
    class BG,CS,PH,PJ,PC,MC extension
    class DB database
    class LC external
    class title title
```
