# mrwadams/takedown-gpt architecture

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

- Interactive diagram: https://gitdiagram.com/mrwadams/takedown-gpt
- Repository: https://github.com/mrwadams/takedown-gpt

## Overview

##### Project type and purpose
- This is a single-page Streamlit web application (app.py) whose purpose is to help users draft takedown-request emails to domain registrars.
- It uses LangChain agents orchestrating OpenAI’s function-calling capability and interacts with external services (WHOIS/RDAP lookup, DuckDuckGo search).

##### File structure
- Top-level files only:
- app.py (the entire UI + business logic)
- requirements.txt (dependencies: Streamlit, OpenAI SDK v1, LangChain, python-whois or rdap client, duckduckgo-search, etc.)
- README.md, .gitignore
- No separate frontend/backend folders: everything runs in one Python process (monolith).

##### README for technical insights
- Core flow:
a) User enters domain, OpenAI API key, selects GPT model & lookup protocol
b) App uses WHOIS/RDAP to identify the registrar
c) App uses DuckDuckGo to find takedown-request email address
d) LangChain agent + function calling draft the email
e) Streamlit displays the draft for copy/download
- Key technologies: Streamlit, OpenAI Python SDK, LangChain, WHOIS/RDAP, DuckDuckGo, Python.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% User Layer
    User["User Browser"]:::ui

    %% Frontend
    subgraph "Streamlit Frontend"
        UI["Streamlit UI"]:::ui
    end

    %% Core Orchestrator
    subgraph "Application Core"
        Core["LangChain Orchestrator"]:::core
        State["In-Memory State"]:::util
    end

    %% External Services
    subgraph "External Services"
        WHOIS["WHOIS/RDAP Lookup Service"]:::util
        DDG["DuckDuckGo Search Service"]:::util
        OpenAI["OpenAI Chat API"]:::api
    end

    %% Project Files
    subgraph "Project Files"
        Req["requirements.txt"]:::docs
        Readme["README.md"]:::docs
    end

    %% Data Flow
    User -->|"inputs: domain, API key, model choice"| UI
    UI -->|"trigger workflow"| Core
    Core -->|"lookup(domain)"| WHOIS
    WHOIS -->|"registration data JSON"| Core
    Core -->|"search(query)"| DDG
    DDG -->|"search results JSON"| Core
    Core -->|"chat.completions.create(function calls)"| OpenAI
    OpenAI -->|"response with drafted email JSON"| Core
    Core -->|"render draft"| UI

    Core --> State
    State --> Core

    %% Click Events
    click UI "https://github.com/mrwadams/takedown-gpt/blob/main/app.py"
    click Core "https://github.com/mrwadams/takedown-gpt/blob/main/app.py"
    click WHOIS "https://github.com/mrwadams/takedown-gpt/blob/main/app.py"
    click DDG "https://github.com/mrwadams/takedown-gpt/blob/main/app.py"
    click OpenAI "https://github.com/mrwadams/takedown-gpt/blob/main/app.py"
    click State "https://github.com/mrwadams/takedown-gpt/blob/main/app.py"
    click Req "https://github.com/mrwadams/takedown-gpt/blob/main/requirements.txt"
    click Readme "https://github.com/mrwadams/takedown-gpt/blob/main/README.md"

    %% Styles
    classDef ui fill:#D0E7FF,stroke:#0366d6,color:#0366d6,stroke-width:1px;
    classDef core fill:#D9FFE5,stroke:#28a745,color:#28a745,stroke-width:1px;
    classDef api fill:#FFDDAA,stroke:#ff9900,color:#ff9900,stroke-width:1px;
    classDef util fill:#E0E0E0,stroke:#666666,color:#333333,stroke-width:1px;
    classDef docs fill:#F5F5F5,stroke:#999999,color:#555555,stroke-width:1px;
```
