# sirawichdev/shirty-exy architecture

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

- Interactive diagram: https://gitdiagram.com/sirawichdev/shirty-exy
- Repository: https://github.com/sirawichdev/shirty-exy

## Overview

##### Main System Components Identification

A. Core Application Layers:
- Client-Side Application (Next.js)
- 3D Rendering Engine (Three.js)
- State Management (React Context)
- UI Components Layer
- Asset Management

**[Next.js Application Container]**
- Pages/Routes Layer
- Component Layer
- State Management Layer

- [3D Model (GLB)] → [Three.js Engine] → [Canvas Renderer]
- [Context Provider] → [Root Reducer] → [Component State Updates]

##### Specific Implementation Details

A. UI Components (Blue):
- Header
- Button
- Hero Section
- Intro
- Picker

B. 3D Components (Green):
- Shirt Component
- Camera Component
- Backdrop Component

C. State Management (Orange):
- Root Context
- Root Reducer

##### Data Flow Representation

- User interactions → State updates
- State changes → 3D model updates
- Asset loading → Rendering pipeline

##### Technical Integration Points

Crucial integration points:
- Three.js and Next.js integration
- GLB model loading system
- Tailwind CSS styling system

**[Client Browser]**
- ↓
**[Next.js Application]**
- [Pages Router]
- [App Router (src/app)]

- [Component Layer]
- [UI Components]
- [3D Components]

- [State Management]
- [Context Provider]
- [Reducer]

- [Asset Pipeline]
- [GLB Model Loading]

##### Additional Notes

- Client-side nature of the application
- Relationship between Three.js components and the main application
- Testing infrastructure (Jest) as a separate concern
- Build and deployment pipeline (Next.js configuration)

## Diagram (Mermaid)

```mermaid
flowchart TB
    subgraph Client
        Browser["Web Browser"]
    end

    subgraph NextApp["Next.js Application"]
        AppEntry["App Entry"]:::entry
        AppLayout["App Layout"]:::layout

        subgraph Pages["Pages Layer"]
            MainPage["Main Page"]:::page
        end

        subgraph Components["Component Layer"]
            subgraph UI["UI Components"]
                Header["Header"]:::ui
                Button["Button"]:::ui
                subgraph Hero["Hero Section"]
                    HeroIntro["Intro"]:::ui
                    HeroPicker["Picker"]:::ui
                end
            end

            subgraph ThreeD["3D Components"]
                Shirt["Shirt"]:::threejs
                Camera["Camera"]:::threejs
                Backdrop["Backdrop"]:::threejs
            end
        end

        subgraph State["State Management"]
            Context["Root Context"]:::state
            Reducer["Root Reducer"]:::state
        end

        subgraph Assets["Asset Pipeline"]
            GLBModel["3D Model (GLB)"]:::asset
            Styles["Global Styles"]:::styles
            TailwindConfig["Tailwind Config"]:::styles
        end

        subgraph Testing["Testing Infrastructure"]
            JestSetup["Jest Setup"]:::test
            TestFiles["Test Files"]:::test
        end
    end

    Browser --> AppEntry
    AppEntry --> AppLayout
    AppLayout --> MainPage
    MainPage --> UI
    MainPage --> ThreeD
    Context --> Reducer
    Reducer --> UI
    Reducer --> ThreeD
    GLBModel --> ThreeD
    Styles --> UI
    TailwindConfig --> UI

    %% Click Events
    click AppEntry "https://github.com/SirawichDev/shirty-exy/blob/main/src/app/page.tsx"
    click AppLayout "https://github.com/SirawichDev/shirty-exy/blob/main/src/app/layout.tsx"
    click Header "https://github.com/SirawichDev/shirty-exy/blob/main/src/app/components/header.component.tsx"
    click Button "https://github.com/SirawichDev/shirty-exy/blob/main/src/app/components/button.component.tsx"
    click Hero "https://github.com/SirawichDev/shirty-exy/blob/main/src/app/sections/hero/hero.section.tsx"
    click HeroIntro "https://github.com/SirawichDev/shirty-exy/blob/main/src/app/components/hero/intro.component.tsx"
    click HeroPicker "https://github.com/SirawichDev/shirty-exy/blob/main/src/app/components/hero/picker.component.tsx"
    click Shirt "https://github.com/SirawichDev/shirty-exy/blob/main/src/app/components/shirt.component.tsx"
    click Camera "https://github.com/SirawichDev/shirty-exy/blob/main/src/app/components/camera.component.tsx"
    click Backdrop "https://github.com/SirawichDev/shirty-exy/blob/main/src/app/components/backdrop.component.tsx"
    click Context "https://github.com/SirawichDev/shirty-exy/blob/main/src/app/store/root.context.tsx"
    click Reducer "https://github.com/SirawichDev/shirty-exy/blob/main/src/app/store/root.reducer.tsx"
    click GLBModel "https://github.com/SirawichDev/shirty-exy/blob/main/public/shirty.glb"
    click Styles "https://github.com/SirawichDev/shirty-exy/blob/main/src/app/globals.css"
    click TailwindConfig "https://github.com/SirawichDev/shirty-exy/blob/main/tailwind.config.js"
    click JestSetup "https://github.com/SirawichDev/shirty-exy/blob/main/jest.setup.ts"
    click TestFiles "https://github.com/SirawichDev/shirty-exy/blob/main/__tests__/app.test.tsx"

    %% Styling
    classDef entry fill:#f9f,stroke:#333
    classDef layout fill:#faf,stroke:#333
    classDef page fill:#fdf,stroke:#333
    classDef ui fill:#9cf,stroke:#333
    classDef threejs fill:#9f9,stroke:#333
    classDef state fill:#fc9,stroke:#333
    classDef asset fill:#ff9,stroke:#333
    classDef styles fill:#f99,stroke:#333
    classDef test fill:#ccc,stroke:#333

    %% Legend
    subgraph Legend
        L1["Entry Point"]:::entry
        L2["Layout"]:::layout
        L3["Pages"]:::page
        L4["UI Components"]:::ui
        L5["3D Components"]:::threejs
        L6["State Management"]:::state
        L7["Assets"]:::asset
        L8["Styling"]:::styles
        L9["Testing"]:::test
    end
```
