# jefffreyli/visage architecture

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

- Interactive diagram: https://gitdiagram.com/jefffreyli/visage
- Repository: https://github.com/jefffreyli/visage

## Overview

##### Project type and purpose
- This is a full-stack media-editing web application built on Next.js (uses both the App Router under /app and some pages under /pages).
- The user can sign up/sign in via Firebase Authentication, upload audio/video, manipulate a timeline UI (DND-kit, Framer Motion), and then call serverless API routes to run FFmpeg video/audio processing.

##### File structure
- Top level:
- app/ → Next.js App Router UI for home (app/page.tsx), global layout (app/layout.tsx), dashboard (app/dashboard/*) and auth pages (app/signin, app/signup).
- pages/api/ → Next.js serverless functions: upload, download, merge, export, thumbnail, waveform, dynamic video retrieval.
- components/ → Reusable React components: home page (Hero, Features, CTA, Navbar, Footer), loading screens, media‐library & timeline helpers, animations, utility code (trim algorithm).
- firebase/ → Firebase config + signIn, signUp helper modules.
- public/, styles & config (tailwind.config.ts, postcss.config.js), TypeScript & ESLint configs.
- Key patterns:
- UI layer (React + Tailwind/DaisyUI) separated from backend logic (serverless functions).
- Modular components for media list, timeline blocks, audio/video cards.
- API layer orchestrates storage (Firebase Storage?), database (Firestore?), and FFmpeg processing.

##### README
- Confirms major dependencies: Next.js, Firebase, FFmpeg, DaisyUI (component library), DND-kit (drag/drop), Axios (HTTP), Framer Motion (animation).

##### Detail without over-complicating
- Break the system into these discrete components and flows.
- API route as part of the processing tier.
- How Firebase Auth sits between the client and backend.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Frontend Layer
    subgraph "Frontend Layer"
        direction TB
        HomePage["Home Page"]:::frontend
        Layout["Global Layout"]:::frontend
        DashboardShell["Dashboard Shell"]:::frontend
        DashboardComp["Dashboard.tsx"]:::frontend
        DashboardNavbar["Dashboard Navbar"]:::frontend
        MediaLibrary["Media Library"]:::frontend
        AudioCard["AudioCard"]:::frontend
        AudioDisplay["AudioDisplay"]:::frontend
        VideoCard["VideoCard"]:::frontend
        VideoDisplay["VideoDisplay"]:::frontend
        Details["Details"]:::frontend
        Timeline["Timeline"]:::frontend
        Block["Block"]:::frontend
        HoverLine["Hover Line"]:::frontend
        TimelineData["Timeline Data"]:::frontend
        SignIn["Sign In Page"]:::frontend
        SignUp["Sign Up Page"]:::frontend
        Hero["Hero Component"]:::frontend
        Features["Features Component"]:::frontend
        CTA["CTA Component"]:::frontend
        Navbar["Navbar Component"]:::frontend
        Footer["Footer Component"]:::frontend
        Loading1["LoadingScreen.jsx"]:::frontend
        Loading2["lib LoadingScreen.tsx"]:::frontend
        MediaListWrapper["MediaListWrapper.ts"]:::frontend
        Animations["Animations Helpers"]:::frontend
        TrimAlgo["Trim Algorithm"]:::frontend
        Types1["Shared Types"]:::frontend
        Types2["Dashboard Types"]:::frontend
        GlobalsCSS["Global Styles"]:::frontend
        TailwindConfig["tailwind.config.ts"]:::frontend
        PostCSS["postcss.config.js"]:::frontend
        NextConfig["next.config.js"]:::frontend
    end

    %% Backend Layer
    subgraph "Backend Layer"
        direction TB
        Upload["/api/upload"]:::backend
        Merge["/api/merge"]:::backend
        ExportF["/api/export"]:::backend
        Thumbnail["/api/thumbnail"]:::backend
        Waveform["/api/waveform"]:::backend
        Download["/api/download"]:::backend
        VideoSlug["/api/video/[slug]"]:::backend
        FFmpeg["FFmpeg Binary"]:::external
        FirebaseAuth[(Firebase Auth)]:::storage
        Firestore[(Firestore)]:::storage
        Storage[(Firebase Storage)]:::storage
    end

    %% Data Flows
    HomePage -->|uses| Layout
    Layout -->|navigates to| DashboardShell
    DashboardShell --> DashboardComp
    DashboardComp --> DashboardNavbar
    DashboardComp --> MediaLibrary
    MediaLibrary --> AudioCard
    MediaLibrary --> AudioDisplay
    MediaLibrary --> VideoCard
    MediaLibrary --> VideoDisplay
    MediaLibrary --> Details
    DashboardComp --> Timeline
    Timeline --> Block
    Timeline --> HoverLine
    Timeline --> TimelineData
    HomePage --> Hero
    HomePage --> Features
    HomePage --> CTA
    HomePage --> Navbar
    HomePage --> Footer
    DashboardShell --> SignIn
    DashboardShell --> SignUp

    %% UI to API Calls
    DashboardComp -->|upload raw media| Upload
    DashboardComp -->|merge/export| Merge
    DashboardComp -->|merge/export| ExportF
    DashboardComp -->|get thumbnail| Thumbnail
    DashboardComp -->|get waveform| Waveform
    DashboardComp -->|download processed| Download
    DashboardComp -->|retrieve video| VideoSlug

    %% API to Firebase & FFmpeg
    Upload -->|store raw| Storage
    Merge -->|fetch raw| Storage
    Merge -->|call| FFmpeg
    ExportF -->|call| FFmpeg
    ExportF -->|store processed| Storage
    Thumbnail -->|call| FFmpeg
    Thumbnail -->|store thumbnail| Storage
    Waveform -->|call| FFmpeg
    Waveform -->|store waveform| Storage
    Download -->|generate URL| Storage
    VideoSlug -->|fetch video| Storage

    %% Auth & Database
    HomePage -->|auth SDK| FirebaseAuth
    DashboardComp -->|fetch metadata| Firestore
    Upload -->|validate JWT| FirebaseAuth
    Merge -->|validate JWT| FirebaseAuth
    ExportF -->|validate JWT| FirebaseAuth
    Thumbnail -->|validate JWT| FirebaseAuth
    Waveform -->|validate JWT| FirebaseAuth
    Download -->|validate JWT| FirebaseAuth
    VideoSlug -->|validate JWT| FirebaseAuth

    %% Click Events Frontend
    click HomePage "https://github.com/jefffreyli/visage/blob/main/app/page.tsx"
    click Layout "https://github.com/jefffreyli/visage/blob/main/app/layout.tsx"
    click DashboardShell "https://github.com/jefffreyli/visage/blob/main/app/dashboard/page.tsx"
    click DashboardComp "https://github.com/jefffreyli/visage/blob/main/app/dashboard/Dashboard.tsx"
    click DashboardNavbar "https://github.com/jefffreyli/visage/blob/main/app/dashboard/DashboardNavbar.jsx"
    click MediaLibrary "https://github.com/jefffreyli/visage/blob/main/app/dashboard/media/MediaLibrary.tsx"
    click AudioCard "https://github.com/jefffreyli/visage/blob/main/app/dashboard/media/AudioCard.tsx"
    click AudioDisplay "https://github.com/jefffreyli/visage/blob/main/app/dashboard/media/AudioDisplay.tsx"
    click VideoCard "https://github.com/jefffreyli/visage/blob/main/app/dashboard/media/VideoCard.tsx"
    click VideoDisplay "https://github.com/jefffreyli/visage/blob/main/app/dashboard/media/VideoDisplay.tsx"
    click Details "https://github.com/jefffreyli/visage/blob/main/app/dashboard/media/Details.tsx"
    click Timeline "https://github.com/jefffreyli/visage/blob/main/app/dashboard/timeline/Timeline.jsx"
    click Block "https://github.com/jefffreyli/visage/blob/main/app/dashboard/timeline/Block.jsx"
    click HoverLine "https://github.com/jefffreyli/visage/blob/main/app/dashboard/timeline/HoverLine.jsx"
    click TimelineData "https://github.com/jefffreyli/visage/blob/main/app/dashboard/timeline/data.js"
    click SignIn "https://github.com/jefffreyli/visage/blob/main/app/signin/page.js"
    click SignUp "https://github.com/jefffreyli/visage/blob/main/app/signup/page.js"
    click Hero "https://github.com/jefffreyli/visage/blob/main/components/Home/Hero.tsx"
    click Features "https://github.com/jefffreyli/visage/blob/main/components/Home/Features.jsx"
    click CTA "https://github.com/jefffreyli/visage/blob/main/components/Home/CTA.jsx"
    click Navbar "https://github.com/jefffreyli/visage/blob/main/components/Home/Navbar.tsx"
    click Footer "https://github.com/jefffreyli/visage/blob/main/components/Home/Footer.tsx"
    click Loading1 "https://github.com/jefffreyli/visage/blob/main/components/LoadingScreen.jsx"
    click Loading2 "https://github.com/jefffreyli/visage/blob/main/components/lib/LoadingScreen.tsx"
    click MediaListWrapper "https://github.com/jefffreyli/visage/blob/main/components/lib/MediaListWrapper.ts"
    click Animations "https://github.com/jefffreyli/visage/blob/main/components/animations/animations.js"
    click TrimAlgo "https://github.com/jefffreyli/visage/blob/main/components/formula/trim_algorithm.ts"
    click Types1 "https://github.com/jefffreyli/visage/blob/main/components/types.ts"
    click Types2 "https://github.com/jefffreyli/visage/blob/main/app/dashboard/types.ts"
    click GlobalsCSS "https://github.com/jefffreyli/visage/blob/main/app/globals.css"
    click TailwindConfig "https://github.com/jefffreyli/visage/blob/main/tailwind.config.ts"
    click PostCSS "https://github.com/jefffreyli/visage/blob/main/postcss.config.js"
    click NextConfig "https://github.com/jefffreyli/visage/blob/main/next.config.js"

    %% Click Events Backend
    click Upload "https://github.com/jefffreyli/visage/blob/main/pages/api/upload-ARCHIVE.ts"
    click Merge "https://github.com/jefffreyli/visage/blob/main/pages/api/merge.ts"
    click ExportF "https://github.com/jefffreyli/visage/blob/main/pages/api/export.ts"
    click Thumbnail "https://github.com/jefffreyli/visage/blob/main/pages/api/thumbnail.ts"
    click Waveform "https://github.com/jefffreyli/visage/blob/main/pages/api/waveform.ts"
    click Download "https://github.com/jefffreyli/visage/blob/main/pages/api/download.ts"
    click VideoSlug "https://github.com/jefffreyli/visage/blob/main/pages/api/video/[slug].ts"

    %% Styles
    classDef frontend fill:#E0F7FA,stroke:#0288D1,color:#000
    classDef backend fill:#E8F5E9,stroke:#2E7D32,color:#000
    classDef storage fill:#FFF3E0,stroke:#EF6C00,color:#000
    classDef external fill:#ECEFF1,stroke:#546E7A,color:#000
```
