# ninjadev/renin architecture

> Architecture diagram of the GitHub repository ninjadev/renin, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2024-12-28). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/ninjadev/renin
- Repository: https://github.com/ninjadev/renin

## Overview

##### Main Components

a) Core Components:
- Rendering Engine (Three.js integration)
- Music System (based on music.ts)
- Scene Management
- Animation System
- Shader Processing

b) UI Components:
- Performance Panel
- Audio Bar
- Timeline Controls
- Settings Management
- Error Handling

c) Build/Development Infrastructure:
- Vite Development Server
- Build System
- CLI Tools

**┌─────────────────────────────────────────────┐**
- UI Layer                   │
- ┤
- Core Engine                   │
- ┤
- Infrastructure Layer              │
- ┘

##### Component Relationships

a) Core Engine Components:
- ReninNode → Rendering Engine
- Sync System → Music System
- Scene Management → ReninNode
- Shader Processing ↔ Rendering Engine

b) UI Layer Connections:
- AudioBar → Music System
- Performance Panel → Rendering Engine
- Timeline Controls → Sync System
- Settings Storage → UI Components

c) Infrastructure Connections:
- Vite Dev Server → All Layers
- CLI Tools → Project Setup
- Build System → Production Output

##### Important Details

Annotations for:
- File types supported (.glsl, .ogg)
- Development vs. Production flows
- Hot-reload paths
- Asset processing pipeline

Create distinct sections for:
- Development Environment
- Runtime Environment
- Build/Export Pipeline
- Debug Tools

This system design should reflect Renin's nature as a specialized demo creation tool while highlighting its modern architecture and developer-friendly features.

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph UI
        PerfPanel["Performance Panel"]
        AudioBar["Audio Bar"]
        Timeline["Timeline Controls"]
        Settings["Settings Management"]
        ErrorHandler["Error Handling"]
        UIBase["UI Components Base"]
    end

    subgraph Core
        RenderEngine["Rendering Engine"]
        MusicSystem["Music System"]
        SceneManage["Scene Management"]
        AnimSystem["Animation System"]
        ShaderProc["Shader Processing"]
        ReninNode["ReninNode"]
        SyncSystem["Sync System"]
    end

    subgraph Infrastructure
        ViteServer["Vite Dev Server"]
        BuildSys["Build System"]
        CLITools["CLI Tools"]
    end

    %% Core relationships
    ReninNode --> RenderEngine
    SyncSystem --> MusicSystem
    SceneManage --> ReninNode
    ShaderProc <--> RenderEngine

    %% UI to Core relationships
    AudioBar --> MusicSystem
    PerfPanel --> RenderEngine
    Timeline --> SyncSystem
    Settings --> UIBase

    %% Infrastructure connections
    ViteServer --> UI
    ViteServer --> Core
    CLITools --> BuildSys
    BuildSys --> Core

    %% Click events for component mapping
    click RenderEngine "https://github.com/ninjadev/renin/blob/main/renin/src/render.ts"
    click MusicSystem "https://github.com/ninjadev/renin/blob/main/renin/src/music.ts"
    click SceneManage "https://github.com/ninjadev/renin/blob/main/renin/src/renin.ts"
    click AnimSystem "https://github.com/ninjadev/renin/blob/main/renin/src/ui/UIAnimation.ts"
    click ShaderProc "https://github.com/ninjadev/renin/blob/main/renin/src/default.vert.glsl"
    click PerfPanel "https://github.com/ninjadev/renin/blob/main/renin/src/ui/performancePanel.glsl"
    click AudioBar "https://github.com/ninjadev/renin/blob/main/renin/src/ui/AudioBar.ts"
    click Settings "https://github.com/ninjadev/renin/blob/main/renin/src/ui/storedSettings.ts"
    click ErrorHandler "https://github.com/ninjadev/renin/blob/main/renin/src/ui/error.ts"
    click ViteServer "https://github.com/ninjadev/renin/blob/main/renin/src/ui/vite.ts"
    click BuildSys "https://github.com/ninjadev/renin/blob/main/renin/rollup.config.ts"
    click CLITools "https://github.com/ninjadev/renin/tree/main/renin/cli"
    click UIBase "https://github.com/ninjadev/renin/blob/main/renin/src/ui/UIBox.ts"

    %% Styling
    classDef core fill:#blue,color:#fff
    classDef audio fill:#green,color:#fff
    classDef ui fill:#purple,color:#fff
    classDef infra fill:#orange,color:#fff

    class RenderEngine,ReninNode,SceneManage,AnimSystem,ShaderProc core
    class MusicSystem,SyncSystem audio
    class PerfPanel,AudioBar,Timeline,Settings,ErrorHandler,UIBase ui
    class ViteServer,BuildSys,CLITools infra
```
