# silvermete0r/leetcode-solution-complexity-analyzer architecture

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

- Interactive diagram: https://gitdiagram.com/silvermete0r/leetcode-solution-complexity-analyzer
- Repository: https://github.com/silvermete0r/leetcode-solution-complexity-analyzer

## Overview

##### Main Components

A. Frontend Layer:
- Static assets (/app/static)
- Templates (/app/templates)
- Four main pages: index, profile, stars, and 404

B. Backend Layer:
- Flask Application (Python-based)
- Main routes handler (/app/routes.py)
- Complexity analyzer module (/app/complexity.py)
- Utilities module (/app/utils/leetcode.py)

C. External Services:
- Gemini Pro API (for complexity analysis)
- LeetCode API (for fetching solution data)

- [Client Tier] → [Application Tier] → [External Services Tier]

##### Flow Representation

- User requests → Flask Routes
- Routes → Complexity Analyzer
- Complexity Analyzer → Gemini Pro API
- LeetCode Utilities → LeetCode API
- Server responses → Client

##### Additional Elements

Supporting components:
- Configuration files (.env)
- Docker container boundary
- Vercel deployment environment

##### Specific Implementation Details

- A container boundary showing Docker encapsulation
- Vercel deployment wrapper

##### Technical Stack Indicators

- Python/Flask
- HTML/CSS
- Gemini Pro AI
- Docker
- Vercel

This system design should effectively communicate how the application processes LeetCode solutions, analyzes their complexity using AI, and serves the results to the Kazakhstan LeetCode community.

## Diagram (Mermaid)

```mermaid
flowchart TB
    subgraph Client
        Browser["Web Browser"]
        Static["Static Assets"]:::frontend
        Templates["HTML Templates"]:::frontend
    end

    subgraph Application
        Flask["Flask Server"]:::backend
        Routes["Routes Handler"]:::backend
        Complexity["Complexity Analyzer"]:::backend
        LeetUtils["LeetCode Utilities"]:::backend
        Stars["Stars Storage"]:::data
        Prompts["AI Prompts"]:::data
    end

    subgraph External
        GeminiAPI["Gemini Pro API"]:::external
        LeetAPI["LeetCode API"]:::external
    end

    subgraph Config
        EnvConfig[".env Configuration"]:::config
        DockerConfig["Docker Config"]:::config
        VercelConfig["Vercel Config"]:::config
        Requirements["Dependencies"]:::config
    end

    Browser --> Routes
    Static --> Browser
    Templates --> Browser
    
    Routes --> Complexity
    Routes --> LeetUtils
    Routes --> Stars
    
    Complexity --> GeminiAPI
    Complexity --> Prompts
    LeetUtils --> LeetAPI

    %% Click Events
    click Static "https://github.com/silvermete0r/leetcode-solution-complexity-analyzer/blob/main/app/static/style.css"
    click Templates "https://github.com/silvermete0r/leetcode-solution-complexity-analyzer/tree/main/app/templates"
    click Flask "https://github.com/silvermete0r/leetcode-solution-complexity-analyzer/blob/main/app/__init__.py"
    click Routes "https://github.com/silvermete0r/leetcode-solution-complexity-analyzer/blob/main/app/routes.py"
    click Complexity "https://github.com/silvermete0r/leetcode-solution-complexity-analyzer/blob/main/app/complexity.py"
    click LeetUtils "https://github.com/silvermete0r/leetcode-solution-complexity-analyzer/blob/main/app/utils/leetcode.py"
    click Stars "https://github.com/silvermete0r/leetcode-solution-complexity-analyzer/blob/main/stars.json"
    click Prompts "https://github.com/silvermete0r/leetcode-solution-complexity-analyzer/blob/main/prompts.json"
    click EnvConfig "https://github.com/silvermete0r/leetcode-solution-complexity-analyzer/blob/main/.env.example"
    click DockerConfig "https://github.com/silvermete0r/leetcode-solution-complexity-analyzer/tree/main/Dockerfile"
    click VercelConfig "https://github.com/silvermete0r/leetcode-solution-complexity-analyzer/blob/main/vercel.json"
    click Requirements "https://github.com/silvermete0r/leetcode-solution-complexity-analyzer/blob/main/requirements.txt"

    %% Styling
    classDef frontend fill:#a8d1ff,stroke:#333,stroke-width:2px
    classDef backend fill:#90EE90,stroke:#333,stroke-width:2px
    classDef external fill:#FFB347,stroke:#333,stroke-width:2px
    classDef data fill:#FFE4B5,stroke:#333,stroke-width:2px
    classDef config fill:#E6E6FA,stroke:#333,stroke-width:2px

    %% Legend
    subgraph Legend
        Frontend["Frontend Component"]:::frontend
        Backend["Backend Component"]:::backend
        External["External Service"]:::external
        Data["Data Storage"]:::data
        Config["Configuration"]:::config
    end
```
