# rojo-rbx/rbx-dom architecture

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

- Interactive diagram: https://gitdiagram.com/rojo-rbx/rbx-dom
- Repository: https://github.com/rojo-rbx/rbx-dom

## Overview

##### Main Components

a) Core Types Layer
- Center `rbx_types` as the foundation
- Supported Roblox value types (Vector3, CFrame, etc.)
- Type conversion capabilities

b) DOM Implementation Layer
- `rbx_dom_weak` as the main DOM implementation
- Instance representation
- Property management
- DOM manipulation capabilities

c) Serialization Layer
- `rbx_binary` for .rbxm/.rbxl formats
- `rbx_xml` for .rbxmx/.rbxlx formats
- Bidirectional conversion flows

d) Reflection Layer
- `rbx_reflection` for type information
- `rbx_reflection_database` for bundled data
- `rbx_reflector` for database generation

e) Integration Layer
- `rbx_dom_lua` for Roblox-side implementation
- `rbx_util` for CLI tools

##### Component Relationships

**┌─────────────────────────────────────────────────┐**
- Integration Layer                │
- ┌─────────────┐              ┌────────────┐   │
- rbx_dom_lua │              │  rbx_util  │   │
- ┘              └────────────┘   │
- ┬─────────────────────────┘

**┌───────────────────────▼─────────────────────────┐**
- Serialization Layer                │
- ┌─────────────┐              ┌────────────┐   │
- rbx_binary │◄────────────►│  rbx_xml   │   │
- ┘              └────────────┘   │
- ┬─────────────────────────┘

**┌───────────────────────▼─────────────────────────┐**
- DOM Layer                      │
- ┌─────────────────────────────────────────┐   │
- rbx_dom_weak                 │   │
- ┘   │
- ┬─────────────────────────┘

**┌───────────────────────▼─────────────────────────┐**
- Reflection Layer                   │
- ┌─────────────┐    ┌────────────────────────┐ │
- rbx_reflection│◄──►│rbx_reflection_database │ │
- ┘    └────────────────────────┘ │
- ┬─────────────────────────┘

**┌───────────────────────▼─────────────────────────┐**
- Core Types Layer                 │
- ┌─────────────────────────────────────────┐   │
- rbx_types                  │   │
- ┘   │
- ┘

##### Additional Elements
- Property type coverage matrix (as shown in README)
- External interface points (CLI, Lua API)
- File format support (.rbxm, .rbxl, .rbxmx, .rbxlx)

##### Important Details to Highlight
- Cross-platform nature of the implementation
- Type system compatibility
- Serialization format support
- Reflection capabilities
- Integration points with Roblox

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Styles
    classDef integration fill:#FFE5CC,stroke:#FF9933
    classDef serialization fill:#FFB366,stroke:#FF8000
    classDef dom fill:#B3FFB3,stroke:#33CC33
    classDef reflection fill:#E5CCFF,stroke:#9933FF
    classDef core fill:#CCE5FF,stroke:#3399FF
    classDef default fill:#fff,stroke:#333

    %% Integration Layer
    subgraph Integration
        DomLua["rbx_dom_lua"]
        Util["rbx_util"]
    end

    %% Serialization Layer
    subgraph Serialization
        Binary["rbx_binary"]
        XML["rbx_xml"]
    end

    %% DOM Layer
    subgraph DOM
        DomWeak["rbx_dom_weak"]
    end

    %% Reflection Layer
    subgraph Reflection
        Reflect["rbx_reflection"]
        ReflectDB["rbx_reflection_database"]
        Reflector["rbx_reflector"]
    end

    %% Core Types Layer
    subgraph Core
        Types["rbx_types"]
    end

    %% Relationships
    DomLua --> DomWeak
    Util --> Binary
    Util --> XML
    Binary <--> DomWeak
    XML <--> DomWeak
    DomWeak --> Types
    Reflect <--> ReflectDB
    Reflector --> ReflectDB
    Reflect --> Types

    %% Click Events
    click DomLua "https://github.com/rojo-rbx/rbx-dom/blob/master/rbx_dom_lua/src/init.lua"
    click Util "https://github.com/rojo-rbx/rbx-dom/blob/master/rbx_util/src/main.rs"
    click Binary "https://github.com/rojo-rbx/rbx-dom/blob/master/rbx_binary/src/lib.rs"
    click XML "https://github.com/rojo-rbx/rbx-dom/blob/master/rbx_xml/src/lib.rs"
    click DomWeak "https://github.com/rojo-rbx/rbx-dom/blob/master/rbx_dom_weak/src/lib.rs"
    click Reflect "https://github.com/rojo-rbx/rbx-dom/blob/master/rbx_reflection/src/lib.rs"
    click ReflectDB "https://github.com/rojo-rbx/rbx-dom/blob/master/rbx_reflection_database/src/lib.rs"
    click Reflector "https://github.com/rojo-rbx/rbx-dom/blob/master/rbx_reflector/src/main.rs"
    click Types "https://github.com/rojo-rbx/rbx-dom/blob/master/rbx_types/src/lib.rs"

    %% Style Applications
    class DomLua,Util integration
    class Binary,XML serialization
    class DomWeak dom
    class Reflect,ReflectDB,Reflector reflection
    class Types core

    %% Legend
    subgraph Legend
        L1["Integration Layer"]:::integration
        L2["Serialization Layer"]:::serialization
        L3["DOM Layer"]:::dom
        L4["Reflection Layer"]:::reflection
        L5["Core Types Layer"]:::core
    end
```
