# lc-jhony/stratum architecture

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

- Interactive diagram: https://gitdiagram.com/lc-jhony/stratum
- Repository: https://github.com/lc-jhony/stratum

## Overview

Stratum is an Electron database IDE. The user configures a data source, explores its schema, runs and edits SQL-backed data, and views or exports results and ER diagrams; settings and VS Code themes personalize the workbench. The graph preserves the documented completion, grid, editing, export, diagram, database-driver, and theme capabilities. Edges are limited to relationships evidenced by excerpts, the source index, or README; some unsampled UI-to-main-process actions are therefore omitted.

Main entry points: [`src/renderer/src/App.tsx`](https://github.com/lc-jhony/stratum/blob/main/src/renderer/src/App.tsx) (Workbench shell), [`src/renderer/src/workbench/ConsoleEditor.tsx`](https://github.com/lc-jhony/stratum/blob/main/src/renderer/src/workbench/ConsoleEditor.tsx) (SQL console), [`src/main/services/connectionManager.ts`](https://github.com/lc-jhony/stratum/blob/main/src/main/services/connectionManager.ts) (Connection manager), [`src/main/ipc.ts`](https://github.com/lc-jhony/stratum/blob/main/src/main/ipc.ts) (IPC handlers)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_workbench["Workbench"]
  node_app["Workbench shell<br/>[App.tsx]"]
  node_explorer["Database Explorer<br/>[Explorer.tsx]"]
  node_datasource["Data source setup"]
  node_diagramview["ER diagram view<br/>[ErdView.tsx]"]
  node_diagramlayout["Diagram layout<br/>[erd.ts]"]
  node_state["Workbench state<br/>[workbench.ts]"]
end

subgraph group_sql["SQL and results"]
  node_console["SQL console<br/>[ConsoleEditor.tsx]"]
  node_completion["SQL completion<br/>[sqlComplete.ts]"]
  node_params["Query parameters<br/>[sqlParams.ts]"]
  node_results["Results grid<br/>[DataGrid.tsx]"]
  node_tableeditor["Table data editor<br/>[TableEditor.tsx]"]
  node_export["Data export<br/>[export.ts]"]
end

subgraph group_database["Database access"]
  node_manager["Connection manager"]
  node_session["Database session<br/>[session.ts]"]
  node_dialects["Dialect introspection<br/>[dialects.ts]"]
  node_factory["Driver selection<br/>[factory.ts]"]
  node_transports["Database transports"]
  node_connections[("Connection store<br/>[store.ts]")]
  node_jdbc["JDBC sidecar<br/>[jdbcSidecar.ts]"]
end

subgraph group_platform["Electron platform"]
  node_preload["Preload bridge<br/>[index.ts]"]
  node_ipc["IPC handlers<br/>[ipc.ts]"]
end

subgraph group_appearance["Themes and settings"]
  node_settings["Settings storage<br/>[settings.ts]"]
  node_themeservice["Theme service<br/>[themeService.ts]"]
  node_thememanager["Theme manager<br/>[themeManager.ts]"]
  node_themeassets["Theme rendering<br/>[colorTheme.ts]"]
  node_icon["Themed icons<br/>[Icon.tsx]"]
end

node_user(("Database user"))

node_user -->|"uses"| node_app
node_app -->|"renders"| node_explorer
node_app -->|"renders"| node_console
node_app -->|"renders"| node_tableeditor
node_app -->|"renders"| node_diagramview
node_app -->|"loads"| node_state
node_user -->|"configures"| node_datasource
node_console -->|"suggests"| node_completion
node_console -.->|"prompts"| node_params
node_console -.->|"shows results"| node_results
node_tableeditor -.->|"exports"| node_export
node_diagramview -->|"lays out"| node_diagramlayout
node_explorer -->|"reads state"| node_state
node_state -->|"invokes API"| node_preload
node_preload -->|"forwards IPC"| node_ipc
node_ipc -->|"dispatches"| node_manager
node_ipc -->|"reads and writes"| node_connections
node_manager -->|"loads config"| node_connections
node_manager -->|"creates session"| node_factory
node_factory -->|"selects driver"| node_transports
node_factory -->|"uses JDBC"| node_jdbc
node_manager -->|"opens session"| node_session
node_session -->|"introspects"| node_dialects
node_session -->|"queries"| node_transports
node_thememanager -.->|"lists themes"| node_themeservice
node_thememanager -->|"applies theme"| node_themeassets
node_icon -->|"observes theme"| node_thememanager
node_icon -->|"resolves icons"| node_themeassets
node_thememanager -->|"loads preferences"| node_settings
node_ipc -.->|"serves theme API"| node_themeservice
node_state -->|"merges preferences"| node_settings

click node_app "https://github.com/lc-jhony/stratum/blob/main/src/renderer/src/App.tsx"
click node_explorer "https://github.com/lc-jhony/stratum/blob/main/src/renderer/src/workbench/Explorer.tsx"
click node_datasource "https://github.com/lc-jhony/stratum/blob/main/src/renderer/src/workbench/DatasourceDialog.tsx"
click node_console "https://github.com/lc-jhony/stratum/blob/main/src/renderer/src/workbench/ConsoleEditor.tsx"
click node_completion "https://github.com/lc-jhony/stratum/blob/main/src/shared/sqlComplete.ts"
click node_params "https://github.com/lc-jhony/stratum/blob/main/src/shared/sqlParams.ts"
click node_results "https://github.com/lc-jhony/stratum/blob/main/src/renderer/src/workbench/DataGrid.tsx"
click node_tableeditor "https://github.com/lc-jhony/stratum/blob/main/src/renderer/src/workbench/TableEditor.tsx"
click node_export "https://github.com/lc-jhony/stratum/blob/main/src/shared/export.ts"
click node_diagramview "https://github.com/lc-jhony/stratum/blob/main/src/renderer/src/workbench/ErdView.tsx"
click node_diagramlayout "https://github.com/lc-jhony/stratum/blob/main/src/renderer/src/erd/erd.ts"
click node_state "https://github.com/lc-jhony/stratum/blob/main/src/renderer/src/store/workbench.ts"
click node_preload "https://github.com/lc-jhony/stratum/blob/main/src/preload/index.ts"
click node_ipc "https://github.com/lc-jhony/stratum/blob/main/src/main/ipc.ts"
click node_manager "https://github.com/lc-jhony/stratum/blob/main/src/main/services/connectionManager.ts"
click node_session "https://github.com/lc-jhony/stratum/blob/main/src/main/db/session.ts"
click node_dialects "https://github.com/lc-jhony/stratum/blob/main/src/main/db/dialects.ts"
click node_factory "https://github.com/lc-jhony/stratum/blob/main/src/main/db/factory.ts"
click node_transports "https://github.com/lc-jhony/stratum/tree/main/src/main/db/transports"
click node_connections "https://github.com/lc-jhony/stratum/blob/main/src/main/services/store.ts"
click node_jdbc "https://github.com/lc-jhony/stratum/blob/main/src/main/services/jdbcSidecar.ts"
click node_settings "https://github.com/lc-jhony/stratum/blob/main/src/shared/settings.ts"
click node_themeservice "https://github.com/lc-jhony/stratum/blob/main/src/main/services/themeService.ts"
click node_thememanager "https://github.com/lc-jhony/stratum/blob/main/src/renderer/src/theme/themeManager.ts"
click node_themeassets "https://github.com/lc-jhony/stratum/blob/main/src/renderer/src/theme/colorTheme.ts"
click node_icon "https://github.com/lc-jhony/stratum/blob/main/src/renderer/src/workbench/Icon.tsx"

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_app,node_explorer,node_datasource,node_diagramview,node_diagramlayout,node_state toneBlue
class node_console,node_completion,node_params,node_results,node_tableeditor,node_export,node_user toneAmber
class node_manager,node_session,node_dialects,node_factory,node_transports,node_connections,node_jdbc toneMint
class node_preload,node_ipc toneRose
class node_settings,node_themeservice,node_thememanager,node_themeassets,node_icon toneIndigo
```

## Components

### Workbench

- [Workbench shell](https://github.com/lc-jhony/stratum/blob/main/src/renderer/src/App.tsx): `src/renderer/src/App.tsx`
- [Database Explorer](https://github.com/lc-jhony/stratum/blob/main/src/renderer/src/workbench/Explorer.tsx): `src/renderer/src/workbench/Explorer.tsx`
- [Data source setup](https://github.com/lc-jhony/stratum/blob/main/src/renderer/src/workbench/DatasourceDialog.tsx): `src/renderer/src/workbench/DatasourceDialog.tsx`
- [ER diagram view](https://github.com/lc-jhony/stratum/blob/main/src/renderer/src/workbench/ErdView.tsx): `src/renderer/src/workbench/ErdView.tsx`
- [Diagram layout](https://github.com/lc-jhony/stratum/blob/main/src/renderer/src/erd/erd.ts): `src/renderer/src/erd/erd.ts`
- [Workbench state](https://github.com/lc-jhony/stratum/blob/main/src/renderer/src/store/workbench.ts): `src/renderer/src/store/workbench.ts`

### SQL and results

- [SQL console](https://github.com/lc-jhony/stratum/blob/main/src/renderer/src/workbench/ConsoleEditor.tsx): `src/renderer/src/workbench/ConsoleEditor.tsx`
- [SQL completion](https://github.com/lc-jhony/stratum/blob/main/src/shared/sqlComplete.ts): `src/shared/sqlComplete.ts`
- [Query parameters](https://github.com/lc-jhony/stratum/blob/main/src/shared/sqlParams.ts): `src/shared/sqlParams.ts`
- [Results grid](https://github.com/lc-jhony/stratum/blob/main/src/renderer/src/workbench/DataGrid.tsx): `src/renderer/src/workbench/DataGrid.tsx`
- [Table data editor](https://github.com/lc-jhony/stratum/blob/main/src/renderer/src/workbench/TableEditor.tsx): `src/renderer/src/workbench/TableEditor.tsx`
- [Data export](https://github.com/lc-jhony/stratum/blob/main/src/shared/export.ts): `src/shared/export.ts`

### Database access

- [Connection manager](https://github.com/lc-jhony/stratum/blob/main/src/main/services/connectionManager.ts): `src/main/services/connectionManager.ts`
- [Database session](https://github.com/lc-jhony/stratum/blob/main/src/main/db/session.ts): `src/main/db/session.ts`
- [Dialect introspection](https://github.com/lc-jhony/stratum/blob/main/src/main/db/dialects.ts): `src/main/db/dialects.ts`
- [Driver selection](https://github.com/lc-jhony/stratum/blob/main/src/main/db/factory.ts): `src/main/db/factory.ts`
- [Database transports](https://github.com/lc-jhony/stratum/tree/main/src/main/db/transports): `src/main/db/transports`
- [Connection store](https://github.com/lc-jhony/stratum/blob/main/src/main/services/store.ts): `src/main/services/store.ts`
- [JDBC sidecar](https://github.com/lc-jhony/stratum/blob/main/src/main/services/jdbcSidecar.ts): `src/main/services/jdbcSidecar.ts`

### Electron platform

- [Preload bridge](https://github.com/lc-jhony/stratum/blob/main/src/preload/index.ts): `src/preload/index.ts`
- [IPC handlers](https://github.com/lc-jhony/stratum/blob/main/src/main/ipc.ts): `src/main/ipc.ts`

### Themes and settings

- [Settings storage](https://github.com/lc-jhony/stratum/blob/main/src/shared/settings.ts): `src/shared/settings.ts`
- [Theme service](https://github.com/lc-jhony/stratum/blob/main/src/main/services/themeService.ts): `src/main/services/themeService.ts`
- [Theme manager](https://github.com/lc-jhony/stratum/blob/main/src/renderer/src/theme/themeManager.ts): `src/renderer/src/theme/themeManager.ts`
- [Theme rendering](https://github.com/lc-jhony/stratum/blob/main/src/renderer/src/theme/colorTheme.ts): `src/renderer/src/theme/colorTheme.ts`
- [Themed icons](https://github.com/lc-jhony/stratum/blob/main/src/renderer/src/workbench/Icon.tsx): `src/renderer/src/workbench/Icon.tsx`

### Other components

- **Database user**

## Connections

- Database user → Workbench shell: uses
- Workbench shell → Database Explorer: renders (evidence: `src/renderer/src/App.tsx`)
- Workbench shell → SQL console: renders (evidence: `src/renderer/src/App.tsx`)
- Workbench shell → Table data editor: renders (evidence: `src/renderer/src/App.tsx`)
- Workbench shell → ER diagram view: renders (evidence: `src/renderer/src/App.tsx`)
- Workbench shell → Workbench state: loads (evidence: `src/renderer/src/App.tsx`)
- Database user → Data source setup: configures
- SQL console → SQL completion: suggests
- SQL console → Query parameters: prompts
- SQL console → Results grid: shows results
- Table data editor → Data export: exports
- ER diagram view → Diagram layout: lays out (evidence: `src/renderer/src/workbench/ErdView.tsx`)
- Database Explorer → Workbench state: reads state (evidence: `src/renderer/src/workbench/Explorer.tsx`)
- Workbench state → Preload bridge: invokes API (evidence: `src/renderer/src/store/workbench.ts`)
- Preload bridge → IPC handlers: forwards IPC (evidence: `src/preload/index.ts`)
- IPC handlers → Connection manager: dispatches (evidence: `src/main/ipc.ts`)
- IPC handlers → Connection store: reads and writes (evidence: `src/main/ipc.ts`)
- Connection manager → Connection store: loads config (evidence: `src/main/services/connectionManager.ts`)
- Connection manager → Driver selection: creates session (evidence: `src/main/services/connectionManager.ts`)
- Driver selection → Database transports: selects driver (evidence: `src/main/db/factory.ts`)
- Driver selection → JDBC sidecar: uses JDBC (evidence: `src/main/db/factory.ts`)
- Connection manager → Database session: opens session (evidence: `src/main/services/connectionManager.ts`)
- Database session → Dialect introspection: introspects (evidence: `src/main/db/session.ts`)
- Database session → Database transports: queries (evidence: `src/main/db/session.ts`)
- Theme manager → Theme service: lists themes
- Theme manager → Theme rendering: applies theme (evidence: `src/renderer/src/theme/themeManager.ts`)
- Themed icons → Theme manager: observes theme (evidence: `src/renderer/src/workbench/Icon.tsx`)
- Themed icons → Theme rendering: resolves icons (evidence: `src/renderer/src/workbench/Icon.tsx`)
- Theme manager → Settings storage: loads preferences (evidence: `src/renderer/src/theme/themeManager.ts`)
- IPC handlers → Theme service: serves theme API (evidence: `src/main/ipc.ts`)
- Workbench state → Settings storage: merges preferences (evidence: `src/renderer/src/store/workbench.ts`)
