# highfire1/github-pages-replacement architecture

> Architecture diagram of the GitHub repository highfire1/github-pages-replacement, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2024-12-30). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/highfire1/github-pages-replacement
- Repository: https://github.com/highfire1/github-pages-replacement

## Overview

##### Main Components

a) External Components:
- GitHub Repository (source of the website content)
- Client Browsers (accessing the website)
- GitHub Webhook (triggering updates)

b) Container Components:
- Flask Server (webhook.py on port 5000)
- Nginx Server (on port 80, mapped to 5001)
- Static File Storage (served website content)

##### Component Details

Specific technical details:
**Flask Webhook Server (Port 5000):**
- Webhook authentication
- Git pull functionality
- Content update management

**Nginx Server (Port 80 → 5001):**
- Static file serving
- Public access point
- Performance optimization

**Storage:**
- Git repository content
- Static website files

##### Security Layer

Security components:
- Webhook password authentication (WEBHOOK_PASSWORD environment variable)
- Port mapping security
- Container isolation

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph "External Systems"
        GH[GitHub Repository]
        BR[Client Browsers]
        WH[GitHub Webhook]
    end

    subgraph "GitHub Pages Replacement Container"
        subgraph "Web Servers"
            FS["Flask Webhook Server<br/>(Port 5000)"]
            NS["Nginx Server<br/>(Port 80→5001)"]
        end
        
        subgraph "Storage"
            ST[(Static Files<br/>Repository)]
        end
        
        subgraph "Security"
            AUTH{{"Authentication<br/>Check"}}
        end
    end

    %% External to Container Flows
    WH -->|Webhook Trigger| AUTH
    AUTH -->|Authenticated| FS
    BR -->|"HTTP(S) Request"| NS
    GH -->|Content Sync| ST

    %% Internal Flows
    FS -->|Update Content| ST
    NS -->|Serve Files| ST

    %% Click Events
    click FS "https://github.com/Highfire1/github-pages-replacement/blob/main/webhook.py"

    %% Styling
    classDef external fill:#e9e9e9,stroke:#333,stroke-width:2px
    classDef server fill:#b3e0ff,stroke:#333,stroke-width:2px
    classDef storage fill:#ffcccc,stroke:#333,stroke-width:2px
    classDef security fill:#ffd700,stroke:#333,stroke-width:2px
    classDef container fill:none,stroke:#666,stroke-width:2px,stroke-dasharray: 5 5

    class GH,BR,WH external
    class FS,NS server
    class ST storage
    class AUTH security

    %% Legend
    subgraph Legend
        L1[External System]:::external
        L2[Server Component]:::server
        L3[(Storage)]:::storage
        L4{{Security Check}}:::security
    end
```
