# misterpea/s3-ui architecture

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

- Interactive diagram: https://gitdiagram.com/misterpea/s3-ui
- Repository: https://github.com/misterpea/s3-ui

## Overview

##### Project type and purpose
- This is a full-stack web application (“S3 UI”) providing a user interface for AWS S3 (or a localstack emulator).
- Frontend: React/Redux SPA, SCSS styling, drag-and-drop file uploads.
- Backend: Node/Express proxy layer handling RESTful routes and AWS SDK V3 calls to S3.
- Deployable via Docker-Compose with Nginx reverse proxy, or runnable locally via Webpack dev server and localstack.

##### File structure
- Top level:
- backend/ – Express server, routes.js, S3 helper modules, Dockerfile, .env for S3 credentials and mode.
- frontend/ – React app, components, Redux store (actions, reducers, middleware), SCSS, Webpack config, Dockerfile, nginx.conf.
- docker-compose.yml – orchestrates frontend, backend, localstack, nginx containers.
- nginx/ – custom Nginx config for production.
- shell scripts/ – helpers to clone real S3 into localstack.
- Notice separation of concerns: UI layer (React + Nginx), API layer (Express), Storage layer (AWS S3 or localstack).

##### README for additional insights
- Modes:
- dev: Webpack dev server + localstack CLI (pip/local).
- prod: Docker-Compose, services defined in yml.
- Supported operations: bucket CRUD, folder CRUD, file upload/download/delete, progress tracking, query-string navigation.
- Long-term dev: file previews, email links, nested folder uploads.
- Stack: React, Redux, Axios, Express, @aws-sdk/client-s3, Docker, Nginx, Jest/Enzyme, GCP Compute Engine, localstack.

