# cadje/radical-canvatorium architecture

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

- Interactive diagram: https://gitdiagram.com/cadje/radical-canvatorium
- Repository: https://github.com/cadje/radical-canvatorium

## Overview

##### Project Type and Purpose
- The project is an experimental design lab for spatial computing. It leverages Nuxt and VueJS for the frontend and integrates BabylonJS to power 3D scenes for both “Labs” (which are intended for VR/AR and spatial computing experiments) and “Benches” (simple 3D concept explorations).
- The README and file layout indicate a focus on immersive 3D environments with distinct experiences (Labs vs. Benches). WebXR support with self-signed certs suggests real-time, interactive VR/AR deployment.

##### Breakdown of the File Structure
- Frontend Framework & Configuration: Key files such as app.vue, nuxt.config.ts, and pages/* directories indicate the use of Nuxt/Vue.
- Views/Pages:
- The “pages/benches” directory holds several components (bench000.vue through bench005.vue, benchTemplate.vue) representing standalone 3D demonstrations not requiring VR/AR.
- The “pages/labs” directory contains many lab components (lab000.vue to lab057.vue, plus index.vue) that are designed to explore concepts in spatial computing and immersive environments.
- The “pages/sidequests” directory suggests additional experimental or auxiliary features.
- Scene and 3D Engine Integration:
- The inclusion of BabylonJS-specific instructions in the README (and installation commands for BabylonJS packages) in conjunction with Vue components indicates that these pages integrate BabylonJS scenes.
- The “composables/useCanvatoriumScene.ts” file likely encapsulates reusable logic for initializing or controlling BabylonJS scenes across various pages.
- Assets and Data:
- The “assets” and “public/assets” directories contain fonts, 3D models (e.g., GLB files), images, and maps which are used for visual styling and 3D content.
- The “data” directory includes JSON files that might feed content or configuration data into the scenes.
- Utility and Helper Scripts:
- The “utils” directory contains helper scripts (like svg-helpers.js, lab-theme.ts) for potentially styling the labs or handling SVG and theme generation.
- Development, Build, and Deployment:
- Configuration files (nuxt.config.ts, tsconfig.json, package.json) and scripts within package.json demonstrate how the project is built, run, and configured for development deployments (including HTTPS for WebXR).

a. Components to Identify:
- Frontend/UI Layer: Represented by Nuxt/Vue files (app.vue, pages, layouts). This is the user’s entry point and contains route-based components for labs and benches.
- 3D Engine Integration: Include a dedicated component (or module) for BabylonJS. Represent the composable (useCanvatoriumScene.ts) that encapsulates scene logic and interactions.
- Data Layer: A node for JSON data from the “data” directory that feeds configuration or assets metadata into the 3D scenes.
- Assets/Resources: Create nodes for assets including fonts, images, maps, and GLB 3D models found in “assets” and “public/assets”.
- Utilities/Helpers: A smaller component to encompass modules in “utils” and “composables” that assist with theming and enhanced functionality.
- External Service Integration: Optionally include the integration with WebXR and the corresponding HTTPS setup to enable VR/AR features (highlighted in the README), as well as any external libraries like BabylonJS.

b. Relationships and Data Flow:
- Link the Data Layer to the UI and 3D Engine to show that JSON configurations or demo setups are fed into the scene logic.
- Assets to both the UI and 3D engine, as visual resources (e.g., fonts, maps, 3D models) are utilized during rendering.
- Configuration and utility modules as supporting services that interact with both the UI and 3D components.

c. Architectural Patterns & Design Principles:
- Separation of concerns where UI rendering (via Nuxt/Vue) is kept separate from the 3D graphics logic (via BabylonJS through composables).
- That the application leverages modular, component-based design, with clearly separated directories for labs, benches, and utilities.
- Use of standard patterns provided by Nuxt such as page-based routing combined with composable functions for reusable logic.

d. Technologies & Frameworks:
- Nuxt and VueJS manage the view layer, with files in “pages”, “layouts”, and app.vue.
- BabylonJS is the engine powering 3D scenes (labs and benches), as installed via npm and referenced in the README.
- Supporting styling and data files from “assets”, “public/assets”, and “data”.
- Tools such as mkcert for HTTPS certificate generation are used to enable secure WebXR development.

## Diagram (Mermaid)

```mermaid
flowchart TD

    subgraph "Frontend/UI Layer"
        UI1("app.vue"):::frontend
        UI2("layouts/default.vue"):::frontend
        subgraph "Pages"
            LAB("Labs (pages/labs)"):::frontend
            BEN("Benches (pages/benches)"):::frontend
            SID("Sidequests (pages/sidequests)"):::frontend
        end
    end

    subgraph "3D Engine Integration"
        ENGINE("BabylonJS Scene Engine"):::engine
    end

    subgraph "Data & Configuration"
        DATA("Data JSON (data/)"):::data
        CONFIG("nuxt.config.ts"):::data
    end

    subgraph "Assets & Resources"
        ASSET("Assets (assets/)"):::assets
        PUBASSET("Public Assets (public/assets/)"):::assets
    end

    subgraph "Utilities & Helpers"
        UTIL("Utilities (utils/)"):::utilities
    end

    subgraph "External Services"
        EXTERNAL("WebXR & HTTPS (mkcert)"):::external
    end

    %% Relationships
    UI1 --> LAB
    UI1 --> BEN
    UI1 --> SID

    LAB -->|"triggers"| ENGINE
    BEN -->|"triggers"| ENGINE
    SID -->|"triggers"| ENGINE

    DATA -->|"feeds"| ENGINE
    CONFIG -->|"feeds"| ENGINE

    ASSET -->|"resources"| ENGINE
    PUBASSET -->|"resources"| ENGINE

    UTIL -->|"supports"| UI1
    UTIL -->|"supports"| ENGINE

    ENGINE -->|"enables"| EXTERNAL

    %% Click Events
    click UI1 "https://github.com/cadje/radical-canvatorium/blob/main-02/app.vue"
    click UI2 "https://github.com/cadje/radical-canvatorium/blob/main-02/layouts/default.vue"
    click LAB "https://github.com/cadje/radical-canvatorium/tree/main-02/pages/labs"
    click BEN "https://github.com/cadje/radical-canvatorium/tree/main-02/pages/benches"
    click SID "https://github.com/cadje/radical-canvatorium/tree/main-02/pages/sidequests"
    click ENGINE "https://github.com/cadje/radical-canvatorium/blob/main-02/composables/useCanvatoriumScene.ts"
    click CONFIG "https://github.com/cadje/radical-canvatorium/blob/main-02/nuxt.config.ts"
    click DATA "https://github.com/cadje/radical-canvatorium/tree/main-02/data/"
    click ASSET "https://github.com/cadje/radical-canvatorium/tree/main-02/assets/"
    click PUBASSET "https://github.com/cadje/radical-canvatorium/tree/main-02/public/assets/"
    click UTIL "https://github.com/cadje/radical-canvatorium/tree/main-02/utils/"

    %% Styles
    classDef frontend fill:#a8d8ea,stroke:#333,stroke-width:2px;
    classDef engine fill:#ffb347,stroke:#333,stroke-width:2px;
    classDef data fill:#c0d6e4,stroke:#333,stroke-width:2px;
    classDef assets fill:#d3f8e2,stroke:#333,stroke-width:2px;
    classDef utilities fill:#ffe5d9,stroke:#333,stroke-width:2px;
    classDef external fill:#f7cac9,stroke:#333,stroke-width:2px;
```
