# dwarfthema/vivle-main architecture

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

- Interactive diagram: https://gitdiagram.com/dwarfthema/vivle-main
- Repository: https://github.com/dwarfthema/vivle-main

## Overview

##### Main Components
- App Layer: The “app” directory holds key Next.js files such as layout.tsx (global layout), page.tsx (main page), globals.css (global styling), and a not-found.tsx for 404 scenarios.
- Components: The “components” folder contains various UI components like header.tsx, VideoBackground.tsx, and several content components (under components/contents) as well as motion effects (under components/motions). This indicates a component-driven architecture with potential dynamic content rendering and animation effects.
- Library Code: The “lib” folder, especially lib/client, contains helper functions (e.g., for Google Analytics via gtag.ts and image handling via images.ts), which are utility methods supporting the UI and tracking functionalities.
- Public/Static Assets: The “public” folder stores images, videos, sitemap files, and other static files, reflecting the multimedia and SEO assets needed for the website.
- Configuration and Build Tools: Files like next.config.js, tailwind.config.js, postcss.config.js, and TypeScript configuration (tsconfig.json) reveal that the project uses Next.js with Tailwind CSS, ESLint, and other standard tools in the modern JavaScript ecosystem.

##### Relationships and Data Flows
- The layout defined in app/layout.tsx likely wraps around all page components, integrating global styles (globals.css) and perhaps rendering persistent components like header.tsx.
- The index page (app/page.tsx or components/IndexPage.tsx) likely orchestrates the inclusion of various content components (e.g., content_EBS.tsx, content_Moon.tsx, etc.) and multimedia elements (like VideoBackground.tsx) to deliver a rich, interactive user experience.
- The lib folder’s files are consumed by various components to integrate services such as Google Analytics. For example, lib/client/gtag.ts helps track user interaction and page views.
- The public folder assets (images and videos) are referenced within components to present visual elements, while sitemap configurations (next-sitemap.config.js and sitemap XML files) support SEO.

##### Architectural Patterns and Design Principles
- Component-based design: The system is clearly modular, with a focus on reusable UI components.
- Separation of concerns: The division between application-level files (app/), UI components (components/), utility libraries (lib/), and static content (public/) reflects sound organizational principles.
- Integration of external services: The use of Google Analytics (via components/googleAnalytic.tsx and lib/client/gtag.ts) and sitemap-generation emphasizes real-world integration for analytics and discoverability.
- Modern CSS-in-JS and Tailwind integration: With globals.css and tailwind.config.js, styling and responsive design are integral parts of the approach.

## Diagram (Mermaid)

