# xuemian168/waterfall architecture

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

- Interactive diagram: https://gitdiagram.com/xuemian168/waterfall
- Repository: https://github.com/xuemian168/waterfall

## Overview

##### Project type and purpose
- This is a single-page application (SPA) for showcasing photography (“Waterfall Photography”) with an integrated EXIF watermark generator.
- Built entirely in React + TypeScript, styled with Tailwind CSS, and bundled via Vite. There is no custom backend—everything is served as static assets (HTML, JS, CSS, images).

##### File‐tree analysis
- Top-level:
- public/ – static assets (HTML, images, logos)
- src/ – React application code
- config files: tsconfig.*, tailwind.config.js, postcss.config.js, vite.config.ts, eslint.config.js
- src/ hierarchy:
- main.tsx / index.html – entry points
- components/ – UI components (Navigation, BlurImage, Lightbox, Marker, ThemeView, Footer)
- data.ts – static EXIF‐logo mapping for watermarking
- index.css – global Tailwind styles
- No server code or API folders → purely front‐end.

##### README insights
- Emphasizes three gallery themes, lazy/progressive image loading (blur-to-clear), keyboard navigation, and an EXIF watermark generator supporting various camera brands.

a. Main components
1. Developer Environment
- Node.js, Vite dev server, local code editor
2. Version Control & CI/CD (GitHub/GitLab → build pipeline)
3. Static Hosting & CDN
- Deploy built assets (index.html, JS bundles, CSS, images) to a CDN or static-site host
4. End-User Browser
- Fetches and runs the React SPA
5. React SPA Modules (inside the browser):
- Gallery Module (ThemeView, Marker, BlurImage): renders responsive water- fall layout, handles image loading
- Lightbox Module: full-screen image overlay, keyboard/hover interactions
- EXIF Watermark Generator: reads data.ts, merges camera metadata + logos onto chosen images via Canvas or SVG
- Navigation & Footer: site chrome and routing
6. Data Layer (client side)
- Static JSON in data.ts + image metadata embedded in the bundle
b. Relationships & interactions
- Developer pushes code → CI builds → deploy to CDN → Browser requests index.html → SPA JS/CSS downloaded → SPA renders components →
- Gallery pulls image URLs from public/ & applies lazy load
- Watermark component uses data.ts to render EXIF overlays
- Git → CI/CD
- CI/CD → Hosting/CDN
- Browser ↔ CDN (assets)
- SPA UI ↔ client data layer (data.ts)
c. Architectural patterns & principles
- SPA architecture
- Component-based design (decoupled, reusable React components)
- Progressive/lazy loading for performance
- Static asset deployment (no server processes at runtime)
- Separation of concerns: UI vs. data vs. build
d. Key technologies/frameworks
- React 18, TypeScript, Vite
- Tailwind CSS (utility-first styling) + PostCSS
- Vite dev server & build pipeline
- Static hosting (e.g., Netlify, Vercel, S3+CloudFront)

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Development & Build Pipeline
    subgraph "Development Environment"
        direction TB
        Dev("Developer\n(Node.js, Code Editor)"):::dev
        ViteDev("Vite Dev Server"):::dev
    end
    CI("CI/CD Pipeline\n(GitHub Actions)"):::dev
    Dev -->|"push code"| CI
    ViteDev -->|"local build"| Dev

    %% Deployment & Hosting
    subgraph "Deployment & Hosting"
        direction TB
        CDN("Static Hosting & CDN"):::hosting
    end
    CI -->|"deploy build artefacts"| CDN

    %% Browser & SPA Runtime
    subgraph "End-User Browser" 
        direction TB
        Browser("Browser"):::browser

        subgraph "React SPA" 
            direction TB
            EntryHTML["index.html"]:::static
            MainTSX["main.tsx"]:::component
            Navigation["Navigation Component"]:::component
            Footer["Footer Component"]:::component
            subgraph "Gallery Module"
                direction TB
                ThemeView["ThemeView"]:::component
                Marker["Marker"]:::component
                BlurImage["BlurImage"]:::component
            end
            Lightbox["Lightbox Component"]:::component
            Watermark["EXIF Watermark Generator"]:::component
            DataTS["data.ts (EXIF mappings)"]:::data
            Logos["public/logos"]:::static
            Images["public/images"]:::static
        end

        CDN -->|"HTTP GET assets"| EntryHTML
        EntryHTML -->|"loads JS/CSS"| MainTSX
        MainTSX --> Navigation
        MainTSX --> Footer
        MainTSX --> ThemeView
        MainTSX --> Lightbox
        MainTSX --> Watermark

        ThemeView --> Marker
        ThemeView --> BlurImage
        ThemeView --> Images
        Lightbox --> Images
        Watermark --> DataTS
        Watermark --> Logos
        ThemeView -->|"lazy load"| BlurImage

    end

    %% Click Events
    click EntryHTML "https://github.com/xuemian168/waterfall/blob/main//index.html"
    click MainTSX "https://github.com/xuemian168/waterfall/blob/main/src/main.tsx"
    click Navigation "https://github.com/xuemian168/waterfall/blob/main/src/components/Navigation.tsx"
    click Footer "https://github.com/xuemian168/waterfall/blob/main/src/components/Footer.tsx"
    click ThemeView "https://github.com/xuemian168/waterfall/blob/main/src/components/ThemeView.tsx"
    click Marker "https://github.com/xuemian168/waterfall/blob/main/src/components/Marker.tsx"
    click BlurImage "https://github.com/xuemian168/waterfall/blob/main/src/components/BlurImage.tsx"
    click Lightbox "https://github.com/xuemian168/waterfall/blob/main/src/components/Lightbox.tsx"
    click DataTS "https://github.com/xuemian168/waterfall/blob/main/src/data.ts"
    click Logos "https://github.com/xuemian168/waterfall/tree/main/public/logos"
    click Images "https://github.com/xuemian168/waterfall/tree/main/public/images"
    click CI "https://github.com/xuemian168/waterfall/blob/main/vite.config.ts"
    click CI "https://github.com/xuemian168/waterfall/blob/main/tsconfig.json"
    click CI "https://github.com/xuemian168/waterfall/blob/main/tsconfig.app.json"
    click CI "https://github.com/xuemian168/waterfall/blob/main/tsconfig.node.json"
    click CI "https://github.com/xuemian168/waterfall/blob/main/eslint.config.js"
    click CI "https://github.com/xuemian168/waterfall/blob/main/src/vite-env.d.ts"
    click CI "https://github.com/xuemian168/waterfall/blob/main/tailwind.config.js"
    click CI "https://github.com/xuemian168/waterfall/blob/main/postcss.config.js"
    click CI "https://github.com/xuemian168/waterfall/blob/main/src/index.css"

    %% Styles
    classDef dev fill:#f9f,stroke:#333,stroke-width:2px
    classDef hosting fill:#ff9,stroke:#333,stroke-width:2px
    classDef browser fill:#9ff,stroke:#333,stroke-width:2px
    classDef component fill:#cfc,stroke:#333,stroke-width:2px
    classDef static fill:#ccf,stroke:#333,stroke-width:2px
    classDef data fill:#fcf,stroke:#333,stroke-width:2px
```
