# v4lkyr13101/linkedin-profile-analyser architecture

> Architecture diagram of the GitHub repository v4lkyr13101/linkedin-profile-analyser, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-03-31). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/v4lkyr13101/linkedin-profile-analyser
- Repository: https://github.com/v4lkyr13101/linkedin-profile-analyser

## Overview

##### Project Type and Purpose
- This is a browser extension aimed at enhancing LinkedIn profile pages by injecting a sidebar interface, extracting profile content, and sending data to Google AI services for interactive analysis.
- The README indicates features like model selection (gemmi-3-27b-it, gemini-2.0-flash), API key management, and custom questions, making it primarily a frontend enhancement tool running in Chrome.

##### File Structure
- Key Extension Files/Components:
- background.js: Likely coordinates long-running background tasks and manages runtime events.
- content.js: Injects scripts that scrape LinkedIn’s DOM to extract the current profile’s content.
- popup.html and popup.js: Provide the settings UI for entering the API key and selecting a model.
- sidepanel.html and sidepanel.js: Build the sliding sidebar interface for displaying custom questions and analysis results.
- styles.css: Contains styling for the extension’s UI components.
- Ancillary Files:
- attached_assets: Contains some assets/logs possibly used for debugging or additional styles.
- web_scraper.py and pyproject.toml: Suggest the existence of a Python helper tool (e.g., for local web scraping or testing) that complements the main extension logic, though the README does not cover its usage in the Chrome context.

##### Architectural Components and Their Relationships
- Main Components:
a. User Interface Components:
- Popup UI: Letting users configure settings.
- Sidepanel UI: Displayed on LinkedIn profiles to show AI analysis and custom question options.
b. Core Scripts:
- Background Script: Acts as the orchestrator, listening for events (such as browser actions) and managing storage.
- Content Script: Injected into LinkedIn pages to extract relevant profile data.
c. External Integration:
- Google AI API: Receives extracted profile data and returns analysis results.
- Additional Component:
- Python Utility (web_scraper.py): Though not central to the extension’s runtime in Chrome, it can be seen as a supporting module for standalone scraping tasks or testing.

##### Key Interactions
- Settings are stored locally (using Chrome’s storage API).
- When the user navigates to a LinkedIn profile:
- content.js extracts profile content and may trigger sidepanel.html/sidepanel.js to expand automatically.
- The extracted data is then sent (via background.js) to the Google AI API.
- Results are displayed back on the side panel and/or stored for later reference.
- Optionally, web_scraper.py might be used outside of Chrome for similar scraping verification or utility functions.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Global Nodes
    user("Browser User"):::user
    linkedin("LinkedIn Profile Page"):::ui
    googleAI("Google AI API"):::external

    %% Chrome Extension Subgraph
    subgraph "Chrome Extension"
        %% Manifest & Assets Subgraph
        subgraph "Manifest & Assets"
            manifest("manifest.json"):::asset
            icons("Icons"):::asset
            assets("Attached Assets"):::asset
        end

        %% UI Components Subgraph
        subgraph "UI Components"
            subgraph "Popup UI"
                popupHTML("popup.html"):::ui
                popupJS("popup.js"):::ui
            end
            subgraph "Sidepanel UI"
                sidepanelHTML("sidepanel.html"):::ui
                sidepanelJS("sidepanel.js"):::ui
            end
        end

        background("background.js – Event Listener"):::scriptBackend
        content("content.js – Data Extraction"):::scriptBackend
        styles("styles.css"):::ui
        storage("Chrome Storage"):::scriptBackend
    end

    %% Python Utility Subgraph
    subgraph "Python Utility (Auxiliary Tool)"
        pythonWeb("web_scraper.py"):::utility
        pythonPy("pyproject.toml"):::utility
    end

    %% Interactions
    %% User interactions
    user -->|"clickExtension"| popupHTML
    user -->|"navigateToProfile"| linkedin

    %% Manifest loading
    manifest -->|"load"| background
    manifest -->|"load"| content
    manifest -->|"load"| popupHTML
    manifest -->|"load"| sidepanelHTML
    manifest -->|"applyStyles"| styles

    %% Popup UI storing settings
    popupHTML -->|"storeAPIKey"| storage

    %% LinkedIn page triggers data extraction
    linkedin -->|"extractProfileData"| content

    %% Content Script sends data to Background Script for processing
    content -->|"sendExtractedData"| background

    %% Background Script calls external API
    background -->|"sendAnalysisRequest"| googleAI
    googleAI -->|"returnAnalysis"| background

    %% Background Script updates UI
    background -->|"displayResults"| sidepanelHTML

    %% Class Definitions
    classDef ui fill:#B3E5FC,stroke:#0277BD,stroke-width:2px;
    classDef scriptBackend fill:#C8E6C9,stroke:#2E7D32,stroke-width:2px;
    classDef external fill:#FFCCBC,stroke:#E64A19,stroke-width:2px;
    classDef asset fill:#FFF9C4,stroke:#FBC02D,stroke-width:2px;
    classDef utility fill:#F8BBD0,stroke:#C2185B,stroke-width:2px;
    classDef user fill:#D1C4E9,stroke:#512DA8,stroke-width:2px;

    %% Click Events for Component Mapping
    click manifest "https://github.com/v4lkyr13101/linkedin-profile-analyser/blob/main/manifest.json"
    click icons "https://github.com/v4lkyr13101/linkedin-profile-analyser/tree/main/icons"
    click assets "https://github.com/v4lkyr13101/linkedin-profile-analyser/tree/main/attached_assets"
    click background "https://github.com/v4lkyr13101/linkedin-profile-analyser/blob/main/background.js"
    click content "https://github.com/v4lkyr13101/linkedin-profile-analyser/blob/main/content.js"
    click popupHTML "https://github.com/v4lkyr13101/linkedin-profile-analyser/blob/main/popup.html"
    click popupJS "https://github.com/v4lkyr13101/linkedin-profile-analyser/blob/main/popup.js"
    click sidepanelHTML "https://github.com/v4lkyr13101/linkedin-profile-analyser/blob/main/sidepanel.html"
    click sidepanelJS "https://github.com/v4lkyr13101/linkedin-profile-analyser/blob/main/sidepanel.js"
    click styles "https://github.com/v4lkyr13101/linkedin-profile-analyser/blob/main/styles.css"
    click pythonWeb "https://github.com/v4lkyr13101/linkedin-profile-analyser/blob/main/web_scraper.py"
    click pythonPy "https://github.com/v4lkyr13101/linkedin-profile-analyser/blob/main/pyproject.toml"
```
