# microsoft/mxc architecture

> Architecture diagram of the GitHub repository microsoft/mxc, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-07). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/microsoft/mxc
- Repository: https://github.com/microsoft/mxc

## Overview

MXC is a cross-platform sandboxed code-execution system exposed through Rust, .NET, and Node SDKs. The documented workflow is application request → SDK validation and backend selection → isolated workload; requests carry containment and security policies, and persistent workloads can use a provision/start/execute/stop/deprovision lifecycle. The graph also preserves native FFI, backend-specific lifecycle services, telemetry, and diagnostics. Relationship evidence is limited to the README and the supplied source excerpts/index; unsampled backend wiring is not expanded into guessed calls.

Main entry points: [`src/mxc-sdk/src/backends`](https://github.com/microsoft/mxc/tree/main/src/mxc-sdk/src/backends) (Backend selection), [`src/mxc-sdk`](https://github.com/microsoft/mxc/tree/main/src/mxc-sdk) (Rust SDK), [`sdk/dotnet/Microsoft.Mxc.Sdk/V1/MxcLifecycle.cs`](https://github.com/microsoft/mxc/blob/main/sdk/dotnet/Microsoft.Mxc.Sdk/V1/MxcLifecycle.cs) (.NET lifecycle API), [`src/ffi/mxc_ffi/src/lib.rs`](https://github.com/microsoft/mxc/blob/main/src/ffi/mxc_ffi/src/lib.rs) (Native C ABI)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_sdk["SDK interfaces"]
  node_sdk_rust["Rust SDK"]
  node_sdk_dotnet[".NET lifecycle API<br/>[MxcLifecycle.cs]"]
  node_sdk_node["Node V1 API"]
end

subgraph group_engine["Runtime engine"]
  node_contracts["Versioned contracts"]
  node_request["Request and policy"]
  node_dispatch["Backend selection"]
  node_ffi["Native C ABI<br/>[lib.rs]"]
  node_ffi_stream["Streaming handles<br/>[streaming.rs]"]
  node_ffi_state["State-aware ABI<br/>[state_aware.rs]"]
end

subgraph group_backends["Containment backends"]
  node_process_backend["Process container"]
  node_bubblewrap["Bubblewrap backend"]
  node_isolation["Isolation session<br/>[manager.rs]"]
  node_windows_sandbox["Windows Sandbox"]
  node_wslc["WSLC session manager<br/>[session_manager.rs]"]
  node_daemon["Windows Sandbox daemon<br/>[control_server.rs]"]
end

subgraph group_operations["Operations"]
  node_telemetry["Telemetry and consent"]
  node_diagnostics["Diagnostic console<br/>[main.rs]"]
  node_executor["Standalone executor<br/>[main.rs]"]
end

node_app(("Application"))
node_workload(("Isolated workload"))

node_app -->|"calls SDK"| node_sdk_rust
node_app -->|"calls SDK"| node_sdk_dotnet
node_app -->|"calls SDK"| node_sdk_node
node_sdk_rust -->|"selects backend"| node_dispatch
node_sdk_dotnet -->|"selects backend"| node_dispatch
node_sdk_node -->|"selects backend"| node_dispatch
node_sdk_dotnet -->|"invokes native"| node_ffi
node_contracts -.->|"defines request"| node_request
node_dispatch -.->|"runs workload"| node_process_backend
node_dispatch -.->|"runs workload"| node_bubblewrap
node_dispatch -.->|"runs workload"| node_isolation
node_dispatch -.->|"runs workload"| node_windows_sandbox
node_dispatch -.->|"runs workload"| node_wslc
node_isolation -.->|"hosts process"| node_workload
node_wslc -.->|"runs command"| node_workload
node_ffi -->|"exposes streaming"| node_ffi_stream
node_ffi -->|"exposes lifecycle"| node_ffi_state
node_windows_sandbox -.->|"uses control service"| node_daemon
node_sdk_rust -.->|"applies consent"| node_telemetry
node_executor -->|"launches workload"| node_workload

click node_sdk_rust "https://github.com/microsoft/mxc/tree/main/src/mxc-sdk"
click node_sdk_dotnet "https://github.com/microsoft/mxc/blob/main/sdk/dotnet/Microsoft.Mxc.Sdk/V1/MxcLifecycle.cs"
click node_sdk_node "https://github.com/microsoft/mxc/tree/main/sdk/node/src/v1"
click node_contracts "https://github.com/microsoft/mxc/tree/main/src/mxc-sdk/src/core/mxc_contract"
click node_request "https://github.com/microsoft/mxc/tree/main/src/mxc-sdk/src/core/mxc_common"
click node_dispatch "https://github.com/microsoft/mxc/tree/main/src/mxc-sdk/src/backends"
click node_ffi "https://github.com/microsoft/mxc/blob/main/src/ffi/mxc_ffi/src/lib.rs"
click node_ffi_stream "https://github.com/microsoft/mxc/blob/main/src/ffi/mxc_ffi/src/streaming.rs"
click node_ffi_state "https://github.com/microsoft/mxc/blob/main/src/ffi/mxc_ffi/src/state_aware.rs"
click node_process_backend "https://github.com/microsoft/mxc/tree/main/src/mxc-sdk/src/backends/process_container/common"
click node_bubblewrap "https://github.com/microsoft/mxc/tree/main/src/mxc-sdk/src/backends/bubblewrap/common"
click node_isolation "https://github.com/microsoft/mxc/blob/main/src/mxc-sdk/src/backends/isolation_session/common/manager.rs"
click node_windows_sandbox "https://github.com/microsoft/mxc/tree/main/src/mxc-sdk/src/backends/windows_sandbox/lifecycle"
click node_wslc "https://github.com/microsoft/mxc/blob/main/src/mxc-sdk/src/bin/wslc_daemon/session_manager.rs"
click node_daemon "https://github.com/microsoft/mxc/blob/main/src/mxc-sdk/src/bin/windows_sandbox_daemon/control_server.rs"
click node_telemetry "https://github.com/microsoft/mxc/tree/main/src/mxc-sdk/src/core/mxc_common/telemetry"
click node_diagnostics "https://github.com/microsoft/mxc/blob/main/src/tools/mxc_diagnostic_console/src/main.rs"
click node_executor "https://github.com/microsoft/mxc/blob/main/src/tools/wxc/src/main.rs"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_sdk_rust,node_sdk_dotnet,node_sdk_node toneBlue
class node_contracts,node_request,node_dispatch,node_ffi,node_ffi_stream,node_ffi_state toneAmber
class node_process_backend,node_bubblewrap,node_isolation,node_windows_sandbox,node_wslc,node_daemon toneMint
class node_telemetry,node_diagnostics,node_executor toneRose
class node_app,node_workload toneIndigo
```

## Components

### SDK interfaces

- [Rust SDK](https://github.com/microsoft/mxc/tree/main/src/mxc-sdk): `src/mxc-sdk`
- [.NET lifecycle API](https://github.com/microsoft/mxc/blob/main/sdk/dotnet/Microsoft.Mxc.Sdk/V1/MxcLifecycle.cs): `sdk/dotnet/Microsoft.Mxc.Sdk/V1/MxcLifecycle.cs`
- [Node V1 API](https://github.com/microsoft/mxc/tree/main/sdk/node/src/v1): `sdk/node/src/v1`

### Runtime engine

- [Versioned contracts](https://github.com/microsoft/mxc/tree/main/src/mxc-sdk/src/core/mxc_contract): `src/mxc-sdk/src/core/mxc_contract`
- [Request and policy](https://github.com/microsoft/mxc/tree/main/src/mxc-sdk/src/core/mxc_common): `src/mxc-sdk/src/core/mxc_common`
- [Backend selection](https://github.com/microsoft/mxc/tree/main/src/mxc-sdk/src/backends): `src/mxc-sdk/src/backends`
- [Native C ABI](https://github.com/microsoft/mxc/blob/main/src/ffi/mxc_ffi/src/lib.rs): `src/ffi/mxc_ffi/src/lib.rs`
- [Streaming handles](https://github.com/microsoft/mxc/blob/main/src/ffi/mxc_ffi/src/streaming.rs): `src/ffi/mxc_ffi/src/streaming.rs`
- [State-aware ABI](https://github.com/microsoft/mxc/blob/main/src/ffi/mxc_ffi/src/state_aware.rs): `src/ffi/mxc_ffi/src/state_aware.rs`

### Containment backends

- [Process container](https://github.com/microsoft/mxc/tree/main/src/mxc-sdk/src/backends/process_container/common): `src/mxc-sdk/src/backends/process_container/common`
- [Bubblewrap backend](https://github.com/microsoft/mxc/tree/main/src/mxc-sdk/src/backends/bubblewrap/common): `src/mxc-sdk/src/backends/bubblewrap/common`
- [Isolation session](https://github.com/microsoft/mxc/blob/main/src/mxc-sdk/src/backends/isolation_session/common/manager.rs): `src/mxc-sdk/src/backends/isolation_session/common/manager.rs`
- [Windows Sandbox](https://github.com/microsoft/mxc/tree/main/src/mxc-sdk/src/backends/windows_sandbox/lifecycle): `src/mxc-sdk/src/backends/windows_sandbox/lifecycle`
- [WSLC session manager](https://github.com/microsoft/mxc/blob/main/src/mxc-sdk/src/bin/wslc_daemon/session_manager.rs): `src/mxc-sdk/src/bin/wslc_daemon/session_manager.rs`
- [Windows Sandbox daemon](https://github.com/microsoft/mxc/blob/main/src/mxc-sdk/src/bin/windows_sandbox_daemon/control_server.rs): `src/mxc-sdk/src/bin/windows_sandbox_daemon/control_server.rs`

### Operations

- [Telemetry and consent](https://github.com/microsoft/mxc/tree/main/src/mxc-sdk/src/core/mxc_common/telemetry): `src/mxc-sdk/src/core/mxc_common/telemetry`
- [Diagnostic console](https://github.com/microsoft/mxc/blob/main/src/tools/mxc_diagnostic_console/src/main.rs): `src/tools/mxc_diagnostic_console/src/main.rs`
- [Standalone executor](https://github.com/microsoft/mxc/blob/main/src/tools/wxc/src/main.rs): `src/tools/wxc/src/main.rs`

### Other components

- **Application**
- **Isolated workload**

## Connections

- Application → Rust SDK: calls SDK (evidence: `README.md`)
- Application → .NET lifecycle API: calls SDK (evidence: `README.md`)
- Application → Node V1 API: calls SDK (evidence: `README.md`)
- Rust SDK → Backend selection: selects backend (evidence: `README.md`)
- .NET lifecycle API → Backend selection: selects backend (evidence: `README.md`)
- Node V1 API → Backend selection: selects backend (evidence: `README.md`)
- .NET lifecycle API → Native C ABI: invokes native (evidence: `sdk/dotnet/Microsoft.Mxc.Sdk/V1/MxcLifecycle.cs`)
- Versioned contracts → Request and policy: defines request
- Backend selection → Process container: runs workload
- Backend selection → Bubblewrap backend: runs workload
- Backend selection → Isolation session: runs workload (evidence: `src/mxc-sdk/src/backends/isolation_session/common/manager.rs`)
- Backend selection → Windows Sandbox: runs workload
- Backend selection → WSLC session manager: runs workload
- Isolation session → Isolated workload: hosts process
- WSLC session manager → Isolated workload: runs command
- Native C ABI → Streaming handles: exposes streaming (evidence: `src/ffi/mxc_ffi/src/lib.rs`)
- Native C ABI → State-aware ABI: exposes lifecycle (evidence: `src/ffi/mxc_ffi/src/lib.rs`)
- Windows Sandbox → Windows Sandbox daemon: uses control service
- Rust SDK → Telemetry and consent: applies consent
- Standalone executor → Isolated workload: launches workload (evidence: `README.md`)
