-
Notifications
You must be signed in to change notification settings - Fork 4
Architecture
krwg edited this page Jul 8, 2026
·
1 revision
High-level structure of Cultiva 1.7.0 · Linden.
flowchart TB
subgraph Main["Main process"]
IPC[IPC handlers]
FS[File I/O / plugin install]
UPD[electron-updater]
end
subgraph Renderer["Renderer (Vite bundle)"]
APP[app controllers]
PM[plugin-manager]
IDB[(IndexedDB)]
MW[Main window DOM]
end
subgraph Sandbox["Plugin sandbox iframe"]
PLG[plugin index.js]
end
Main <-->|IPC| Renderer
PM -->|postMessage RPC| Sandbox
PM -->|inject CSS / mount UI| MW
APP --> IDB
PLG -->|storage/ui/data RPC| PM
| Process | Key files |
|---|---|
| Main |
electron/main.js, IPC for plugin file read, HTTP proxy |
| Renderer |
src/main.js, src/app/*, src/core/*
|
| Preload |
electron/preload.js — exposes safe window.electron bridge |
- IndexedDB — habits, settings, completion history
- localStorage — small settings bridge where needed
- userData/ — plugin installs, auto-backups (ZIP), custom photos
Modules: src/modules/habits.js, storage helpers, migration on version bump.
- Fetch
registry.jsonfrom configured URL. - Verify sha256 for each file in plugin entry.
- Download to
userData/cultiva-plugins/<id>/. - Create PluginSandboxHost iframe (
sandbox="allow-scripts"). - Execute plugin as
new Function('context', 'hooks', source). - Wire RPC allowlist in
plugin-rpc.jsbased onmanifest.permissions. - Bridge UI calls to main window (header, garden, sheets).
Key files:
src/core/plugin-manager.jssrc/core/plugin-sandbox-host.jssrc/core/plugin-rpc.jssrc/app/plugins-ui.js
| View | Entry |
|---|---|
| Garden (home) |
src/index.html + src/app/garden*.js
|
| Calendar | src/calendar.html |
| Settings | Modal overlay in main window |
Styling: CSS variables in src/styles/main.css — themes swap variable sets.
npm ci → vite build → electron-builder (NSIS + portable)
CI: GitHub Actions for tests, Dependabot, npm audit.
| Asset | Access |
|---|---|
| Habit data | Renderer only — plugins via hooks, not direct DB |
| Network | Gated by manifest.permissions.network
|
| Filesystem | Main process path guards for plugin install dir |
| Sandbox | No nodeIntegration, no direct DOM |
See Privacy and Security.