# habeeb-urrahman/githubanalyzer architecture

> Architecture diagram of the GitHub repository habeeb-urrahman/githubanalyzer, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-06-04). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/habeeb-urrahman/githubanalyzer
- Repository: https://github.com/habeeb-urrahman/githubanalyzer

## Overview

##### Project type and purpose
- This is a lightweight full-stack web application built with Flask (Python) on the backend and plain HTML/CSS/JS on the frontend.
- Its purpose is to accept a GitHub repository URL from the user, call the GitHub API, gather metadata and activity info (stars, forks, issues, contributors, commits), and display those insights in the browser.

##### File structure
- Top-level files:
- app.py – the Flask application entry point and controller logic
- requirements.txt – Python dependencies (Flask, requests, python-dotenv, etc.)
- index.html & style.css & script.js – likely legacy or direct static prototypes
- .gitignore, README.md
- Directories:
- /templates – Jinja2 templates (templates/index.html) used by Flask to render dynamic pages
- /static – served assets (static/script.js, static/style.css). These contain client-side behavior (AJAX calls, charting) and styles.

##### README for additional insights
- The README outlines features (metadata display, contributor stats, commit visualization), setup steps (virtual environment, .env with GITHUB_TOKEN), and startup (flask run).
- It implies use of environment configuration for API tokens, HTTP interaction with GitHub’s REST API, and data processing in Python before rendering.

##### Detailed capture of essential elements
- Don’t omit the role of the .env file and how secrets flow into the server
- Call out the static vs. template asset distinction
- That the server has no database—data comes fresh each request
- If using a chart library, group it under “Client visualization”

Summary instruction to the architect:

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Frontend Layer
    subgraph "Frontend" 
        Browser["Browser"]:::client
        subgraph "Static Assets"
            StaticJS["static/script.js"]:::client
            StaticCSS["static/style.css"]:::client
        end
        LegacyHTML["index.html (legacy prototype)"]:::client
    end

    %% Backend Layer
    subgraph "Backend"
        subgraph "Flask Application"
            Controllers["app.py\n(Controllers & Business Logic)"]:::backend
            Templates["templates/index.html\n(Jinja2 Templates)"]:::backend
        end
        Dependencies["requirements.txt"]:::config
    end

    %% External Services and Config
    Config[".env\n(GITHUB_TOKEN)"]:::config
    GitHub["GitHub REST API"]:::external

    %% Project Documentation
    subgraph "Project Files"
        Doc["README.md"]:::config
        Gitignore[".gitignore"]:::config
    end

    %% Connections
    Browser -->|"HTTP GET /"| Controllers
    Browser -->|"AJAX GET /repo-data"| Controllers
    Controllers -->|"load .env variables"| Config
    Controllers -->|"uses dependencies"| Dependencies
    Controllers -->|"API request (token)"| GitHub
    GitHub -->|"API response (JSON)"| Controllers
    Controllers -->|"Render HTML"| Templates
    Controllers -->|"Return JSON"| Browser
    Browser -->|"load JS"| StaticJS
    Browser -->|"load CSS"| StaticCSS

    %% Click Events
    click Controllers "https://github.com/habeeb-urrahman/githubanalyzer/blob/main/app.py"
    click Dependencies "https://github.com/habeeb-urrahman/githubanalyzer/blob/main/requirements.txt"
    click Templates "https://github.com/habeeb-urrahman/githubanalyzer/blob/main/templates/index.html"
    click StaticJS "https://github.com/habeeb-urrahman/githubanalyzer/blob/main/static/script.js"
    click StaticCSS "https://github.com/habeeb-urrahman/githubanalyzer/blob/main/static/style.css"
    click LegacyHTML "https://github.com/habeeb-urrahman/githubanalyzer/blob/main/index.html"
    click Doc "https://github.com/habeeb-urrahman/githubanalyzer/blob/main/README.md"
    click Gitignore "https://github.com/habeeb-urrahman/githubanalyzer/blob/main/.gitignore"

    %% Styles
    classDef client fill:#cce5ff,stroke:#0366d6,color:#0366d6;
    classDef backend fill:#d4edda,stroke:#28a745,color:#155724;
    classDef external fill:#fff3cd,stroke:#e69500,color:#856404;
    classDef config fill:#e2e3e5,stroke:#6c757d,color:#343a40;
```
