# kurtiz/file-server-frontend architecture

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

- Interactive diagram: https://gitdiagram.com/kurtiz/file-server-frontend
- Repository: https://github.com/kurtiz/file-server-frontend

## Overview

##### Project type and purpose
- This is a React‑based Single‑Page Application (SPA) built with Vite, TypeScript and Tailwind CSS.
- It serves as the frontend for a file‑server system, handling user sign‑in, sign‑up, OTP verification and displaying a dashboard of uploaded files.

##### File structure
- Top‑level config: vite.config.ts, tsconfig.json/node, postcss.config.js, tailwind.config.js, .eslintrc.cjs. These define build, linting, typing and styling rules.
- Source code (‘src’):
- main.tsx + index.html: App entry point via Vite dev server.
- App.tsx + index.css: root component and global styles.
- pages/: route‑level components (SignIn, SignUp, OtpVerification, Dashboard, Error404, TestPage).
- components/: shared UI and layout pieces: Header, SideBar, ChunkCard, plus a ‘ui/’ subfolder of primitive UI controls (buttons, inputs, badges, toaster, etc.).
- lib/utils.ts and utils/authenticate.ts: helper functions for API calls, token management and authentication.

##### README for insights
- Confirms it’s solely the “frontend” of the File Server project.
- Run via “npm run dev” on localhost:5173 – no backend code here, so it must call external API endpoints.

