# d2bridge/d2bridgeframework architecture

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

- Interactive diagram: https://gitdiagram.com/d2bridge/d2bridgeframework
- Repository: https://github.com/d2bridge/d2bridgeframework

## Overview

D2Bridge turns Delphi/Lazarus applications into web backends by exposing their visual UI to browser users. The documented workflow is to retain the existing application and export its visual layer; the tree shows server-side form, rendering, REST/session, and Prism UI subsystems, while sampled browser code demonstrates server-function requests and callback handling. Beta and Stable contain parallel browser assets. Server-side call relationships are not inferred from filenames: links to those unsampled internals are omitted. The README supports the overall product workflow, but implementation details beyond the sampled JavaScript remain uncertain.

Main entry points: [`Beta/HTML/wwwroot/js/prismserverfunctions.js`](https://github.com/d2bridge/d2bridgeframework/blob/main/Beta/HTML/wwwroot/js/prismserverfunctions.js) (Server function proxy), [`Beta/HTML/wwwroot/js/serverfunctionexecutor.js`](https://github.com/d2bridge/d2bridgeframework/blob/main/Beta/HTML/wwwroot/js/serverfunctionexecutor.js) (HTTP executor), [`Stable/HTML/wwwroot/js/prismserverfunctions.js`](https://github.com/d2bridge/d2bridgeframework/blob/main/Stable/HTML/wwwroot/js/prismserverfunctions.js) (Server function proxy), [`Stable/HTML/wwwroot/js/serverfunctionexecutor.js`](https://github.com/d2bridge/d2bridgeframework/blob/main/Stable/HTML/wwwroot/js/serverfunctionexecutor.js) (HTTP executor)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_application["Web application"]
  node_legacyapp["Existing application"]
  node_formexport["Visual form export"]
  node_server["Web backend"]
end

subgraph group_prism["Prism runtime"]
  node_sessions["User sessions<br/>[Prism.Session.pas]"]
  node_security["Security options"]
end

subgraph group_bridge["D2Bridge framework"]
  node_forms["Form lifecycle<br/>[D2Bridge.Forms.pas]"]
  node_render["HTML rendering"]
  node_items["HTML controls"]
  node_rest["REST server"]
  node_routes["REST routes"]
end

subgraph group_browser["Browser runtime"]
  node_clientbeta["Browser callbacks"]
  node_adminbeta["Server function proxy"]
  node_execbeta["HTTP executor"]
  node_connectionbeta["Connection setup<br/>[connection.js]"]
  node_loaderbeta["Request loader<br/>[d2bridgeloader.js]"]
  node_pagebeta["Page embedding<br/>[prismpage.js]"]
  node_clientstable["Browser callbacks"]
  node_adminstable["Server function proxy"]
  node_execstable["HTTP executor"]
  node_connectionstable["Connection setup<br/>[connection.js]"]
end

node_developer(("Delphi/Lazarus project user"))
node_webuser(("Browser user"))

node_developer -->|"retains"| node_legacyapp
node_legacyapp -->|"exports visuals"| node_formexport
node_formexport -->|"becomes backend"| node_server
node_webuser -.->|"uses web app"| node_server
node_connectionbeta -->|"creates proxy"| node_adminbeta
node_adminbeta -->|"executes methods"| node_execbeta
node_execbeta -->|"sends HTTP"| node_server
node_clientbeta -->|"broadcasts through"| node_adminbeta
node_clientbeta -->|"polls callbacks"| node_execbeta
node_connectionstable -->|"creates proxy"| node_adminstable
node_adminstable -->|"executes methods"| node_execstable
node_execstable -->|"sends HTTP"| node_server
node_clientstable -->|"broadcasts through"| node_adminstable
node_clientstable -->|"polls callbacks"| node_execstable

click node_forms "https://github.com/d2bridge/d2bridgeframework/blob/main/Beta/D2Bridge%20Framework/D2Bridge.Forms.pas"
click node_render "https://github.com/d2bridge/d2bridgeframework/blob/main/Beta/D2Bridge%20Framework/D2Bridge.Render.pas"
click node_items "https://github.com/d2bridge/d2bridgeframework/blob/main/Beta/D2Bridge%20Framework/D2Bridge.Item.HTML.Card.pas"
click node_rest "https://github.com/d2bridge/d2bridgeframework/blob/main/Beta/D2Bridge%20Framework/D2Bridge.Rest.Server.pas"
click node_routes "https://github.com/d2bridge/d2bridgeframework/blob/main/Beta/D2Bridge%20Framework/D2Bridge.Rest.Route.pas"
click node_sessions "https://github.com/d2bridge/d2bridgeframework/blob/main/Beta/D2Bridge%20Framework/Prism/Prism.Session.pas"
click node_security "https://github.com/d2bridge/d2bridgeframework/blob/main/Beta/D2Bridge%20Framework/Prism/Prism.Options.Security.pas"
click node_clientbeta "https://github.com/d2bridge/d2bridgeframework/blob/main/Beta/HTML/wwwroot/js/callbackframework.js"
click node_adminbeta "https://github.com/d2bridge/d2bridgeframework/blob/main/Beta/HTML/wwwroot/js/prismserverfunctions.js"
click node_execbeta "https://github.com/d2bridge/d2bridgeframework/blob/main/Beta/HTML/wwwroot/js/serverfunctionexecutor.js"
click node_connectionbeta "https://github.com/d2bridge/d2bridgeframework/blob/main/Beta/HTML/wwwroot/js/connection.js"
click node_loaderbeta "https://github.com/d2bridge/d2bridgeframework/blob/main/Beta/HTML/wwwroot/js/d2bridgeloader.js"
click node_pagebeta "https://github.com/d2bridge/d2bridgeframework/blob/main/Beta/HTML/Plugin%20PrismPage/prismpage.js"
click node_clientstable "https://github.com/d2bridge/d2bridgeframework/blob/main/Stable/HTML/wwwroot/js/callbackframework.js"
click node_adminstable "https://github.com/d2bridge/d2bridgeframework/blob/main/Stable/HTML/wwwroot/js/prismserverfunctions.js"
click node_execstable "https://github.com/d2bridge/d2bridgeframework/blob/main/Stable/HTML/wwwroot/js/serverfunctionexecutor.js"
click node_connectionstable "https://github.com/d2bridge/d2bridgeframework/blob/main/Stable/HTML/wwwroot/js/connection.js"

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_legacyapp,node_formexport,node_server,node_developer,node_webuser toneBlue
class node_sessions,node_security toneAmber
class node_forms,node_render,node_items,node_rest,node_routes toneMint
class node_clientbeta,node_adminbeta,node_execbeta,node_connectionbeta,node_loaderbeta,node_pagebeta,node_clientstable,node_adminstable,node_execstable,node_connectionstable toneRose
```

## Components

### Web application

- **Existing application**
- **Visual form export**
- **Web backend**

### Prism runtime

- [User sessions](https://github.com/d2bridge/d2bridgeframework/blob/main/Beta/D2Bridge%20Framework/Prism/Prism.Session.pas): `Beta/D2Bridge Framework/Prism/Prism.Session.pas`
- [Security options](https://github.com/d2bridge/d2bridgeframework/blob/main/Beta/D2Bridge%20Framework/Prism/Prism.Options.Security.pas): `Beta/D2Bridge Framework/Prism/Prism.Options.Security.pas`

### D2Bridge framework

- [Form lifecycle](https://github.com/d2bridge/d2bridgeframework/blob/main/Beta/D2Bridge%20Framework/D2Bridge.Forms.pas): `Beta/D2Bridge Framework/D2Bridge.Forms.pas`
- [HTML rendering](https://github.com/d2bridge/d2bridgeframework/blob/main/Beta/D2Bridge%20Framework/D2Bridge.Render.pas): `Beta/D2Bridge Framework/D2Bridge.Render.pas`
- [HTML controls](https://github.com/d2bridge/d2bridgeframework/blob/main/Beta/D2Bridge%20Framework/D2Bridge.Item.HTML.Card.pas): `Beta/D2Bridge Framework/D2Bridge.Item.HTML.Card.pas`
- [REST server](https://github.com/d2bridge/d2bridgeframework/blob/main/Beta/D2Bridge%20Framework/D2Bridge.Rest.Server.pas): `Beta/D2Bridge Framework/D2Bridge.Rest.Server.pas`
- [REST routes](https://github.com/d2bridge/d2bridgeframework/blob/main/Beta/D2Bridge%20Framework/D2Bridge.Rest.Route.pas): `Beta/D2Bridge Framework/D2Bridge.Rest.Route.pas`

### Browser runtime

- [Browser callbacks](https://github.com/d2bridge/d2bridgeframework/blob/main/Beta/HTML/wwwroot/js/callbackframework.js): `Beta/HTML/wwwroot/js/callbackframework.js`
- [Server function proxy](https://github.com/d2bridge/d2bridgeframework/blob/main/Beta/HTML/wwwroot/js/prismserverfunctions.js): `Beta/HTML/wwwroot/js/prismserverfunctions.js`
- [HTTP executor](https://github.com/d2bridge/d2bridgeframework/blob/main/Beta/HTML/wwwroot/js/serverfunctionexecutor.js): `Beta/HTML/wwwroot/js/serverfunctionexecutor.js`
- [Connection setup](https://github.com/d2bridge/d2bridgeframework/blob/main/Beta/HTML/wwwroot/js/connection.js): `Beta/HTML/wwwroot/js/connection.js`
- [Request loader](https://github.com/d2bridge/d2bridgeframework/blob/main/Beta/HTML/wwwroot/js/d2bridgeloader.js): `Beta/HTML/wwwroot/js/d2bridgeloader.js`
- [Page embedding](https://github.com/d2bridge/d2bridgeframework/blob/main/Beta/HTML/Plugin%20PrismPage/prismpage.js): `Beta/HTML/Plugin PrismPage/prismpage.js`
- [Browser callbacks](https://github.com/d2bridge/d2bridgeframework/blob/main/Stable/HTML/wwwroot/js/callbackframework.js): `Stable/HTML/wwwroot/js/callbackframework.js`
- [Server function proxy](https://github.com/d2bridge/d2bridgeframework/blob/main/Stable/HTML/wwwroot/js/prismserverfunctions.js): `Stable/HTML/wwwroot/js/prismserverfunctions.js`
- [HTTP executor](https://github.com/d2bridge/d2bridgeframework/blob/main/Stable/HTML/wwwroot/js/serverfunctionexecutor.js): `Stable/HTML/wwwroot/js/serverfunctionexecutor.js`
- [Connection setup](https://github.com/d2bridge/d2bridgeframework/blob/main/Stable/HTML/wwwroot/js/connection.js): `Stable/HTML/wwwroot/js/connection.js`

### Other components

- **Delphi/Lazarus project user**
- **Browser user**

## Connections

- Delphi/Lazarus project user → Existing application: retains (evidence: `README.md`)
- Existing application → Visual form export: exports visuals (evidence: `README.md`)
- Visual form export → Web backend: becomes backend (evidence: `README.md`)
- Browser user → Web backend: uses web app
- Connection setup → Server function proxy: creates proxy (evidence: `Beta/HTML/wwwroot/js/connection.js`)
- Server function proxy → HTTP executor: executes methods (evidence: `Beta/HTML/wwwroot/js/prismserverfunctions.js`)
- HTTP executor → Web backend: sends HTTP (evidence: `Beta/HTML/wwwroot/js/serverfunctionexecutor.js`)
- Browser callbacks → Server function proxy: broadcasts through (evidence: `Beta/HTML/wwwroot/js/callbackframework.js`)
- Browser callbacks → HTTP executor: polls callbacks (evidence: `Beta/HTML/wwwroot/js/callbackframework.js`)
- Connection setup → Server function proxy: creates proxy (evidence: `Stable/HTML/wwwroot/js/connection.js`)
- Server function proxy → HTTP executor: executes methods (evidence: `Stable/HTML/wwwroot/js/prismserverfunctions.js`)
- HTTP executor → Web backend: sends HTTP (evidence: `Stable/HTML/wwwroot/js/serverfunctionexecutor.js`)
- Browser callbacks → Server function proxy: broadcasts through (evidence: `Stable/HTML/wwwroot/js/callbackframework.js`)
- Browser callbacks → HTTP executor: polls callbacks (evidence: `Stable/HTML/wwwroot/js/callbackframework.js`)
