Architecture

How LastBrowser is built — Electron shell, Python backend, IPC layer, data flow, and module design.

High-Level Overview

LastBrowser is a dual-process application combining an Electron shell (frontend UI, native OS integration) with a Python backend (AI agent logic, WebUI server). The two processes communicate via HTTP and a local port.

┌─────────────────────────────────────────────────────────────────┐ │ LastBrowser Electron App │ │ ┌─────────────┐ ┌─────────────┐ ┌──────────────────────────┐ │ │ │ Main Proc │ │ Renderer(s) │ │ WebContentsViews (Tabs) │ │ │ │ (Node.js) │◄─┤ (Browser) │ │ (Isolated Per-Tab) │ │ │ │ Managers │ │ Sidebar │ │ │ │ │ │ IPC Router │ │ Workspace │ │ ┌──────┐ ┌──────┐ │ │ │ │ System Tray│ │ UI │ │ │Tab 1 │ │Tab 2 │ │ │ │ └──────┬──────┘ └─────────────┘ │ └──────┘ └──────┘ │ │ │ │ └──────────────────────────┘ │ │ │ HTTP (localhost:7889) │ │ ▼ │ │ ┌──────────────────────────────────────────────────────────────┤ │ │ Python Backend (server.py) │ │ │ ┌──────────┐ ┌──────────┐ ┌────────┐ ┌──────────────────┐ │ │ │ │Hermes │ │ API │ │ Static │ │ WebSocket │ │ │ │ │Agent Core│ │ Handlers │ │ Files │ │ Sessions │ │ │ │ └──────────┘ └──────────┘ └────────┘ └──────────────────┘ │ │ └──────────────────────────────────────────────────────────────┘ └─────────────────────────────────────────────────────────────────┘ │ ▼ ┌──────────────────────────────────────────────────────────────────┐ │ Local Storage (SQLite via sql.js in main process) │ │ Tabs, Workspaces, Agents, Settings, Kanban, Sessions, Tasks │ └──────────────────────────────────────────────────────────────────┘

Electron Main Process

The main process (native/main.js) is the application orchestrator. It manages:

Module System

The main process organizes functionality through a manager pattern. Each manager is a self-contained module:

workspaceManagerSession isolation, CRUD, reorder, export/import
tabManagerTab lifecycle, suspend, pin, close history (50)
agentManagerAgent CRUD, role system, task tracking, dashboard
kanbanManagerBoards, columns, cards, WIP limits, drag-drop
splitViewManagerMulti-panel layouts, resize, panel management
focusManagerPomodoro, distraction blocking, timer state
commandPaletteFuzzy search across all data types, quick actions
appManagerPinned web apps, multi-account, categories
settingsManagerPersistent settings, defaults, runtime updates
privacyManagerAdblock, cookie control, cache clearing
resourceSaverTab suspension, memory stats, exception list
sessionManagerSession CRUD, agent assignments
taskManagerTask management, status tracking
workerManagerBackground worker pool, job scheduling
cronManagerScheduled tasks, recurring jobs
pipelineManagerWorkflow pipeline, multi-step automation
notificationManagerOS notifications, badge updates
accountManagerMulti-account per app, session switching
compactManagerCompact UI mode toggle
appDefinitionManagerApp definition library (Slack, Gmail, etc.)
gitManagerGit integration, commit, diff, branch management

Each manager follows a consistent pattern:

IPC Communication

All renderer-to-main communication uses Electron's contextBridge + ipcMain.handle / ipcRenderer.invoke pattern. The IPC channel system is defined in src/shared/constants.js with ~150+ channels organized by domain:

// IPC Channel Organization (from src/shared/constants.js)
IPC.WORKSPACE_LIST, .WORKSPACE_CREATE, .WORKSPACE_DELETE...
IPC.TAB_CREATE, .TAB_CLOSE, .TAB_SUSPEND, .TAB_RESTORE...
IPC.AGENT_LIST, .AGENT_INVOKE, .AGENT_RESPONSE...
IPC.APP_LIST, .APP_CREATE, .APP_MUTE, .APP_SLEEP...
IPC.SPLIT_VIEW_CREATE, .SPLIT_VIEW_RESIZE...
IPC.FOCUS_START, .FOCUS_STOP, .FOCUS_STATUS...
IPC.KANBAN_CREATE, .KANBAN_MOVE, .KANBAN_WIP...
IPC.TAB_EXEC_JS, .TAB_SCREENSHOT, .TAB_GET_CONTENT

Security: contextIsolation: true, nodeIntegration: false. All Node.js APIs are exposed via preload.js with explicit whitelisting.

Data Storage

LastBrowser uses sql.js (SQLite compiled to WebAssembly via Emscripten) for all persistent data:

Python Backend

The Python backend (server.py) provides the Hermes WebUI — the AI agent interface that LastBrowser wraps:

Build & Packaging

LastBrowser uses electron-builder v25 for packaging and distribution:

native/
├── package.json          # Dependencies + build scripts
├── electron-builder.config.js  # electron-builder config
├── main.js               # App entry point
├── preload.js            # Security bridge
├── server-launcher.js    # Python backend lifecycle
├── assets/               # Icons (PNG, ICO, SVG)
└── src/                  # Source modules

Windows Build:

Security Model

LastBrowser follows Electron security best practices throughout.

Next: FAQ →