# mathworks/matlab-proxy architecture

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

- Interactive diagram: https://gitdiagram.com/mathworks/matlab-proxy
- Repository: https://github.com/mathworks/matlab-proxy

## Overview

MATLAB Proxy launches a local MATLAB session and exposes it through a browser. The main workflow is: start the proxy, configure licensing, launch and monitor MATLAB, then use the browser UI and session controls. A separate manager package starts and tracks multiple proxy processes. The graph preserves documented Linux display support and browser licensing choices; sampled excerpts are partial, so some subsystem links are omitted where call ownership is not visible.

Main entry points: [`matlab_proxy/app.py`](https://github.com/mathworks/matlab-proxy/blob/main/matlab_proxy/app.py) (HTTP server), [`gui/src/components/App/index.jsx`](https://github.com/mathworks/matlab-proxy/blob/main/gui/src/components/App/index.jsx) (Browser application), [`matlab_proxy/app_state.py`](https://github.com/mathworks/matlab-proxy/blob/main/matlab_proxy/app_state.py) (Session lifecycle), [`matlab_proxy/settings.py`](https://github.com/mathworks/matlab-proxy/blob/main/matlab_proxy/settings.py) (Runtime settings)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runtime["Proxy runtime"]
  node_proxy_app["HTTP server<br/>[app.py]"]
  node_app_state["Session lifecycle<br/>[app_state.py]"]
  node_settings["Runtime settings<br/>[settings.py]"]
  node_mw["MATLAB discovery<br/>[mw.py]"]
  node_token_auth["Token authentication<br/>[token_auth.py]"]
  node_download["File downloads<br/>[download.py]"]
  node_http_headers["Custom headers"]
end

subgraph group_browser["Browser interface"]
  node_gui_app["Browser application<br/>[index.jsx]"]
  node_gui_start["UI bootstrap<br/>[main.jsx]"]
  node_gui_actions["UI actions<br/>[index.js]"]
  node_gui_reducers["UI state<br/>[index.js]"]
  node_licensing_ui["License entry<br/>[index.jsx]"]
  node_controls_ui["Session controls<br/>[index.jsx]"]
end

subgraph group_manager["Proxy manager"]
  node_manager_web["Manager web app<br/>[app.py]"]
  node_manager_api["Process orchestration<br/>[api.py]"]
  node_repository[("Process repository<br/>[file_repository.py]")]
  node_server_process["Server process<br/>[server.py]"]
  node_manager_helpers["Manager helpers<br/>[helpers.py]"]
  node_manager_logger["Manager logging<br/>[logger.py]"]
end

subgraph group_platform["Runtime support"]
  node_environment["Environment config"]
  node_validators["Input validation<br/>[validators.py]"]
  node_system["OS utilities<br/>[system.py]"]
  node_xvfb["Virtual display<br/>[xvfb.py]"]
end

node_user(("Browser user"))
node_matlab["MATLAB"]
node_license_service["MathWorks licensing"]

node_user -->|"starts"| node_proxy_app
node_user -->|"opens URL"| node_gui_app
node_proxy_app -->|"configures session"| node_app_state
node_app_state -->|"uses settings"| node_settings
node_app_state -->|"discovers MATLAB"| node_mw
node_app_state -->|"starts display"| node_xvfb
node_settings -->|"reads variables"| node_environment
node_settings -->|"validates config"| node_validators
node_settings -->|"loads headers"| node_http_headers
node_proxy_app -->|"authenticates requests"| node_token_auth
node_proxy_app -->|"transforms downloads"| node_download
node_gui_start -->|"renders"| node_gui_app
node_gui_app -->|"dispatches actions"| node_gui_actions
node_gui_app -->|"renders"| node_licensing_ui
node_gui_app -->|"renders"| node_controls_ui
node_gui_actions -->|"updates state"| node_gui_reducers
node_licensing_ui -.->|"submits credentials"| node_license_service
node_proxy_app -.->|"requests licensing"| node_license_service
node_manager_web -->|"delegates"| node_manager_api
node_manager_api -->|"stores process state"| node_repository
node_repository -->|"loads process records"| node_server_process
node_manager_api -->|"uses helpers"| node_manager_helpers
node_manager_api -->|"launches process"| node_proxy_app
node_manager_web -->|"configures logging"| node_manager_logger

click node_proxy_app "https://github.com/mathworks/matlab-proxy/blob/main/matlab_proxy/app.py"
click node_app_state "https://github.com/mathworks/matlab-proxy/blob/main/matlab_proxy/app_state.py"
click node_settings "https://github.com/mathworks/matlab-proxy/blob/main/matlab_proxy/settings.py"
click node_mw "https://github.com/mathworks/matlab-proxy/blob/main/matlab_proxy/util/mw.py"
click node_token_auth "https://github.com/mathworks/matlab-proxy/blob/main/matlab_proxy/util/mwi/token_auth.py"
click node_download "https://github.com/mathworks/matlab-proxy/blob/main/matlab_proxy/util/mwi/download.py"
click node_http_headers "https://github.com/mathworks/matlab-proxy/blob/main/matlab_proxy/util/mwi/custom_http_headers.py"
click node_environment "https://github.com/mathworks/matlab-proxy/blob/main/matlab_proxy/util/mwi/environment_variables.py"
click node_validators "https://github.com/mathworks/matlab-proxy/blob/main/matlab_proxy/util/mwi/validators.py"
click node_system "https://github.com/mathworks/matlab-proxy/blob/main/matlab_proxy/util/system.py"
click node_xvfb "https://github.com/mathworks/matlab-proxy/blob/main/matlab_proxy/util/xvfb.py"
click node_gui_app "https://github.com/mathworks/matlab-proxy/blob/main/gui/src/components/App/index.jsx"
click node_gui_start "https://github.com/mathworks/matlab-proxy/blob/main/gui/src/main.jsx"
click node_gui_actions "https://github.com/mathworks/matlab-proxy/blob/main/gui/src/actionCreators/index.js"
click node_gui_reducers "https://github.com/mathworks/matlab-proxy/blob/main/gui/src/reducers/index.js"
click node_licensing_ui "https://github.com/mathworks/matlab-proxy/blob/main/gui/src/components/LicensingGatherer/index.jsx"
click node_controls_ui "https://github.com/mathworks/matlab-proxy/blob/main/gui/src/components/Controls/index.jsx"
click node_manager_web "https://github.com/mathworks/matlab-proxy/blob/main/matlab_proxy_manager/web/app.py"
click node_manager_api "https://github.com/mathworks/matlab-proxy/blob/main/matlab_proxy_manager/lib/api.py"
click node_repository "https://github.com/mathworks/matlab-proxy/blob/main/matlab_proxy_manager/storage/file_repository.py"
click node_server_process "https://github.com/mathworks/matlab-proxy/blob/main/matlab_proxy_manager/storage/server.py"
click node_manager_helpers "https://github.com/mathworks/matlab-proxy/blob/main/matlab_proxy_manager/utils/helpers.py"
click node_manager_logger "https://github.com/mathworks/matlab-proxy/blob/main/matlab_proxy_manager/utils/logger.py"

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_proxy_app,node_app_state,node_settings,node_mw,node_token_auth,node_download,node_http_headers,node_user toneBlue
class node_gui_app,node_gui_start,node_gui_actions,node_gui_reducers,node_licensing_ui,node_controls_ui toneAmber
class node_manager_web,node_manager_api,node_repository,node_server_process,node_manager_helpers,node_manager_logger toneMint
class node_environment,node_validators,node_system,node_xvfb toneRose
class node_matlab,node_license_service toneIndigo
```

## Components

### Proxy runtime

- [HTTP server](https://github.com/mathworks/matlab-proxy/blob/main/matlab_proxy/app.py): `matlab_proxy/app.py`
- [Session lifecycle](https://github.com/mathworks/matlab-proxy/blob/main/matlab_proxy/app_state.py): `matlab_proxy/app_state.py`
- [Runtime settings](https://github.com/mathworks/matlab-proxy/blob/main/matlab_proxy/settings.py): `matlab_proxy/settings.py`
- [MATLAB discovery](https://github.com/mathworks/matlab-proxy/blob/main/matlab_proxy/util/mw.py): `matlab_proxy/util/mw.py`
- [Token authentication](https://github.com/mathworks/matlab-proxy/blob/main/matlab_proxy/util/mwi/token_auth.py): `matlab_proxy/util/mwi/token_auth.py`
- [File downloads](https://github.com/mathworks/matlab-proxy/blob/main/matlab_proxy/util/mwi/download.py): `matlab_proxy/util/mwi/download.py`
- [Custom headers](https://github.com/mathworks/matlab-proxy/blob/main/matlab_proxy/util/mwi/custom_http_headers.py): `matlab_proxy/util/mwi/custom_http_headers.py`

### Browser interface

- [Browser application](https://github.com/mathworks/matlab-proxy/blob/main/gui/src/components/App/index.jsx): `gui/src/components/App/index.jsx`
- [UI bootstrap](https://github.com/mathworks/matlab-proxy/blob/main/gui/src/main.jsx): `gui/src/main.jsx`
- [UI actions](https://github.com/mathworks/matlab-proxy/blob/main/gui/src/actionCreators/index.js): `gui/src/actionCreators/index.js`
- [UI state](https://github.com/mathworks/matlab-proxy/blob/main/gui/src/reducers/index.js): `gui/src/reducers/index.js`
- [License entry](https://github.com/mathworks/matlab-proxy/blob/main/gui/src/components/LicensingGatherer/index.jsx): `gui/src/components/LicensingGatherer/index.jsx`
- [Session controls](https://github.com/mathworks/matlab-proxy/blob/main/gui/src/components/Controls/index.jsx): `gui/src/components/Controls/index.jsx`

### Proxy manager

- [Manager web app](https://github.com/mathworks/matlab-proxy/blob/main/matlab_proxy_manager/web/app.py): `matlab_proxy_manager/web/app.py`
- [Process orchestration](https://github.com/mathworks/matlab-proxy/blob/main/matlab_proxy_manager/lib/api.py): `matlab_proxy_manager/lib/api.py`
- [Process repository](https://github.com/mathworks/matlab-proxy/blob/main/matlab_proxy_manager/storage/file_repository.py): `matlab_proxy_manager/storage/file_repository.py`
- [Server process](https://github.com/mathworks/matlab-proxy/blob/main/matlab_proxy_manager/storage/server.py): `matlab_proxy_manager/storage/server.py`
- [Manager helpers](https://github.com/mathworks/matlab-proxy/blob/main/matlab_proxy_manager/utils/helpers.py): `matlab_proxy_manager/utils/helpers.py`
- [Manager logging](https://github.com/mathworks/matlab-proxy/blob/main/matlab_proxy_manager/utils/logger.py): `matlab_proxy_manager/utils/logger.py`

### Runtime support

- [Environment config](https://github.com/mathworks/matlab-proxy/blob/main/matlab_proxy/util/mwi/environment_variables.py): `matlab_proxy/util/mwi/environment_variables.py`
- [Input validation](https://github.com/mathworks/matlab-proxy/blob/main/matlab_proxy/util/mwi/validators.py): `matlab_proxy/util/mwi/validators.py`
- [OS utilities](https://github.com/mathworks/matlab-proxy/blob/main/matlab_proxy/util/system.py): `matlab_proxy/util/system.py`
- [Virtual display](https://github.com/mathworks/matlab-proxy/blob/main/matlab_proxy/util/xvfb.py): `matlab_proxy/util/xvfb.py`

### Other components

- **Browser user**
- **MATLAB**
- **MathWorks licensing**

## Connections

- Browser user → HTTP server: starts
- Browser user → Browser application: opens URL
- HTTP server → Session lifecycle: configures session (evidence: `matlab_proxy/app.py`)
- Session lifecycle → Runtime settings: uses settings (evidence: `matlab_proxy/app_state.py`)
- Session lifecycle → MATLAB discovery: discovers MATLAB (evidence: `matlab_proxy/app_state.py`)
- Session lifecycle → Virtual display: starts display (evidence: `matlab_proxy/app_state.py`)
- Runtime settings → Environment config: reads variables (evidence: `matlab_proxy/settings.py`)
- Runtime settings → Input validation: validates config (evidence: `matlab_proxy/settings.py`)
- Runtime settings → Custom headers: loads headers (evidence: `matlab_proxy/settings.py`)
- HTTP server → Token authentication: authenticates requests (evidence: `matlab_proxy/app.py`)
- HTTP server → File downloads: transforms downloads (evidence: `matlab_proxy/app.py`)
- UI bootstrap → Browser application: renders (evidence: `gui/src/main.jsx`)
- Browser application → UI actions: dispatches actions (evidence: `gui/src/components/App/index.jsx`)
- Browser application → License entry: renders (evidence: `gui/src/components/App/index.jsx`)
- Browser application → Session controls: renders (evidence: `gui/src/components/App/index.jsx`)
- UI actions → UI state: updates state (evidence: `gui/src/reducers/index.js`)
- License entry → MathWorks licensing: submits credentials
- HTTP server → MathWorks licensing: requests licensing
- Manager web app → Process orchestration: delegates (evidence: `matlab_proxy_manager/web/app.py`)
- Process orchestration → Process repository: stores process state (evidence: `matlab_proxy_manager/lib/api.py`)
- Process repository → Server process: loads process records (evidence: `matlab_proxy_manager/storage/file_repository.py`)
- Process orchestration → Manager helpers: uses helpers (evidence: `matlab_proxy_manager/lib/api.py`)
- Process orchestration → HTTP server: launches process (evidence: `matlab_proxy_manager/lib/api.py`)
- Manager web app → Manager logging: configures logging (evidence: `matlab_proxy_manager/web/app.py`)