##### Detail
- In frontend, highlight Redux layers: UI components → actions → middleware → reducers → store.
- Example user flows: bucket creation, file upload (drag-drop), folder navigation via query strings.
- Docker-Compose networking: show the overlay network linking containers by service name.

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Users
    User["User"]:::external

    %% Frontend Layer
    subgraph "Frontend Layer"
        direction TB
        BrowserUI["React SPA"]:::frontend
        ReduxStore["Redux Store"]:::frontend
        SCSS["SCSS Styling"]:::frontend
        subgraph "Redux Flow"
            direction TB
            UIComponents["UI Components"]:::frontend
            Actions["Actions"]:::frontend
            Middleware["Middleware"]:::frontend
            Reducers["Reducers"]:::frontend
            Store["Store"]:::frontend
        end
        subgraph "Frontend Build"
            direction TB
            DevServer["Webpack Dev Server (dev)"]:::infra
            NginxFrontend["Nginx Static Server (prod)"]:::infra
        end
    end

    %% Backend Layer
    subgraph "Backend Layer"
        direction TB
        ExpressAPI["Express API Server"]:::backend
        subgraph "Express Internals"
            direction TB
            Routes["routes.js"]:::backend
            UploadRoutes["uploadRoutes.js"]:::backend
            S3Upload["S3_Upload.js"]:::backend
            S3Top["S3_topLevelMethods.js"]:::backend
            Utilities["utilities.js"]:::backend
            Env[".env Configuration"]:::infra
        end
    end

    %% Infrastructure Layer
    subgraph "Infrastructure"
        direction TB
        DockerCompose["Docker-Compose"]:::infra
        NginxProxy["Nginx Reverse Proxy"]:::infra
        LocalStack["LocalStack S3 Emulator"]:::external
        GCP["GCP Compute Engine"]:::external
    end

    %% Storage Layer
    S3Service["AWS S3 / LocalStack S3"]:::external

    %% Connections
    User -->|"interacts with"| BrowserUI
    BrowserUI -->|"dispatches"| UIComponents
    UIComponents -->|"renders & calls"| Actions
    Actions -->|"passes through"| Middleware
    Middleware -->|"updates"| Reducers
    Reducers -->|"updates"| Store
    Store -->|"provides state to"| BrowserUI
    BrowserUI -->|"HTTP (GET/POST/PUT/DELETE)"| ExpressAPI
    DevServer -->|"serves SPA"| BrowserUI
    NginxFrontend -->|"serves static assets"| BrowserUI
    ExpressAPI -->|"uses routes"| Routes
    Routes -->|"delegates to"| UploadRoutes
    UploadRoutes -->|"calls"| S3Upload
    UploadRoutes -->|"calls"| S3Top
    S3Upload -->|"invokes AWS SDK"| S3Service
    S3Top -->|"invokes AWS SDK"| S3Service
    ExpressAPI -->|"reads env"| Env
    Utilities -->|"used by"| UploadRoutes
    DockerCompose -->|"orchestrates"| DevServer
    DockerCompose -->|"orchestrates"| NginxFrontend
    DockerCompose -->|"orchestrates"| ExpressAPI
    DockerCompose -->|"orchestrates"| LocalStack
    DockerCompose -->|"runs on"| GCP
    S3Service -->|"responds to SDK calls"| ExpressAPI

    %% Click Events
    click BrowserUI "https://github.com/misterpea/s3-ui/tree/main-origin/frontend/src"
    click ReduxStore "https://github.com/misterpea/s3-ui/tree/main-origin/frontend/src/redux"
    click SCSS "https://github.com/misterpea/s3-ui/tree/main-origin/frontend/src/style"
    click DevServer "https://github.com/misterpea/s3-ui/blob/main-origin/frontend/webpack.config.js"
    click NginxFrontend "https://github.com/misterpea/s3-ui/blob/main-origin/frontend/nginx.conf"
    click NginxProxy "https://github.com/misterpea/s3-ui/blob/main-origin/nginx/default.conf"
    click DockerCompose "https://github.com/misterpea/s3-ui/blob/main-origin/docker-compose.yml"
    click FrontendDockerfile "https://github.com/misterpea/s3-ui/tree/main-origin/frontend/Dockerfile"
    click BackendDockerfile "https://github.com/misterpea/s3-ui/tree/main-origin/backend/Dockerfile"
    click ExpressAPI "https://github.com/misterpea/s3-ui/blob/main-origin/backend/server.js"
    click Routes "https://github.com/misterpea/s3-ui/blob/main-origin/backend/routes.js"
    click UploadRoutes "https://github.com/misterpea/s3-ui/blob/main-origin/backend/routes/uploadRoutes.js"
    click S3Upload "https://github.com/misterpea/s3-ui/blob/main-origin/backend/S3_Upload.js"
    click S3Top "https://github.com/misterpea/s3-ui/blob/main-origin/backend/S3_topLevelMethods.js"
    click Env "https://github.com/misterpea/s3-ui/blob/main-origin/backend/.env"
    click Utilities "https://github.com/misterpea/s3-ui/blob/main-origin/backend/utilities.js"
    click CloneS3Docker "https://github.com/misterpea/s3-ui/blob/main-origin/shell scripts/CloneS3ToDocker.sh"
    click CloneS3Localstack "https://github.com/misterpea/s3-ui/blob/main-origin/shell scripts/CloneS3ToLocalstack.sh"
    click SampleTest "https://github.com/misterpea/s3-ui/blob/main-origin/backend/sampleTest.js"
    click UIComponents "https://github.com/misterpea/s3-ui/tree/main-origin/frontend/src/components"
    click FrontendTests "https://github.com/misterpea/s3-ui/tree/main-origin/frontend/tests"

    %% Styles
    classDef frontend fill:#cce5ff,stroke:#0366d6,color:#0366d6
    classDef backend fill:#d4edda,stroke:#28a745,color:#155724
    classDef external fill:#fff3cd,stroke:#856404,color:#856404
    classDef infra fill:#e2e3e5,stroke:#6c757d,color:#343a40
```