```mermaid
flowchart TD
    subgraph "App Layer (app folder)"
        A1("Global Layout")
        A2("Main Page")
        A3("Global Styling")
        A4("Error Handling (404)")
    end

    subgraph "Reusable UI Components (components folder)"
        C1("Header")
        C2("Video Background")
        C3("EBS Content")
        C4("Moon Content")
        C5("Modern Room Content")
        C6("NakWha Content")
        C7("Theme Museum Content")
        C8("Home Content")
        C9("Loading Component")
        C10("Pointer Follower (Motion)")
        C11("Google Analytics Component")
        C12("Screen Height Adjustment")
        C13("Index Page Composition")
    end

    subgraph "Service and Utility Layer (lib folder)"
        S1("Google Analytics Utility")
        S2("Image Helper Functions")
    end

    subgraph "Static Asset Layer (public folder)"
        P1("Images & Logos")
        subgraph "Videos"
            P2("EBS Web Video")
            P3("Modern Room Video")
            P4("Moon Rabbit Video")
            P5("Nakhwa Video")
            P6("Theme Museum Video")
        end
        subgraph "SEO Files"
            P7("Robots.txt")
            P8("Sitemap.xml")
            P9("Sitemap-0.xml")
        end
    end

    subgraph "Configuration and Build Tools"
        Conf1("Next.js Config")
        Conf2("Sitemap Config")
        Conf3("Tailwind Config")
        Conf4("PostCSS Config")
        Conf5("TypeScript Config")
        Conf6("Linting Config")
        Conf7("package.json")
        Conf8("package-lock.json")
    end

    %% Relationships
    A1 -->|"wraps"| C1
    A1 -->|"wraps"| A2
    A1 -->|"integrates"| C11
    A2 -->|"composes"| C13
    A2 -->|"adjusts"| C12
    C13 -->|"includes"| C3
    C13 -->|"includes"| C4
    C13 -->|"includes"| C5
    C13 -->|"includes"| C6
    C13 -->|"includes"| C7
    C13 -->|"includes"| C8
    C13 -->|"includes"| C9
    C13 -->|"includes"| C2
    C8  -->|"uses"| S2
    C11 -->|"tracksVia"| S1

    C3 -->|"references"| P2
    C5 -->|"references"| P3
    C4 -->|"references"| P4
    C6 -->|"references"| P5
    C7 -->|"references"| P6

    C13 -->|"displays"| P1

    Conf1 -->|"configures"| A1
    Conf3 -->|"styles"| A3
    Conf2 -->|"generates"| P7
    Conf2 -->|"generates"| P8
    Conf2 -->|"generates"| P9

    %% Click Events for App Layer
    click A1 "https://github.com/dwarfthema/vivle-main/blob/main/app/layout.tsx"
    click A2 "https://github.com/dwarfthema/vivle-main/blob/main/app/page.tsx"
    click A3 "https://github.com/dwarfthema/vivle-main/blob/main/app/globals.css"
    click A4 "https://github.com/dwarfthema/vivle-main/blob/main/app/not-found.tsx"

    %% Click Events for Reusable UI Components
    click C1 "https://github.com/dwarfthema/vivle-main/blob/main/components/header.tsx"
    click C2 "https://github.com/dwarfthema/vivle-main/blob/main/components/VideoBackground.tsx"
    click C3 "https://github.com/dwarfthema/vivle-main/blob/main/components/contents/content_EBS.tsx"
    click C4 "https://github.com/dwarfthema/vivle-main/blob/main/components/contents/content_Moon.tsx"
    click C5 "https://github.com/dwarfthema/vivle-main/blob/main/components/contents/content_MordernRoom.tsx"
    click C6 "https://github.com/dwarfthema/vivle-main/blob/main/components/contents/content_NakWha.tsx"
    click C7 "https://github.com/dwarfthema/vivle-main/blob/main/components/contents/content_ThemeMuseum.tsx"
    click C8 "https://github.com/dwarfthema/vivle-main/blob/main/components/contents/home_1.tsx"
    click C9 "https://github.com/dwarfthema/vivle-main/blob/main/components/contents/loading.tsx"
    click C10 "https://github.com/dwarfthema/vivle-main/blob/main/components/motions/pointerFollower.tsx"
    click C11 "https://github.com/dwarfthema/vivle-main/blob/main/components/googleAnalytic.tsx"
    click C12 "https://github.com/dwarfthema/vivle-main/blob/main/components/setScreenHeight.tsx"
    click C13 "https://github.com/dwarfthema/vivle-main/blob/main/components/IndexPage.tsx"

    %% Click Events for Service and Utility Layer
    click S1 "https://github.com/dwarfthema/vivle-main/blob/main/lib/client/gtag.ts"
    click S2 "https://github.com/dwarfthema/vivle-main/blob/main/lib/client/images.ts"

    %% Click Events for Static Asset Layer
    click P1 "https://github.com/dwarfthema/vivle-main/tree/main/public/images"
    click P2 "https://github.com/dwarfthema/vivle-main/blob/main/public/videos/EBS_Web.mp4"
    click P3 "https://github.com/dwarfthema/vivle-main/blob/main/public/videos/ModernRoom_Web.mp4"
    click P4 "https://github.com/dwarfthema/vivle-main/blob/main/public/videos/MooonRabbit_Web.mp4"
    click P5 "https://github.com/dwarfthema/vivle-main/blob/main/public/videos/Nakhwa_Web.mp4"
    click P6 "https://github.com/dwarfthema/vivle-main/blob/main/public/videos/ThemeMuseum_Web.mp4"
    click P7 "https://github.com/dwarfthema/vivle-main/blob/main/public/robots.txt"
    click P8 "https://github.com/dwarfthema/vivle-main/blob/main/public/sitemap.xml"
    click P9 "https://github.com/dwarfthema/vivle-main/blob/main/public/sitemap-0.xml"

    %% Click Events for Configuration and Build Tools
    click Conf1 "https://github.com/dwarfthema/vivle-main/blob/main/next.config.js"
    click Conf2 "https://github.com/dwarfthema/vivle-main/blob/main/next-sitemap.config.js"
    click Conf3 "https://github.com/dwarfthema/vivle-main/blob/main/tailwind.config.js"
    click Conf4 "https://github.com/dwarfthema/vivle-main/blob/main/postcss.config.js"
    click Conf5 "https://github.com/dwarfthema/vivle-main/blob/main/tsconfig.json"
    click Conf6 "https://github.com/dwarfthema/vivle-main/blob/main/.eslintrc.json"
    click Conf7 "https://github.com/dwarfthema/vivle-main/blob/main/package.json"
    click Conf8 "https://github.com/dwarfthema/vivle-main/blob/main/package-lock.json"

    %% Styling
    classDef appLayer fill:#ffedcc,stroke:#333,stroke-width:2px;
    classDef components fill:#cce5ff,stroke:#333,stroke-width:2px;
    classDef service fill:#d5f5e3,stroke:#333,stroke-width:2px;
    classDef assets fill:#fadbd8,stroke:#333,stroke-width:2px;
    classDef config fill:#e8daef,stroke:#333,stroke-width:2px;

    class A1,A2,A3,A4 appLayer;
    class C1,C2,C3,C4,C5,C6,C7,C8,C9,C10,C11,C12,C13 components;
    class S1,S2 service;
    class P1,P2,P3,P4,P5,P6,P7,P8,P9 assets;
    class Conf1,Conf2,Conf3,Conf4,Conf5,Conf6,Conf7,Conf8 config;
```
