# jeremiahpetersen/repototext architecture

> Architecture diagram of the GitHub repository jeremiahpetersen/repototext, 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/jeremiahpetersen/repototext
- Repository: https://github.com/jeremiahpetersen/repototext

## Overview

##### Project type and purpose
- RepoToText is a full-stack web application whose goal is to fetch the contents of a GitHub repository (and optional external documentation), concatenate all files into a single structured .txt file, and present that text in the browser while saving it to disk.

##### File structure
- Top-level:
- Dockerfiles (Dockerfile.frontend, Dockerfile.backend) and docker-compose.yml for containerization of front- and back-ends.
- package.json / public / src → React.js SPA.
- requirements.txt, Python scripts (RepoToText.py, FolderToText.py), plus .env for GITHUB_API_KEY → Python Flask API.
- /.github/workflows → CI linting for Python and JavaScript.
- /data (implied) → output folder for generated .txt files.
- Pattern: Single front-end SPA talks to a single back-end service over HTTP. The back end uses PyGithub, BeautifulSoup, etc., to scrape repos.

##### README for additional insights
- Tech stack: React.js (frontend), Flask (backend), Docker, GitHub API (PyGithub), plus retry, flask_cors, requests, beautifulsoup4.
- Runtime flow: user enters URLs → front end calls Flask endpoint → back end fetches repo & docs → back end returns text payload → UI displays & writes to /data.

##### Detailed call-outs
- Environment variables (.env → GITHUB_API_KEY).
- Docker Compose orchestrating the two containers.
- Retry logic or error handling between Flask and GitHub API.

## Diagram (Mermaid)

```mermaid
flowchart TD
    Browser["Browser"]:::external
    subgraph "Frontend Tier"
        ReactSPA["React SPA"]:::frontend
        Package["package.json"]:::file
        Public["public/"]:::file
        Src["src/"]:::file
    end
    subgraph "Backend Tier"
        FlaskAPI["Flask API"]:::backend
        RepoToText["RepoToText.py"]:::file
        FolderToText["FolderToText.py"]:::file
        Requirements["requirements.txt"]:::file
        DataVol["/data Volume"]:::storage
    end
    subgraph "Container Build"
        DockerfileFE["Dockerfile.frontend"]:::file
        DockerfileBE["Dockerfile.backend"]:::file
    end
    subgraph "CI/CD Pipelines"
        ESLint["ESLint Workflow"]:::ci
        PyLint["PyLint Workflow"]:::ci
    end
    subgraph "Lint Config"
        ESLintConfig[".eslintrc.yml"]:::file
        PrettierConfig[".prettierrc.json"]:::file
    end
    GitHubAPI["GitHub API"]:::external
    Docs["Documentation URL"]:::external
    Compose["Docker Compose"]:::backend

    Browser -->|"HTTPS"| ReactSPA
    ReactSPA -->|"HTTP"| FlaskAPI
    FlaskAPI -->|"GitHub REST API"| GitHubAPI
    FlaskAPI -->|"HTTP GET"| Docs
    FlaskAPI -->|"Filesystem Write"| DataVol
    Compose -.-> ReactSPA
    Compose -.-> FlaskAPI
    Compose --> DockerfileFE
    Compose --> DockerfileBE
    ESLint -.-> Compose
    PyLint -.-> Compose
    ESLint --> ESLintConfig
    ESLint --> PrettierConfig

    click ReactSPA "https://github.com/jeremiahpetersen/repototext/blob/main/package.json"
    click Package "https://github.com/jeremiahpetersen/repototext/blob/main/package.json"
    click Public "https://github.com/jeremiahpetersen/repototext/tree/main/public/"
    click Src "https://github.com/jeremiahpetersen/repototext/tree/main/src/"
    click RepoToText "https://github.com/jeremiahpetersen/repototext/blob/main/RepoToText.py"
    click FolderToText "https://github.com/jeremiahpetersen/repototext/blob/main/FolderToText.py"
    click Requirements "https://github.com/jeremiahpetersen/repototext/blob/main/requirements.txt"
    click DataVol "https://github.com/jeremiahpetersen/repototext/tree/main//data"
    click DockerfileFE "https://github.com/jeremiahpetersen/repototext/blob/main/Dockerfile.frontend"
    click DockerfileBE "https://github.com/jeremiahpetersen/repototext/blob/main/Dockerfile.backend"
    click Compose "https://github.com/jeremiahpetersen/repototext/blob/main/docker-compose.yml"
    click ESLint "https://github.com/jeremiahpetersen/repototext/blob/main/.github/workflows/es-lint.yml"
    click PyLint "https://github.com/jeremiahpetersen/repototext/blob/main/.github/workflows/pylint.yml"
    click ESLintConfig "https://github.com/jeremiahpetersen/repototext/blob/main/.eslintrc.yml"
    click PrettierConfig "https://github.com/jeremiahpetersen/repototext/blob/main/.prettierrc.json"

    classDef frontend fill:#BBDEFB,stroke:#0D47A1,color:#0D47A1
    classDef backend fill:#90CAF9,stroke:#0D47A1,color:#0D47A1
    classDef storage fill:#A5D6A7,stroke:#1B5E20,color:#1B5E20
    classDef external fill:#FFE082,stroke:#FF6F00,color:#FF6F00
    classDef ci fill:#E1BEE7,stroke:#6A1B9A,color:#6A1B9A
    classDef file fill:#CFD8DC,stroke:#37474F,color:#37474F
```
