# logbyjungle/reverendtranslated architecture

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

- Interactive diagram: https://gitdiagram.com/logbyjungle/reverendtranslated
- Repository: https://github.com/logbyjungle/reverendtranslated

## Overview

##### Project type and purpose
- This is a full-stack, containerized web application (“ReverendTranslated”) built with Python/Flask.
- It scrapes chapters of *Reverend Insanity* from external sites, translates them via Google Translate through Selenium, then serves the results over HTTP/HTTPS.
- It uses Nginx as a reverse proxy in front of the Flask app, all orchestrated via Docker Compose.

##### File structure
- Top-level:
- Dockerfile, docker-compose.yml, entrypoint scripts – define and run containers
- nginx.Dockerfile, nginx.conf/https, entrypoint_nginx.sh – build and configure the Nginx proxy
- main.py & bot.py – Flask application and translation logic
- static/ & templates/ – front-end assets (CSS, JS) and Jinja2 HTML views
- requirements.txt, languages.txt – dependencies and supported languages list
- There is no dedicated database; the app fetches, translates, and serves content at request time.
- No separate microservices beyond the Nginx proxy and single Flask container.

##### Key insights from the README
- The app listens on port 5000 by default; Nginx fronts it on ports 80/443.
- Deployment instructions involve replacing domain names in nginx.conf, using DuckDNS for dynamic DNS, and managing certificates with certbot.
- TODOs highlight security, parallel requests, and CI as future improvements.

##### Emphasizing essential architectural details
- That Nginx handles SSL termination and forwards only to the Flask container.
- That translation is synchronous within the request path (for now), and mark this as a performance hotspot for future refactoring.
- Docker Compose orchestration layer by grouping the Nginx and Flask containers inside a single “Docker Network” boundary.

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Main Components
    Client["Web Browser"]:::external
    subgraph "Docker Network"
        direction TB
        Nginx["Nginx Proxy<br>(80/443)"]:::container
        Flask["Flask App<br>(5000)"]:::container
    end
    Selenium["Selenium Bot"]:::service
    StaticNode["Static Assets & Templates"]:::assets
    Certbot["Certbot"]:::service
    Story["Story Hosting Sites"]:::external
    Google["Google Translate"]:::external
    Compose["docker-compose.yml"]:::config

    %% Configuration & Setup
    subgraph "Configuration & Setup"
        direction TB
        subgraph "Nginx Configs"
            NginxDF["nginx.Dockerfile"]:::config
            NginxConf["nginx.conf"]:::config
            NginxConfHTTPS["nginx.conf.https"]:::config
            EntrNginx["entrypoint_nginx.sh"]:::script
        end
        subgraph "Flask Configs"
            FlaskDF["Dockerfile"]:::config
            EntrFlask["entrypoint.sh"]:::script
            MainPy["main.py"]:::source
            ReqTxt["requirements.txt"]:::config
        end
        subgraph "Selenium Bot Files"
            BotPy["bot.py"]:::source
            LangTxt["languages.txt"]:::config
        end
        subgraph "Static & Templates"
            StaticDir["static/"]:::assets
            TemplatesDir["templates/"]:::assets
        end
        subgraph "Documentation"
            Readme["README.md"]:::doc
            Dockerignore[".dockerignore"]:::doc
            Gitignore[".gitignore"]:::doc
            License["LICENSE"]:::doc
        end
    end

    %% Data Flows
    Client -->|"HTTP/HTTPS"| Nginx
    Nginx -->|"forward 80→5000"| Flask
    Flask -->|"serves"| StaticNode
    Flask -->|"calls"| Selenium
    Selenium -->|"scrape chapters"| Story
    Selenium -->|"translate via WebDriver"| Google
    Nginx -->|"manages certs"| Certbot
    Compose -.->|"orchestrates"| Nginx
    Compose -.->|"orchestrates"| Flask

    %% Click Events
    click NginxDF "https://github.com/logbyjungle/reverendtranslated/blob/main/nginx.Dockerfile"
    click NginxConf "https://github.com/logbyjungle/reverendtranslated/blob/main/nginx.conf"
    click NginxConfHTTPS "https://github.com/logbyjungle/reverendtranslated/blob/main/nginx.conf.https"
    click EntrNginx "https://github.com/logbyjungle/reverendtranslated/blob/main/entrypoint_nginx.sh"
    click FlaskDF "https://github.com/logbyjungle/reverendtranslated/tree/main/Dockerfile"
    click EntrFlask "https://github.com/logbyjungle/reverendtranslated/blob/main/entrypoint.sh"
    click MainPy "https://github.com/logbyjungle/reverendtranslated/blob/main/main.py"
    click ReqTxt "https://github.com/logbyjungle/reverendtranslated/blob/main/requirements.txt"
    click BotPy "https://github.com/logbyjungle/reverendtranslated/blob/main/bot.py"
    click LangTxt "https://github.com/logbyjungle/reverendtranslated/blob/main/languages.txt"
    click StaticDir "https://github.com/logbyjungle/reverendtranslated/tree/main/static/"
    click TemplatesDir "https://github.com/logbyjungle/reverendtranslated/tree/main/templates/"
    click Compose "https://github.com/logbyjungle/reverendtranslated/blob/main/docker-compose.yml"
    click Readme "https://github.com/logbyjungle/reverendtranslated/blob/main/README.md"
    click Dockerignore "https://github.com/logbyjungle/reverendtranslated/blob/main/.dockerignore"
    click Gitignore "https://github.com/logbyjungle/reverendtranslated/blob/main/.gitignore"
    click License "https://github.com/logbyjungle/reverendtranslated/tree/main/LICENSE"

    %% Styles
    classDef container fill:#D6EAF8,stroke:#2E86C1,stroke-width:2px
    classDef external fill:#FDEBD0,stroke:#E67E22,stroke-width:2px
    classDef service fill:#D5F5E3,stroke:#28B463,stroke-width:2px
    classDef config fill:#FCF3CF,stroke:#F1C40F,stroke-width:2px
    classDef script fill:#F9EBEA,stroke:#C0392B,stroke-width:2px
    classDef source fill:#E8DAEF,stroke:#8E44AD,stroke-width:2px
    classDef assets fill:#EBF5FB,stroke:#5DADE2,stroke-width:2px
    classDef doc fill:#F4ECF7,stroke:#AF7AC5,stroke-width:2px
```
