# kenancn/seo-analysis-tool architecture

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

- Interactive diagram: https://gitdiagram.com/kenancn/seo-analysis-tool
- Repository: https://github.com/kenancn/seo-analysis-tool

## Overview

##### Frontend Layer
- UI components for URL input, keyword input, and analysis results display
- Three main feature sections: Lighthouse Analysis, Competitor Analysis, and Content Analysis

##### Backend Layer (app.py)
- Connection to the utilities package and its modules:
- lighthouse.py (Performance analysis)
- compare_pages.py (Competitor analysis)
- lightHTMLsum.py (Content analysis)

##### External Services Layer
- Google Gemini AI API
- Brightdata Scraping Browser
- Brightdata Web Unlocker
- Brightdata SERP API

##### Data Flow Layer
- Data transformation and processing steps

- [User Interface Layer]
- ↓
- [Application Layer]
- ↓
- [Utilities Layer]
- ↓
- [External Services Layer]

##### Component Relationships
- How app.py orchestrates the utilities
- Demonstrate how external APIs are accessed through the utility modules
- Data flow between components

##### Specific Flows
- URL/keyword input → app.py → appropriate utility module
- Lighthouse analysis flow through lighthouse.py
- Competitor analysis flow through compare_pages.py
- Content analysis flow through lightHTMLsum.py
- Results aggregation and presentation back to frontend

##### Technical Details
- Python 3.12+ runtime environment
- Streamlit framework
- API authentication flow
- Environment configuration (.env)

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph UI["User Interface Layer"]
        FE["Streamlit Frontend"]:::frontend
        URL["URL Input"]:::frontend
        KW["Keyword Input"]:::frontend
        RES["Results Display"]:::frontend
    end

    subgraph APP["Application Layer"]
        MAIN["Main Application Controller"]:::backend
        CONFIG["Environment Config"]:::config
    end

    subgraph UTIL["Utilities Layer"]
        LH["Lighthouse Analysis"]:::util
        CA["Competitor Analysis"]:::util
        CN["Content Analysis"]:::util
    end

    subgraph EXT["External Services Layer"]
        GEM["Google Gemini AI"]:::external
        BSB["Brightdata Scraping Browser"]:::external
        BWU["Brightdata Web Unlocker"]:::external
        BSE["Brightdata SERP API"]:::external
    end

    %% Frontend Connections
    URL --> MAIN
    KW --> MAIN
    MAIN --> RES

    %% Main App Connections
    MAIN --> LH
    MAIN --> CA
    MAIN --> CN
    CONFIG --> MAIN

    %% Utility Connections
    LH --> BSB
    CA --> BSE
    CA --> BSB
    CN --> GEM
    CN --> BWU

    %% Styling
    classDef frontend fill:#3498db,stroke:#2980b9,color:white
    classDef backend fill:#2ecc71,stroke:#27ae60,color:white
    classDef util fill:#e67e22,stroke:#d35400,color:white
    classDef external fill:#f1c40f,stroke:#f39c12,color:black
    classDef config fill:#95a5a6,stroke:#7f8c8d,color:white

    %% Click Events
    click MAIN "https://github.com/kenancn/seo-analysis-tool/blob/main/app.py"
    click LH "https://github.com/kenancn/seo-analysis-tool/blob/main/utilities/lighthouse.py"
    click CA "https://github.com/kenancn/seo-analysis-tool/blob/main/utilities/compare_pages.py"
    click CN "https://github.com/kenancn/seo-analysis-tool/blob/main/utilities/lightHTMLsum.py"
    click UTIL "https://github.com/kenancn/seo-analysis-tool/blob/main/utilities/__init__.py"
    click CONFIG "https://github.com/kenancn/seo-analysis-tool/blob/main/.devcontainer/devcontainer.json"

    %% Legend
    subgraph Legend
        L1["Frontend Component"]:::frontend
        L2["Backend Component"]:::backend
        L3["Utility Module"]:::util
        L4["External Service"]:::external
        L5["Configuration"]:::config
    end
```
