# wass08/r3f-virtual-girlfriend-frontend architecture

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

- Interactive diagram: https://gitdiagram.com/wass08/r3f-virtual-girlfriend-frontend
- Repository: https://github.com/wass08/r3f-virtual-girlfriend-frontend

## Overview

##### Project type and purpose
- This is a single-page web application built with Vite and React (JSX), augmented by React Three Fiber (r3f) for 3D rendering. Its goal is to present a “virtual girlfriend” avatar in a browser: loading 3D models and animations, rendering them in a scene, and handling chat-driven interactions via an external backend.

##### File structure
- Top level:
- index.html – the HTML entry point
- vite.config.js, package.json – build/config files
- postcss.config.js, tailwind.config.js – CSS tooling
- public/
- animations/ (.fbx) – raw animation clips
- models/ (.glb, .fbx) – 3D assets
- src/
- main.jsx, App.jsx – application bootstrap and root component
- components/
– Avatar.jsx – 3D character wrapper
– Experience.jsx – scene setup (lights, camera, renderer)
– UI.jsx – chat input/output interface
- hooks/useChat.jsx – custom hook for communicating with the backend chat API
- index.css – global styles
- There is no backend here; the README links to a separate repository for chat/message handling.

##### Key insights from the README
- The frontend is run via “yarn dev” in this repo.
- All chat logic is abstracted in the useChat hook and powered by the external backend service.
- The tutorial video shows how models and animations are loaded and how chat drives avatar expressions.

## Diagram (Mermaid)

```mermaid
flowchart TB
    subgraph "Development & Build Tools"
        VITE["Vite Dev/Build Environment"]:::infra
        CSS["Tailwind & PostCSS Config"]:::infra
    end

    VITE -->|bundles & serves| BROWSER["Browser Client"]:::infra
    CSS --> BROWSER

    subgraph "React Application (Browser Runtime)"
        direction TB
        Main["main.jsx"]:::frontend
        App["App.jsx"]:::frontend

        subgraph "UI Layer"
            UI["UI Component"]:::frontend
        end

        subgraph "3D Rendering Subsystem"
            Exp["Experience Component"]:::render
            Avatar["Avatar Component"]:::render
        end

        Loader["Asset Loader"]:::assets
        Hook["useChat Hook"]:::frontend
    end

    BROWSER --> Main
    Main --> App
    App --> UI
    App --> Exp
    Exp --> Loader
    Exp --> Avatar
    UI --> Hook

    subgraph "Static Assets"
        Static["Static Asset Server"]:::infra
    end

    Loader --> Static
    Hook -->|HTTP/WebSocket| Backend["External Chat Service"]:::external
    Backend --> Hook
    Hook --> UI
    Hook --> Avatar

    click VITE "https://github.com/wass08/r3f-virtual-girlfriend-frontend/blob/main/vite.config.js"
    click VITE "https://github.com/wass08/r3f-virtual-girlfriend-frontend/blob/main/package.json"
    click CSS "https://github.com/wass08/r3f-virtual-girlfriend-frontend/blob/main/tailwind.config.js"
    click CSS "https://github.com/wass08/r3f-virtual-girlfriend-frontend/blob/main/postcss.config.js"
    click BROWSER "https://github.com/wass08/r3f-virtual-girlfriend-frontend/blob/main/index.html"
    click Main "https://github.com/wass08/r3f-virtual-girlfriend-frontend/blob/main/src/main.jsx"
    click App "https://github.com/wass08/r3f-virtual-girlfriend-frontend/blob/main/src/App.jsx"
    click UI "https://github.com/wass08/r3f-virtual-girlfriend-frontend/blob/main/src/components/UI.jsx"
    click UI "https://github.com/wass08/r3f-virtual-girlfriend-frontend/blob/main/src/index.css"
    click Exp "https://github.com/wass08/r3f-virtual-girlfriend-frontend/blob/main/src/components/Experience.jsx"
    click Avatar "https://github.com/wass08/r3f-virtual-girlfriend-frontend/blob/main/src/components/Avatar.jsx"
    click Hook "https://github.com/wass08/r3f-virtual-girlfriend-frontend/blob/main/src/hooks/useChat.jsx"
    click Loader "https://github.com/wass08/r3f-virtual-girlfriend-frontend/tree/main/public/models/"
    click Loader "https://github.com/wass08/r3f-virtual-girlfriend-frontend/tree/main/public/animations/"
    click Static "https://github.com/wass08/r3f-virtual-girlfriend-frontend/tree/main/public/"

    classDef frontend fill:#cfe2ff,stroke:#1f4e78,stroke-width:1px
    classDef render fill:#d9ead3,stroke:#38761d,stroke-width:1px
    classDef assets fill:#f0f0f0,stroke:#666666,stroke-width:1px
    classDef external fill:#f9cb9c,stroke:#b45f06,stroke-width:1px
    classDef infra fill:#eeeeee,stroke:#888888,stroke-width:1px
```
