# vcvrack/rack architecture

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

- Interactive diagram: https://gitdiagram.com/vcvrack/rack
- Repository: https://github.com/vcvrack/rack

## Overview

The project you are looking at is VCV Rack—the host application for the VCV virtual Eurorack modular synthesizer platform. In a nutshell, VCV Rack is a full-featured, modular audio synthesizer environment written in C++ with a clean separation between its UI, audio/DSP engine, and plugin system.

##### Main Components
- Host Application Core: Represent the primary Rack application, which ties everything together.
- Audio/DSP Engine: This is the low-level audio processing code found in directories like “src/core”, “include/dsp”, and “src/dsp”. It handles the digital signal processing, filter computation, FFT calculations, resampling, and overall audio routing.
- Plugin and Module Framework: The “include/plugin”, “src/plugin”, and related files indicate support for external or internal modules (both built-in and user-created plugins) that extend the host’s functionality.
- UI Components: A strong, rich user interface is provided via many UI directories (“include/app”, “src/app”, “include/ui”, “src/ui”, and “src/widget”). This layer manages the rendering of knobs, buttons, port widgets, and panels using OpenGL, GLFW, NanoVG, NanoSVG, and other graphics related dependencies.
- Engine/Infrastructure: Beyond audio, there is a management and control layer (“include/engine”, “src/engine”) that links the audio processing and UI events together. This component also interacts with the user’s input (keyboard, MIDI, gamepad) and deals with inter-module routing.
- Build and Infrastructure Tools: Files such as Makefile, compile.mk, arch.mk, and directories like dep and docs indicate that there is a robust build system and documentation pipeline. Represent these as a supporting infrastructure cluster that facilitates compilation, integration of libraries, and overall project setup.

##### Out the Relationships and Interactions
- Platform Abstraction: Illustrate how OS-specific integration (via libraries like GLFW, osdialog) and lower-level audio APIs (RtAudio, RtMidi) clear the boundary between Rack’s abstracted audio module handling and the actual hardware.
- Modular Design: Indicate that each module/plugin can be thought of as a self-contained block that registers with the host via a public plugin API.

##### Architectural Patterns and Design Principles
- Component-Based / Modular Architecture: Emphasize the fact that the entire system is modular. Each plugin or module is self-contained, dynamically added, and interacts via well-defined APIs.
- Layered Architecture: Show distinct layers (UI, Engine, DSP, Plugin wrapper) to make it clear how concerns are separated.
- Event-Driven and Data-Flow Model: Illustrate how user interactions (via the UI) and audio processing events flow through the system, triggering responses in the DSP engine and causing modules to update in real-time.

- Frontend (UI Layer): Emphasize components like “App Widgets”, “Menus”, “Panels”, “OpenGL Rendering” – these parts are essential for visualizing and interacting with the synthesizer.
- Backend (Core Engine/DSP): Highlight the low-level processing units such as the DSP routines, audio processing buffers, and engine management logic.
- API/Plugin Layer: Represent the plugin system that allows third-party modules to seamlessly interface with the Rack host.

## Diagram (Mermaid)

```mermaid
graph TD
    subgraph "UI Layer"
        UI_Components("UI Components"):::ui
    end

    subgraph "Core Services"
        Engine_Infrastructure("Engine/Infrastructure"):::engine
        Plugin_Framework("Plugin and Module Framework"):::plugin
        Audio_DSP_Engine("Audio/DSP Engine"):::dsp
        Host_App_Core("Host Application Core"):::host
    end

    subgraph "Supporting Services"
        External_Dependencies("External Dependencies"):::external
        Build_Infrastructure("Build and Infrastructure Tools"):::build
    end

    %% Interactions
    UI_Components -->|"UserEventDispatch"| Engine_Infrastructure
    Engine_Infrastructure -->|"AudioRouting"| Audio_DSP_Engine
    Engine_Infrastructure -->|"PluginRegistration"| Plugin_Framework
    Plugin_Framework -->|"ModuleIntegration"| Host_App_Core
    Audio_DSP_Engine -->|"AudioProcessing"| Host_App_Core
    UI_Components -->|"UIConfig"| Host_App_Core
    External_Dependencies -->|"RenderAPI"| UI_Components
    External_Dependencies -->|"AudioMIDIAPI"| Audio_DSP_Engine
    Build_Infrastructure -->|"ProjectBuild"| Host_App_Core
    Build_Infrastructure -->|"IntegrationSupport"| External_Dependencies

    %% Click Events for Host Application Core
    click Host_App_Core "https://github.com/vcvrack/rack/blob/v2/Rack.rc"
    click Host_App_Core "https://github.com/vcvrack/rack/blob/v2/include/rack.hpp"
    click Host_App_Core "https://github.com/vcvrack/rack/tree/v2/src/core"

    %% Click Events for Audio/DSP Engine
    click Audio_DSP_Engine "https://github.com/vcvrack/rack/tree/v2/include/dsp"
    click Audio_DSP_Engine "https://github.com/vcvrack/rack/tree/v2/src/dsp"
    click Audio_DSP_Engine "https://github.com/vcvrack/rack/blob/v2/src/core/Audio.cpp"

    %% Click Events for Plugin and Module Framework
    click Plugin_Framework "https://github.com/vcvrack/rack/tree/v2/include/plugin"
    click Plugin_Framework "https://github.com/vcvrack/rack/tree/v2/src/plugin"

    %% Click Events for UI Components
    click UI_Components "https://github.com/vcvrack/rack/tree/v2/include/app"
    click UI_Components "https://github.com/vcvrack/rack/tree/v2/src/app"
    click UI_Components "https://github.com/vcvrack/rack/tree/v2/include/ui"
    click UI_Components "https://github.com/vcvrack/rack/tree/v2/src/ui"
    click UI_Components "https://github.com/vcvrack/rack/tree/v2/include/widget"
    click UI_Components "https://github.com/vcvrack/rack/tree/v2/src/widget"

    %% Click Events for Engine/Infrastructure
    click Engine_Infrastructure "https://github.com/vcvrack/rack/tree/v2/include/engine"
    click Engine_Infrastructure "https://github.com/vcvrack/rack/tree/v2/src/engine"

    %% Click Events for External Dependencies
    click External_Dependencies "https://github.com/vcvrack/rack/tree/v2/dep"

    %% Click Events for Build and Infrastructure Tools
    click Build_Infrastructure "https://github.com/vcvrack/rack/tree/v2/Makefile"
    click Build_Infrastructure "https://github.com/vcvrack/rack/blob/v2/compile.mk"
    click Build_Infrastructure "https://github.com/vcvrack/rack/blob/v2/arch.mk"
    click Build_Infrastructure "https://github.com/vcvrack/rack/blob/v2/dep.mk"
    click Build_Infrastructure "https://github.com/vcvrack/rack/tree/v2/docs"

    %% Styles
    classDef host fill:#ffcc00,stroke:#993300,stroke-width:2px;
    classDef dsp fill:#ccff99,stroke:#336600,stroke-width:2px;
    classDef plugin fill:#99ccff,stroke:#003366,stroke-width:2px;
    classDef ui fill:#ff99cc,stroke:#660033,stroke-width:2px;
    classDef engine fill:#ffff99,stroke:#999900,stroke-width:2px;
    classDef external fill:#cccccc,stroke:#666666,stroke-width:2px;
    classDef build fill:#ffdead,stroke:#cd853f,stroke-width:2px;
```
