# rutaganda-salim/fizzy architecture

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

- Interactive diagram: https://gitdiagram.com/rutaganda-salim/fizzy
- Repository: https://github.com/rutaganda-salim/fizzy

## Overview

##### Main System Components

A. Client-Side (Frontend) Layer:
- Next.js 14 Application
- 3D Rendering Engine (Three.js)
- Animation System (Framer Motion)
- Component Library
- State Management

B. Content Management Layer:
- Prismic.io Headless CMS
- Content Types
- Preview System

C. API Layer:
- Next.js API Routes
- Revalidation System
- Preview Controls

**[Client Layer] ←→ [API Layer] ←→ [CMS Layer]**

##### Detailed Component Breakdown

Client Layer (Left Column):
- Pages (src/app directory)
- Components (src/components)
- 3D Elements (FloatingCan, SodaCan, ViewCanvas)
- Slice Components
- Hooks (useStore, useMediaQuery)

API Layer (Middle Column):
- Include:
- Preview API Routes
- Revalidation Endpoints
- Content Type Definitions

CMS Layer (Right Column):
- Show:
- Prismic.io Connection
- Content Models
- Preview Service

##### Important Details

- File structure organization (src/components, src/slices, etc.)
- API routes for preview and revalidation
- Content type definitions and their relationship to components
- 3D asset management (public directory)
- Integration points between Next.js and Prismic

##### Additional Notes

- Preview system workflow
- How static and dynamic content is handled
- Build-time vs. runtime processes
- Points of client-side interactivity

Remember to emphasize the unique aspects of this project:
- The 3D rendering pipeline
- Animation system integration
- Content management workflow
- Preview and revalidation mechanisms

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph Client
        NextApp["Next.js App"]:::frontend
        click NextApp "https://github.com/rutaganda-salim/fizzy/blob/main/src/app/layout.tsx"
        
        subgraph ThreeD["3D System"]
            FloatingCan["Floating Can"]:::threejs
            SodaCan["Soda Can"]:::threejs
            ViewCanvas["View Canvas"]:::threejs
            ThreeAssets["3D Assets"]:::assets
            click FloatingCan "https://github.com/rutaganda-salim/fizzy/blob/main/src/components/FloatingCan.tsx"
            click SodaCan "https://github.com/rutaganda-salim/fizzy/blob/main/src/components/SodaCan.tsx"
            click ViewCanvas "https://github.com/rutaganda-salim/fizzy/blob/main/src/components/ViewCanvas.tsx"
            click ThreeAssets "https://github.com/rutaganda-salim/fizzy/blob/main/public/Soda-can.gltf"
        end

        subgraph Components["Component Library"]
            Bounded["Bounded"]:::component
            Button["Button"]:::component
            Header["Header"]:::component
            Footer["Footer"]:::component
            TextSplitter["Text Splitter"]:::component
            click Bounded "https://github.com/rutaganda-salim/fizzy/blob/main/src/components/Bounded.tsx"
            click Button "https://github.com/rutaganda-salim/fizzy/blob/main/src/components/Button.tsx"
            click Header "https://github.com/rutaganda-salim/fizzy/blob/main/src/components/Header.tsx"
            click Footer "https://github.com/rutaganda-salim/fizzy/blob/main/src/components/Footer.tsx"
            click TextSplitter "https://github.com/rutaganda-salim/fizzy/blob/main/src/components/TextSplitter.tsx"
        end

        subgraph State["State Management"]
            Store["Store Hook"]:::state
            MediaQuery["Media Query Hook"]:::state
            click Store "https://github.com/rutaganda-salim/fizzy/blob/main/src/hooks/useStore.ts"
            click MediaQuery "https://github.com/rutaganda-salim/fizzy/blob/main/src/hooks/useMediaQuery.ts"
        end

        subgraph Slices["Content Slices"]
            Hero["Hero"]:::slice
            AlternatingText["Alternating Text"]:::slice
            BigText["Big Text"]:::slice
            Carousel["Carousel"]:::slice
            SkyDive["Sky Dive"]:::slice
            click Hero "https://github.com/rutaganda-salim/fizzy/tree/main/src/slices/Hero"
            click AlternatingText "https://github.com/rutaganda-salim/fizzy/tree/main/src/slices/AlternatingText"
            click BigText "https://github.com/rutaganda-salim/fizzy/tree/main/src/slices/BigText"
            click Carousel "https://github.com/rutaganda-salim/fizzy/tree/main/src/slices/Carousel"
            click SkyDive "https://github.com/rutaganda-salim/fizzy/tree/main/src/slices/SkyDive"
        end
    end

    subgraph API["API Layer"]
        Preview["Preview API"]:::api
        Revalidate["Revalidation API"]:::api
        ExitPreview["Exit Preview API"]:::api
        click Preview "https://github.com/rutaganda-salim/fizzy/blob/main/src/app/api/preview/route.ts"
        click Revalidate "https://github.com/rutaganda-salim/fizzy/blob/main/src/app/api/revalidate/route.ts"
        click ExitPreview "https://github.com/rutaganda-salim/fizzy/blob/main/src/app/api/exit-preview/route.ts"
    end

    subgraph CMS["CMS Layer"]
        PrismicCore["Prismic Core"]:::cms
        ContentModels["Content Models"]:::cms
        PreviewService["Preview Service"]:::cms
        SliceSimulator["Slice Simulator"]:::cms
        click PrismicCore "https://github.com/rutaganda-salim/fizzy/blob/main/src/prismicio.ts"
        click ContentModels "https://github.com/rutaganda-salim/fizzy/blob/main/customtypes/page/index.json"
        click SliceSimulator "https://github.com/rutaganda-salim/fizzy/blob/main/src/app/slice-simulator/page.tsx"
    end

    %% Connections
    NextApp --> ThreeD
    NextApp --> Components
    NextApp --> State
    NextApp --> Slices

    Slices --> API
    API --> CMS
    
    PreviewService --> Preview
    PreviewService --> ExitPreview
    ContentModels --> Revalidate

    %% Styles
    classDef frontend fill:#2563eb,color:white
    classDef threejs fill:#16a34a,color:white
    classDef component fill:#6366f1,color:white
    classDef state fill:#9333ea,color:white
    classDef slice fill:#c026d3,color:white
    classDef api fill:#ea580c,color:white
    classDef cms fill:#0891b2,color:white
    classDef assets fill:#737373,color:white
```
