Synapse Framework — Project Overview
Reference map for contributors and agents working in this repository.
What this project is
Synapse Framework is a Windows-focused Tauri 2 desktop app that recreates and extends classic Synapse executor UIs. It provides:
- A Luau script editor (Monaco)
- Script Hub (ScriptBlox catalog + legacy embedded scripts)
- Console (F9 logs from executor)
- A local executor bridge on
127.0.0.1:31337with three HTTP methods — Port (Fastest), Stream, and Compat — each with a Lua client and Rust queue. See EXECUTOR_BRIDGE.md. - An extensible plugin system (JS modules, overlays, bridge providers). See PLUGINS.md.
- Four UI shells selectable via settings (
uiMode)
This is not a web backend, monorepo, or authenticated SaaS. Persistence uses localStorage, IndexedDB, and Tauri filesystem JSON — there is no SQL/ORM.
flowchart TB
subgraph desktop [Synapse Framework]
React["React/Vite src/"]
Rust["Rust src-tauri/"]
Axum["Axum bridge :31337"]
end
Executor["Executor Luau client (Port / Stream / Compat)"] <-->|HTTP :31337| Axum
React <-->|Tauri IPC invoke| Rust
Rust --> Axum
ScriptBlox["scriptblox.com"] -->|dev proxy /scriptblox-api path| React
Repository layout
| Path | Role |
|---|---|
src/ | Production frontend — React 18, React Router 7, Monaco, Tailwind 4 |
src-tauri/ | Native shell — Tauri 2, IPC commands, Axum bridge |
dist/ | Vite build output → Tauri frontendDist |
public/ | Static Lua samples, fonts |
scripts/ | Dev helpers (run-vite.mjs, port cleanup, Monaco CSS gen) |
docs/ | Project documentation |
logo presets/ | Optional top-bar logo PNGs (runtime glob in src/ui/topBarLogos.ts) |
Not in repo (as of this doc): root tsconfig.json, ESLint/Prettier config, .env files, CI workflows, Docker, automated tests.
Tech stack
| Layer | Stack |
|---|---|
| Frontend | TypeScript, React 18.3, Vite 6.3, React Router 7.13, Tailwind 4, Radix/shadcn UI, Motion, Zustand (minimal), Monaco + luaparse |
| Desktop | Tauri 2.10 (core invoke, dialog/fs plugins) |
| Backend | Rust 2021 — Axum 0.7 HTTP server, Tokio, serde, winreg, arboard |
| Package mgr | npm (package-lock.json) |
| Ship target | Windows MSI via WiX (src-tauri/wix/main.wxs) |
Entry points and boot flow
Frontend bootstrap — src/main.tsx
- Tauri detection → adds
synapse-tauriclass, sets window background from theme - Normalizes
/index.html→/(Tauri asset protocol quirk) applyAlternateShellBootPathFromSettings()— sync redirect to/synapse-original/*,/synapse-x/*, or/synapse-v3/*before React paints- Persists
app_settings_snapshot.jsonviapersist_app_settings_snapshotfor Rust cold-start routing - Global contextmenu suppression (except Monaco, Radix menus)
- Renders
src/app/App.tsx
Routing — src/app/routes.tsx
| Route prefix | Shell | Pages |
|---|---|---|
/ | Default “Synapse Blue” | editor, script-hub, console, settings, themes, integrated-webpage |
/synapse-original/* | Synapse 2017 | loading, main, script-hub, settings, console |
/synapse-x/* | Synapse X (UI replica) | same |
/synapse-v3/main | Synapse V3 | main (editor-focused) |
/dialog/* | Small confirmation webviews | clear tab, close all, etc. |
altShellBootRedirectLoader catches edge cases where persisted uiMode does not match the URL.
Rust bootstrap — src-tauri/src/main.rs → lib.rs
- Reads
app_settings_snapshot.jsonbefore webview paint to open the correct initial window route - Spawns the Axum server on
127.0.0.1:31337— Port (/port_bridge/*), Stream (/stream_bridge/*), Compat (/compat_bridge/*), script downloads, and per-method liveness watchdogs - Registers all Tauri IPC commands
Tauri IPC commands
| Command | Purpose |
|---|---|
persist_app_settings_snapshot | Cold-start routing snapshot |
persist_window_icon_preset | Taskbar icon preset |
read_text_file_abs / write_text_file_abs | Absolute-path file I/O |
reveal_in_file_manager / open_scripts_folder | Explorer integration |
list_sidebar_scripts | List .lua in scripts dir |
open_external_url | Browser (http(s) / file:// only) |
write_clipboard_text | Clipboard |
bridge_status / bridge_send_execute | Executor attach + run script |
is_v3_enabled | Reads v3.ini beside exe (frontend useV3Enabled always returns true) |
UI shells and settings
Settings: src/app/appSettings.ts
- Storage key:
synapse.appSettings.v1 uiMode:"default"|"synapseOriginal"|"synapseX"|"synapseV3"- Bridge transport:
bridgeMethod:"port"|"stream"|"compat"(Settings labels: Fastest / Stream / Compatible). Legacy"websocket"migrates to"port". - Other flags: autoAttach, confirmations, resizable window, alwaysOnTop, minimap, error logging, edge curves per shell, integrated webpage URL
| Shell | Directory | Notes |
|---|---|---|
| Default | src/app/pages/, MainLayout.tsx | Primary 290×355-style UI; full executor bridge |
| Synapse Original (2017) | src/app/synapse-original/ | Multi-window via Tauri windowOps.ts |
| Synapse X | src/app/synapse-x/ | WPF-parity sizing; no auth/executor wiring (UI reproduction) |
| Synapse V3 | src/app/synapse-v3/ | Newer theme; Zustand v3Theme.ts; many dormant Figma components |
Theming: src/ui/shellTheme.ts — CSS vars, IndexedDB media (synapse-original-shell-media), per-shell keys.
Core feature modules
Editor
src/editor/ScriptMonacoEditor.tsx— Monaco mountsrc/editor/luauLanguage.ts— language registrationsrc/editor/synapseIntellisense.ts— completionssrc/editor/synapseDiagnostics.ts—luaparsemarkers- Tab/workspace:
src/app/editorWorkspace/(EditorWorkspaceContext) - Disk I/O:
src/app/scripts/editorDiskScripts.ts
Executor bridge
Axum listener on 127.0.0.1:31337 serves three HTTP bridge methods. Full protocol: EXECUTOR_BRIDGE.md.
| Piece | Role |
|---|---|
src-tauri/src/bridge.rs | Script downloads, bridge_send_execute, method dispatch, legacy_disabled |
src-tauri/src/port_bridge.rs | Port /port_bridge/{hello,ping,next,result,log} — long-poll, ~45s liveness |
src-tauri/src/stream_bridge.rs | Stream /stream_bridge/* — NDJSON heartbeat + long-poll next |
src-tauri/src/compat_bridge.rs | Compat /compat_bridge/* — immediate next, short client poll |
src/app/executorBridge/bridgeDispatch.ts | Central execute routing; plugin provider ownership |
src/app/executorBridge/useBridgeExecuteReady.ts | Execute gating; undock relay to main |
ExecutorBridgeContext.tsx | Bridge UI state, bridge_send_execute, status events |
Port Bridge.lua / Stream Bridge.lua / Compat Bridge.lua | Executor-side HTTP clients |
| Tauri events | synapse:bridge-status (port_*, stream_*, compat_*, legacy_disabled), synapse:bridge-execute-result, synapse:bridge-log |
Plugins
App-wide JS extensions loaded on the main webview. Full guide: PLUGINS.md.
| Piece | Role |
|---|---|
src/app/plugins/GlobalPluginProvider.tsx | Bootstrap enabled plugins (main window only) |
src/app/synapse-v3/plugins/PluginHost.ts | Host API, bridge providers, overlays |
src/app/synapse-v3/plugins/v3PluginRegistry.ts | Enabled/order in localStorage |
src-tauri/src/plugins.rs | On-disk layout, ZIP install, tombstone |
src-tauri/src/plugin_process_host.rs | Plugin subprocess singleton |
Script Hub
src/app/scriptHub/scriptBloxApi.ts— ScriptBlox fetch layer (dev proxied invite.config.tsas/scriptblox-api)src/app/scriptHub/synapseLegacyScripts.ts— embedded legacy URLs
Integrated webpage
src/app/integratedSiteWebview.ts— secondary native webview (bypasses iframe limits)
Data persistence
| Store | Key / file | Used for |
|---|---|---|
| localStorage | synapse.appSettings.v1, theme keys, editor tabs | Settings, themes, tabs |
| IndexedDB | synapse-original-shell-media | Background images/videos |
| Tauri config dir | app_settings_snapshot.json, window_icon_preset.json, scripts/ | Cold boot, icons, sidebar scripts |
| Filesystem | User-picked paths via dialog plugin | Open/save scripts |
Dev and build commands
npm install
npm run dev # Vite @ http://127.0.0.1:5173 (browser only)
npm run tauri:dev # Full desktop (needs VS DevCmd on Windows)
npm run build # vite build → dist/
npm run tauri:build # MSI installer
- Port cleanup:
scripts/ensure-dev-port.mjs(5173/4173) - Tauri auto-runs
npm run dev/npm run buildviasrc-tauri/tauri.conf.jsonhooks
Key files quick reference
| Concern | File |
|---|---|
| Frontend entry | src/main.tsx |
| App root | src/app/App.tsx |
| Routes | src/app/routes.tsx |
| Settings | src/app/appSettings.ts |
| Editor page | src/app/pages/EditorPage.tsx |
| Bridge UI | src/app/executorBridge/ExecutorBridgeContext.tsx |
| Rust app | src-tauri/src/lib.rs |
| Bridge server | src-tauri/src/bridge.rs |
| Vite config | vite.config.ts |
Working on this codebase
- Identify which UI shell and route are affected
- Decide whether logic belongs in React, Tauri IPC, or
bridge.rs - Respect boot-path synchronization between
main.tsx,routes.tsx, and Rustboot_window_config - Bridge protocols live in
src-tauri/src/{port,stream,compat}_bridge.rsand matching* Bridge.luascripts - Plugin changes may require Restart Framework — see PLUGINS.md
Gaps and conventions
- No automated tests in the main app
- No CI/CD — builds are local MSI only
- No root tsconfig — Vite transpiles TS without strict project config
- Figma heritage —
src/imports/SVG path modules; npm package name@figma/my-make-file - Auth: none; Synapse X shell is explicitly UI-only
- Synapse V3 is partially integrated (single main route; many dormant components)
Optional future improvements
Not required for day-to-day development; add when explicitly requested:
- Root
tsconfig.jsonfor stricter TypeScript checking - Vitest or similar test runner
- GitHub Actions CI for
npm run buildandcargo test