# atothey/fileflex architecture

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

- Interactive diagram: https://gitdiagram.com/atothey/fileflex
- Repository: https://github.com/atothey/fileflex

## Overview

##### Project type and purpose
- This is a Next.js-based web application whose primary function is in-browser file handling and conversion (using ffmpeg.wasm). It combines server-side rendering (SSR) for initial page loads with a client-heavy React component library for the interactive UI. It’s containerized via Docker and orchestrated (locally) via docker-compose.

##### File structure
- Top-level configuration:
- .eslintrc.json, tsconfig.json, next.config.js, tailwind.config.js(.ts), postcss.config.js, Dockerfile, docker-compose.yml
- App entrypoint (Next.js “app” directory):
- app/layout.tsx, app/page.tsx, app/globals.css
- Shared UI components (components/ & components/ui/):
- Dropzone, Navbar, ModeToggle, ThemeProvider, plus building-block UI (button, select, tabs, toast, skeleton, badge, sheet)
- Utilities (utils/ & utils.ts):
- Localization (locales/):
- ar.json, en.json, fr.json
- Public assets (public/images)
- Build metadata (package.json, components.json)

##### README
- No content in README.md; rely on file structure and naming conventions to infer architectural intent.

##### Elements
- Sub-blocks inside each: under Browser: React components, i18n, wasm engine; under Server: Next.js routing, static asset host
- Browser → Server (HTTP fetch)
- Browser → Wasm Module (load/execution)
- Blue for client components
- Green for server-side components
- Grey for infrastructure (Docker)
- Purple for external libs (ffmpeg.wasm)

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Browser Layer
    subgraph "Browser Client" 
        direction TB
        Layout["app/layout.tsx"]:::frontend
        Page["app/page.tsx"]:::frontend
        GlobalsCSS["app/globals.css"]:::frontend

        subgraph "UI Components"
            direction TB
            Dropzone["Dropzone"]:::frontend
            Navbar["Navbar"]:::frontend
            ModeToggle["ModeToggle"]:::frontend
            ThemeProvider["ThemeProvider"]:::frontend

            subgraph "Building-block UI"
                direction TB
                Badge["badge.tsx"]:::frontend
                Button["button.tsx"]:::frontend
                Select["select.tsx"]:::frontend
                Sheet["sheet.tsx"]:::frontend
                Skeleton["skeleton.tsx"]:::frontend
                Tabs["tabs.tsx"]:::frontend
                Toast["toast.tsx"]:::frontend
                Toaster["toaster.tsx"]:::frontend
                UseToast["use-toast.ts"]:::frontend
            end
        end

        subgraph "Localization"
            direction TB
            AR["locales/ar.json"]:::i18n
            EN["locales/en.json"]:::i18n
            FR["locales/fr.json"]:::i18n
        end

        subgraph "WASM Engine & Utilities"
            direction TB
            LoadFFmpeg["utils/load-ffmpeg.ts"]:::wasm
            ConvertUtil["utils/convert.ts"]:::wasm
            FileIcon["utils/file-to-icon.tsx"]:::wasm
            BytesSize["utils/bytes-to-size.ts"]:::wasm
            CompressName["utils/compress-file-name.ts"]:::wasm
        end
    end

    %% Server Layer
    subgraph "Next.js Server" 
        direction TB
        NextConfig["next.config.js"]:::server
        PackageJSON["package.json"]:::server
        TSConfig["tsconfig.json"]:::server
        PostCSS["postcss.config.js"]:::server
        TailwindConfig["tailwind.config.js/ts"]:::server
        ESLint[".eslintrc.json"]:::server
    end

    %% Public Assets
    PublicImages["public/images"]:::infra

    %% Containerization
    subgraph "Container & Orchestration"
        direction TB
        Dockerfile["Dockerfile"]:::infra
        DockerCompose["docker-compose.yml"]:::infra
        ComponentsJSON["components.json"]:::infra
        GitIgnore[".gitignore"]:::infra
        Readme["README.md"]:::infra
        TypesDef["types.d.ts"]:::infra
    end

    %% Relationships
    BrowserClients((Browser Client))
    BrowserClients -->|"HTTP(S) requests"| NextConfig
    NextConfig -->|serves static assets| PublicImages
    Dropzone -->|"selects file"| LoadFFmpeg
    LoadFFmpeg -->|"loads ffmpeg.wasm"| ConvertUtil
    ConvertUtil -->|"produces output"| FileIcon
    ConvertUtil -->|"calculates size"| BytesSize
    ConvertUtil -->|"compresses name"| CompressName

    NextConfig -.->|runs in| Dockerfile
    DockerCompose -->|orchestrates| Dockerfile

    %% Styling
    classDef frontend fill:#cce4ff,stroke:#1f78b4,color:#0b3d91
    classDef server fill:#d4f7d4,stroke:#2ca02c,color:#1b5e20
    classDef infra fill:#eeeeee,stroke:#777777,color:#333333
    classDef wasm fill:#f3e6ff,stroke:#9467bd,color:#5e2670
    classDef i18n fill:#fff2cc,stroke:#d4ac0d,color:#7a4a00

    %% Click Events
    click Layout "https://github.com/atothey/fileflex/blob/main/app/layout.tsx"
    click Page "https://github.com/atothey/fileflex/blob/main/app/page.tsx"
    click GlobalsCSS "https://github.com/atothey/fileflex/blob/main/app/globals.css"
    click Dropzone "https://github.com/atothey/fileflex/blob/main/components/dropzone.tsx"
    click Navbar "https://github.com/atothey/fileflex/blob/main/components/navbar.tsx"
    click ModeToggle "https://github.com/atothey/fileflex/blob/main/components/mode-toggle.tsx"
    click ThemeProvider "https://github.com/atothey/fileflex/blob/main/components/theme-provider.tsx"
    click Badge "https://github.com/atothey/fileflex/blob/main/components/ui/badge.tsx"
    click Button "https://github.com/atothey/fileflex/blob/main/components/ui/button.tsx"
    click Select "https://github.com/atothey/fileflex/blob/main/components/ui/select.tsx"
    click Sheet "https://github.com/atothey/fileflex/blob/main/components/ui/sheet.tsx"
    click Skeleton "https://github.com/atothey/fileflex/blob/main/components/ui/skeleton.tsx"
    click Tabs "https://github.com/atothey/fileflex/blob/main/components/ui/tabs.tsx"
    click Toast "https://github.com/atothey/fileflex/blob/main/components/ui/toast.tsx"
    click Toaster "https://github.com/atothey/fileflex/blob/main/components/ui/toaster.tsx"
    click UseToast "https://github.com/atothey/fileflex/blob/main/components/ui/use-toast.ts"
    click AR "https://github.com/atothey/fileflex/blob/main/locales/ar.json"
    click EN "https://github.com/atothey/fileflex/blob/main/locales/en.json"
    click FR "https://github.com/atothey/fileflex/blob/main/locales/fr.json"
    click LoadFFmpeg "https://github.com/atothey/fileflex/blob/main/utils/load-ffmpeg.ts"
    click ConvertUtil "https://github.com/atothey/fileflex/blob/main/utils/convert.ts"
    click FileIcon "https://github.com/atothey/fileflex/blob/main/utils/file-to-icon.tsx"
    click BytesSize "https://github.com/atothey/fileflex/blob/main/utils/bytes-to-size.ts"
    click CompressName "https://github.com/atothey/fileflex/blob/main/utils/compress-file-name.ts"
    click NextConfig "https://github.com/atothey/fileflex/blob/main/next.config.js"
    click PackageJSON "https://github.com/atothey/fileflex/blob/main/package.json"
    click TSConfig "https://github.com/atothey/fileflex/blob/main/tsconfig.json"
    click PostCSS "https://github.com/atothey/fileflex/blob/main/postcss.config.js"
    click TailwindConfig "https://github.com/atothey/fileflex/blob/main/tailwind.config.js"
    click ESLint "https://github.com/atothey/fileflex/blob/main/.eslintrc.json"
    click PublicImages "https://github.com/atothey/fileflex/tree/main/public/images"
    click Dockerfile "https://github.com/atothey/fileflex/tree/main/Dockerfile"
    click DockerCompose "https://github.com/atothey/fileflex/blob/main/docker-compose.yml"
    click ComponentsJSON "https://github.com/atothey/fileflex/blob/main/components.json"
    click GitIgnore "https://github.com/atothey/fileflex/blob/main/.gitignore"
    click Readme "https://github.com/atothey/fileflex/blob/main/README.md"
    click TypesDef "https://github.com/atothey/fileflex/blob/main/types.d.ts"
```
