# saladandonionrings/leaky architecture

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

- Interactive diagram: https://gitdiagram.com/saladandonionrings/leaky
- Repository: https://github.com/saladandonionrings/leaky

## Overview

##### File structure
- Top level:
- Python scripts (clean-file.py, import.py, init.py, scraper.py) and install.sh – these implement CLI tooling and web-server launch.
- source/ – example data.
- views/ – HTML template files (.tpl) & CSS under views/css/.
- .github/workflows/ – CI pipeline for Python package publishing.
- Patterns:
- MVC style: Python code acts as controller/business logic; views/ holds templates for rendering; MongoDB is the model/storage.
- Separate import pipeline (import.py) vs. web service (scraper.py).

##### README for additional insights
- Stack: Python 3.x, MongoDB 6.0, Jinja2 (implied by .tpl templates), shell installer.
- Functional flow:
a. init.py configures credentials
b. import.py parses files and pushes data into MongoDB
c. scraper.py starts a web instance exposing search, list, upload, links features

##### Elements
- Clear component labels: Browser, scraper.py (Web Server), import.py, init.py, MongoDB, templates, CSS.
- Browser → Web Server (HTTP GET/POST)
- Web Server → MongoDB (queries, writes)
- import.py → MongoDB (bulk inserts)
- install.sh → Web Server, init.py → configuration.

## Diagram (Mermaid)

```mermaid
graph TD
    %% Presentation Layer
    subgraph "Presentation Layer"
        Browser["Client Web Browser"]:::external
    end

    %% Application Layer
    subgraph "Application Layer"
        subgraph "Web Service"
            scraper["scraper.py (Web Server)"]:::backend
        end
        subgraph "CLI Tools"
            init["init.py (Configuration)"]:::cli
            importTool["import.py (Data Ingestion)"]:::cli
            cleanFile["clean-file.py (Preprocessor)"]:::cli
        end
        install["install.sh (Provisioning Script)"]:::infra
        subgraph "Templates & Static Assets"
            dashboard["dashboard.tpl"]:::frontend
            leaks["leaks.tpl"]:::frontend
            searchTpl["miscsearch.tpl"]:::frontend
            uploadTpl["upload.tpl"]:::frontend
            loginTpl["login.tpl"]:::frontend
            indexTpl["index.tpl"]:::frontend
            linksTpl["links.tpl"]:::frontend
            header["header.tpl"]:::frontend
            headerLog["header-log.tpl"]:::frontend
            footer["footer.tpl"]:::frontend
            css["style.css"]:::frontend
        end
    end

    %% Data Layer
    subgraph "Data Layer"
        mongo["MongoDB"]:::database
        sourceData["fake-example.txt"]:::storage
    end

    %% CI/CD & Documentation
    subgraph "CI/CD & Docs"
        ci["python-publish.yml"]:::infra
        readme["README.md"]:::docs
        license["LICENSE"]:::docs
    end

    %% Connections
    Browser -->|"HTTP GET/POST"| scraper
    scraper -->|"renders HTML"| dashboard
    scraper -->|"renders HTML"| leaks
    scraper -->|"renders HTML"| searchTpl
    scraper -->|"renders HTML"| uploadTpl
    scraper -->|"renders HTML"| loginTpl
    scraper -->|"renders HTML"| indexTpl
    scraper -->|"renders HTML"| linksTpl
    scraper -->|"includes partials"| header
    scraper -->|"includes partials"| headerLog
    scraper -->|"includes partials"| footer
    scraper -->|"serves CSS"| css
    scraper -->|"queries/writes"| mongo

    sourceData -->|"raw leaks"| importTool
    cleanFile -->|"cleans data"| importTool
    importTool -->|"bulk insert"| mongo
    init -->|"configures"| scraper
    init -->|"configures"| importTool
    install -->|"runs"| init
    install -->|"launches"| scraper

    ci -->|"runs workflows on repo changes"| scraper
    ci -->|"runs workflows on repo changes"| importTool
    ci -->|"runs workflows on repo changes"| install

    readme --> ci
    license --> ci

    %% Click Events
    click scraper "https://github.com/saladandonionrings/leaky/blob/main/scraper.py"
    click dashboard "https://github.com/saladandonionrings/leaky/blob/main/views/dashboard.tpl"
    click leaks "https://github.com/saladandonionrings/leaky/blob/main/views/leaks.tpl"
    click searchTpl "https://github.com/saladandonionrings/leaky/blob/main/views/miscsearch.tpl"
    click uploadTpl "https://github.com/saladandonionrings/leaky/blob/main/views/upload.tpl"
    click loginTpl "https://github.com/saladandonionrings/leaky/blob/main/views/login.tpl"
    click indexTpl "https://github.com/saladandonionrings/leaky/blob/main/views/index.tpl"
    click linksTpl "https://github.com/saladandonionrings/leaky/blob/main/views/links.tpl"
    click header "https://github.com/saladandonionrings/leaky/blob/main/views/header.tpl"
    click headerLog "https://github.com/saladandonionrings/leaky/blob/main/views/header-log.tpl"
    click footer "https://github.com/saladandonionrings/leaky/blob/main/views/footer.tpl"
    click css "https://github.com/saladandonionrings/leaky/blob/main/views/css/style.css"
    click init "https://github.com/saladandonionrings/leaky/blob/main/init.py"
    click importTool "https://github.com/saladandonionrings/leaky/blob/main/import.py"
    click cleanFile "https://github.com/saladandonionrings/leaky/blob/main/clean-file.py"
    click install "https://github.com/saladandonionrings/leaky/blob/main/install.sh"
    click sourceData "https://github.com/saladandonionrings/leaky/blob/main/source/fake-example.txt"
    click ci "https://github.com/saladandonionrings/leaky/blob/main/.github/workflows/python-publish.yml"
    click readme "https://github.com/saladandonionrings/leaky/blob/main/README.md"
    click license "https://github.com/saladandonionrings/leaky/tree/main/LICENSE"

    %% Styles
    classDef frontend fill:#fff4b1,stroke:#e1c542;
    classDef backend fill:#cce5ff,stroke:#66b0ff;
    classDef database fill:#d4f7d4,stroke:#6ec86e;
    classDef cli fill:#ffe4cc,stroke:#ffa64d;
    classDef infra fill:#e8d4f7,stroke:#ab6ec8;
    classDef external fill:#d9f0ff,stroke:#6caedf;
    classDef storage fill:#d1f0f0,stroke:#57b0b0;
    classDef docs fill:#f0f0f0,stroke:#cccccc;
```
