# razgrom47/cloud architecture

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

- Interactive diagram: https://gitdiagram.com/razgrom47/cloud
- Repository: https://github.com/razgrom47/cloud

## Overview

##### Project type and purpose
- This is a lightweight full-stack web application built in Python using Flask.
- Purpose: act as a simple “cloud storage” interface for browsing, uploading, creating, deleting, and searching files/folders on a local directory (`cloud_storage`).

##### File structure
- Top-level files:
- app.py – the Flask application entry point (controls routes, business logic)
- requirements.txt, Dockerfile, .gitignore – build/deploy configuration
- Directories:
- static/ – CSS (and JS if any) served directly to clients
- templates/ – Jinja2 HTML templates
- cloud_storage/ – the actual file store (configured by BASE_DIR)
- (optional) uploads/ – if uploads are stored separately
- No external database: all persistence is via filesystem.

##### Extract insights from the README
- Key features that drive the architecture:
- HTTP routes for listing, uploading, creating, deleting, searching files.
- Path sanitization and secure filename handling using Werkzeug.
- Theme toggle (client-side UI state) and disk usage metrics.
- No authentication layer at present; security boundary is the BASE_DIR root.

##### Details to capture
- All Flask routes and their primary actions (list, upload, delete, search).
- The theme toggle as a UI state (client side only).
- Disk usage computation as a server-side utility called by the controller.
- Path sanitization step before any filesystem call.

## Diagram (Mermaid)

```mermaid
graph TB
    %% Client Side
    subgraph "Client Side"
        direction TB
        Browser["Web Browser UI"]:::client
        ThemeToggle["Theme Toggle (UI State)"]:::client
    end

    %% Server Side
    subgraph "Server Side"
        direction TB
        FlaskApp["Flask Application Server\n(app.py)"]:::server
        Routes["HTTP Routes\n/, /upload, /delete, /search"]:::server
        Sanitization["Path Sanitization\n(Werkzeug)"]:::server
        DiskUsage["Disk Usage Utility"]:::server
        subgraph "View Renderer"
            direction TB
            TemplateEngine["Jinja2 Template Engine\n(templates/index.html)"]:::view
        end
        subgraph "Static Asset Server"
            direction TB
            StaticAssets["Static Assets\n(static/)"]:::static
            StyleCSS["style.css"]:::static
        end
        subgraph "Model - File System"
            direction TB
            FileSystem["Cloud Storage File System\n(cloud_storage/)"]:::storage
        end
    end

    %% Build & Deployment Configuration
    subgraph "Build & Deployment"
        direction TB
        Requirements["requirements.txt"]:::config
        DockerfileNode["Dockerfile"]:::config
        Gitignore[".gitignore"]:::config
    end

    %% Interactions
    Browser -->|"HTTP GET/POST"| FlaskApp
    ThemeToggle --> Browser
    FlaskApp --> Routes
    Routes --> Sanitization
    Sanitization --> FileSystem
    Sanitization --> DiskUsage
    FlaskApp --> TemplateEngine
    TemplateEngine --> FlaskApp
    FlaskApp --> StaticAssets
    StaticAssets --> Browser
    FlaskApp --> FileSystem

    %% Click Events
    click FlaskApp "https://github.com/razgrom47/cloud/blob/main/app.py"
    click StaticAssets "https://github.com/razgrom47/cloud/tree/main/static/"
    click StyleCSS "https://github.com/razgrom47/cloud/blob/main/static/style.css"
    click TemplateEngine "https://github.com/razgrom47/cloud/blob/main/templates/index.html"
    click Requirements "https://github.com/razgrom47/cloud/blob/main/requirements.txt"
    click DockerfileNode "https://github.com/razgrom47/cloud/tree/main/Dockerfile"
    click Gitignore "https://github.com/razgrom47/cloud/blob/main/.gitignore"
    click FileSystem "https://github.com/razgrom47/cloud/tree/main/cloud_storage/"

    %% Styles
    classDef client fill:#E8F4FD,stroke:#1E90FF,stroke-width:2px
    classDef server fill:#FFF5E5,stroke:#FFA500,stroke-width:2px
    classDef view fill:#F0FFF0,stroke:#32CD32,stroke-width:2px
    classDef static fill:#F5F5FF,stroke:#6A5ACD,stroke-width:2px
    classDef storage fill:#FFF0F5,stroke:#FF69B4,stroke-width:2px
    classDef config fill:#F5F5F5,stroke:#A9A9A9,stroke-width:2px
```