##### Putting it all together
- Drill down: inside the SPA, show Pages → Components → UI primitives; inside the backend, show Auth vs File vs Data layers.
- Flows: sign‑in, OTP request, file upload, file listing.

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Hosting Environment
    subgraph "Infrastructure"
        direction TB
        DevServer["Vite Dev Server"]:::infra
        CDN["Static CDN / Nginx"]:::infra
    end

    %% Client Side
    subgraph "Browser & SPA"    
        direction TB
        User["User"]:::external
        Browser["Browser"]:::external
        AppBundle["React SPA"]:::frontend

        User -->|"opens"| Browser
        Browser -->|"loads index.html"| DevServer
        DevServer -->|"serves"| Browser
        Browser -->|"runs"| AppBundle
    end

    %% SPA Internal Structure
    subgraph "SPA Structure"    
        direction TB
        subgraph "Entry & Config"
            direction TB
            HTML["index.html"]:::infra
            ViteConfig["vite.config.ts"]:::infra
            TSConfig1["tsconfig.json"]:::infra
            TSConfig2["tsconfig.node.json"]:::infra
            TailwindConfig["tailwind.config.js"]:::infra
            PostCSS["postcss.config.js"]:::infra
            ESLint[".eslintrc.cjs"]:::infra
        end

        subgraph "Bootstrap & Styles"
            direction TB
            Main["main.tsx"]:::frontend
            AppRoot["App.tsx"]:::frontend
            GlobalCSS["index.css"]:::frontend
        end

        subgraph "Pages (Routes)"
            direction TB
            SignIn["SignInPage.tsx"]:::frontend
            SignUp["SignUpPage.tsx"]:::frontend
            OTP["OtpVerificationPage.tsx"]:::frontend
            Dashboard["DashboardPage.tsx"]:::frontend
            Error404["Error404Page.tsx"]:::frontend
            TestPage["TestPage.tsx"]:::frontend
        end

        subgraph "Layout Components"
            direction TB
            Header["Header.tsx"]:::frontend
            SideBar["SideBar.tsx"]:::frontend
            ChunkCard["ChunkCard.tsx"]:::frontend
        end

        subgraph "UI Primitives"
            direction TB
            Avatar["avatar.tsx"]:::frontend
            Badge["badge.tsx"]:::frontend
            Breadcrumb["breadcrumb.tsx"]:::frontend
            Button["button.tsx"]:::frontend
            Card["card.tsx"]:::frontend
            Dropdown["dropdown-menu.tsx"]:::frontend
            Form["form.tsx"]:::frontend
            InputText["input.tsx"]:::frontend
            InputOTP["input-otp.tsx"]:::frontend
            Label["label.tsx"]:::frontend
            Sheet["sheet.tsx"]:::frontend
            Table["table.tsx"]:::frontend
            Tabs["tabs.tsx"]:::frontend
            Toast["toast.tsx"]:::frontend
            ToasterHook["toaster.tsx / use-toast.ts"]:::frontend
            Tooltip["tooltip.tsx"]:::frontend
        end

        subgraph "Utilities"
            direction TB
            Utils["utils.ts"]:::frontend
            AuthUtils["authenticate.ts"]:::frontend
        end
    end

    %% Backend Services
    subgraph "Backend Services"
        direction TB
        APIGW["API Gateway / Reverse Proxy"]:::backend
        AuthService["Authentication API"]:::backend
        FileService["File Server API"]:::backend
        OTPProvider["OTP Provider (SMS/Email)"]:::external
        DB[(Metadata Database)]:::backend
        Storage[(Object Storage)]:::backend
    end

    %% Data Flows
    AppBundle -->|"POST /api/auth/login"| AuthService
    AppBundle -->|"POST /api/auth/signup"| AuthService
    AppBundle -->|"POST /api/auth/otp"| AuthService
    AuthService -->|"sends OTP"| OTPProvider
    AppBundle -->|"GET /api/files/list"| FileService
    AppBundle -->|"POST /api/files/upload"| FileService
    AppBundle -->|"GET /api/files/download"| FileService
    FileService -->|"read/write"| Storage
    AuthService -->|"read/write"| DB
    FileService -->|"read/write"| DB

    %% Connections SPA Structure to Bundle
    Main --> AppRoot
    AppRoot --> SignIn & SignUp & OTP & Dashboard & Error404 & TestPage
    AppRoot --> Header & SideBar
    Dashboard --> ChunkCard
    ChunkCard --> Table & Button
    SignIn & SignUp & OTP --> Form & InputText & InputOTP & Button
    Header --> Avatar & Dropdown
    SideBar --> Breadcrumb & Tabs
    AppRoot --> Toast & ToasterHook

    %% Hosting connections
    DevServer --> HTML
    DevServer --> ViteConfig & TSConfig1 & TSConfig2 & TailwindConfig & PostCSS & ESLint
    HTML --> Main & GlobalCSS

    %% Click Events
    click HTML "https://github.com/kurtiz/file-server-frontend/blob/main//index.html"
    click ViteConfig "https://github.com/kurtiz/file-server-frontend/blob/main//vite.config.ts"
    click TSConfig1 "https://github.com/kurtiz/file-server-frontend/blob/main//tsconfig.json"
    click TSConfig2 "https://github.com/kurtiz/file-server-frontend/blob/main//tsconfig.node.json"
    click TailwindConfig "https://github.com/kurtiz/file-server-frontend/blob/main//tailwind.config.js"
    click PostCSS "https://github.com/kurtiz/file-server-frontend/blob/main//postcss.config.js"
    click ESLint "https://github.com/kurtiz/file-server-frontend/blob/main//.eslintrc.cjs"
    click Main "https://github.com/kurtiz/file-server-frontend/blob/main//src/main.tsx"
    click AppRoot "https://github.com/kurtiz/file-server-frontend/blob/main//src/App.tsx"
    click GlobalCSS "https://github.com/kurtiz/file-server-frontend/blob/main//src/index.css"
    click SignIn "https://github.com/kurtiz/file-server-frontend/blob/main//src/pages/SignInPage.tsx"
    click SignUp "https://github.com/kurtiz/file-server-frontend/blob/main//src/pages/SignUpPage.tsx"
    click OTP "https://github.com/kurtiz/file-server-frontend/blob/main//src/pages/OtpVerificationPage.tsx"
    click Dashboard "https://github.com/kurtiz/file-server-frontend/blob/main//src/pages/DashboardPage.tsx"
    click Error404 "https://github.com/kurtiz/file-server-frontend/blob/main//src/pages/Error404Page.tsx"
    click TestPage "https://github.com/kurtiz/file-server-frontend/blob/main//src/pages/TestPage.tsx"
    click Header "https://github.com/kurtiz/file-server-frontend/blob/main//src/components/Header.tsx"
    click SideBar "https://github.com/kurtiz/file-server-frontend/blob/main//src/components/SideBar.tsx"
    click ChunkCard "https://github.com/kurtiz/file-server-frontend/blob/main//src/components/ChunkCard.tsx"
    click Avatar "https://github.com/kurtiz/file-server-frontend/blob/main//src/components/ui/avatar.tsx"
    click Badge "https://github.com/kurtiz/file-server-frontend/blob/main//src/components/ui/badge.tsx"
    click Breadcrumb "https://github.com/kurtiz/file-server-frontend/blob/main//src/components/ui/breadcrumb.tsx"
    click Button "https://github.com/kurtiz/file-server-frontend/blob/main//src/components/ui/button.tsx"
    click Card "https://github.com/kurtiz/file-server-frontend/blob/main//src/components/ui/card.tsx"
    click Dropdown "https://github.com/kurtiz/file-server-frontend/blob/main//src/components/ui/dropdown-menu.tsx"
    click Form "https://github.com/kurtiz/file-server-frontend/blob/main//src/components/ui/form.tsx"
    click InputText "https://github.com/kurtiz/file-server-frontend/blob/main//src/components/ui/input.tsx"
    click InputOTP "https://github.com/kurtiz/file-server-frontend/blob/main//src/components/ui/input-otp.tsx"
    click Label "https://github.com/kurtiz/file-server-frontend/blob/main//src/components/ui/label.tsx"
    click Sheet "https://github.com/kurtiz/file-server-frontend/blob/main//src/components/ui/sheet.tsx"
    click Table "https://github.com/kurtiz/file-server-frontend/blob/main//src/components/ui/table.tsx"
    click Tabs "https://github.com/kurtiz/file-server-frontend/blob/main//src/components/ui/tabs.tsx"
    click Toast "https://github.com/kurtiz/file-server-frontend/blob/main//src/components/ui/toast.tsx"
    click ToasterHook "https://github.com/kurtiz/file-server-frontend/blob/main//src/components/ui/toaster.tsx"
    click ToasterHook "https://github.com/kurtiz/file-server-frontend/blob/main//src/components/ui/use-toast.ts"
    click Tooltip "https://github.com/kurtiz/file-server-frontend/blob/main//src/components/ui/tooltip.tsx"
    click Utils "https://github.com/kurtiz/file-server-frontend/blob/main//src/lib/utils.ts"
    click AuthUtils "https://github.com/kurtiz/file-server-frontend/blob/main//src/utils/authenticate.ts"

    %% Styles
    classDef frontend fill:#daf0fc,stroke:#1f78b4,color:#1f78b4
    classDef backend fill:#ddf4dd,stroke:#2ca02c,color:#2ca02c
    classDef external fill:#ffe5cc,stroke:#ff7f0e,color:#ff7f0e
    classDef infra fill:#e0e0e0,stroke:#7f7f7f,color:#7f7f7f
```
