Skip to content

Desktop Architecture

JagaTheGhost edited this page Oct 19, 2026 · 1 revision

πŸ–₯️ Desktop Architecture & IPC Bridge

VisualMark Studio is designed as a native Code + Visual desktop IDE (modeled after VS Code and modern desktop developer tools) using Electron, React 18, and an embedded Python FastAPI sidecar daemon.


πŸ›οΈ System Architecture Overview

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                   VisualMark Studio Desktop Window               β”‚
β”‚                                                                  β”‚
β”‚  [✦ VisualMark Studio]  [File β–Ύ]   [⌘K Search]    [─] [β–‘] [βœ•]    β”‚
β”‚  β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€  β”‚
β”‚  β”‚                                                            β”‚  β”‚
β”‚  β”‚   React + Vite UI (Frameless Custom Titlebar & Studios)    β”‚  β”‚
β”‚  β”‚   - Direct Disk Read/Write (Ctrl+S, Ctrl+O)                β”‚  β”‚
β”‚  β”‚   - Local Folder Workspace Browser (Ctrl+Shift+O)          β”‚  β”‚
β”‚  β”‚                                                            β”‚  β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β”‚
β”‚                                β”‚                                 β”‚
β”‚                         IPC Bridge                               β”‚
β”‚                                β”‚                                 β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”‚
β”‚  β”‚               Electron Main Process (Node.js)              β”‚  β”‚
β”‚  β”‚   - Native file dialogs & disk streaming                   β”‚  β”‚
β”‚  β”‚   - Window minimize / maximize / close                     β”‚  β”‚
β”‚  β”‚   - Sidecar process manager & lifecycle hooks              β”‚  β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                                 β”‚ HTTP (http://127.0.0.1:8000..8030)
                                 β”‚ Dynamic port negotiation & fallback
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚            Standalone Python FastAPI Daemon (server.exe)         β”‚
β”‚  - Frozen via PyInstaller (runs without Python pre-installed)    β”‚
β”‚  - Conflict-resilient port binding (--port <activePort>)         β”‚
β”‚  - Deep AST scanning, multi-file suites & documentation AI       β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

πŸ”Œ 1. The Electron IPC Bridge

Because modern web security restricts browser windows from arbitrarily reading and writing files to local disk, the Electron Main Process serves as a secure bridge exposing safe APIs via contextBridge in preload.js:

IPC Channel Purpose Direction
read-file Reads file content directly from local filesystem Renderer $\rightarrow$ Main
write-file Saves active document to local filesystem Renderer $\rightarrow$ Main
select-file Opens native OS file picker dialog Renderer $\rightarrow$ Main
select-folder Opens native OS directory picker dialog Renderer $\rightarrow$ Main
get-backend-url Returns the negotiated Python sidecar URL Renderer $\rightarrow$ Main
window-minimize Minimizes desktop window Renderer $\rightarrow$ Main
window-maximize Toggles maximized / restored state Renderer $\rightarrow$ Main
window-close Gracefully closes application and stops sidecar Renderer $\rightarrow$ Main

⚑ 2. Dynamic Port Negotiation (8000–8030)

In developer workstations, port 8000 is frequently occupied by other local servers (e.g. Docker, Django, or other microservices).

To prevent startup crashes:

  1. When Electron initializes, it probes ports sequentially from 8000 through 8030.
  2. If it discovers an active VisualMark backend (by checking /health), it binds to it immediately.
  3. If no backend is running, Electron selects the first available free port and spawns the Python sidecar daemon passing --port <port>.
  4. The negotiated URL is pushed to the React UI via get-backend-url, ensuring zero connection errors.

🧊 3. Standalone Frozen Sidecar (server.exe)

When packaged for distribution:

  • The Python backend is frozen into a self-contained executable (server.exe) using PyInstaller.
  • End users do not need Python installed on their machines.
  • Electron manages the sidecar's lifecycle: spawning it silently on launch and terminating the process when the window closes.

πŸ”’ 4. Local-First & Zero Telemetry Philosophy

VisualMark Studio does not transmit your source code, documentation, or file paths to external servers:

  • All AST parsing, Markdown linting, and diagram generation execute locally on your hardware.
  • External network requests are restricted to public badge fetching (Shields.io) and optional SSRF-sanitized image previews.
  • No telemetry, analytics, or behavioral trackers are included in the binaries.

Return to Home or continue to 12 Visual Studios Guide.