Overview
The renderer process (src/renderer/) is the UI layer of Emdash. It runs React 18 with TypeScript, built using Vite. The renderer is sandboxed and communicates with the main process exclusively through IPC via window.electronAPI.
Tech stack:
- React 18.3 (functional components + hooks)
- TypeScript 5.3 (strict mode)
- Vite 5 (dev server + bundler)
- Tailwind CSS 3 (utility-first styling)
- Radix UI (accessible component primitives)
- Framer Motion (animations)
- @xterm/xterm 6.0 (terminal emulation)
- Monaco Editor 0.55 (code editor)
- TanStack Query (data fetching)
Application structure
App.tsx - Root component
src/renderer/App.tsx is the entry point:
- QueryClientProvider - TanStack Query for async state
- ModalProvider - Modal management
- AppContextProvider - Global app state
- GithubContextProvider - GitHub integration state
- ProjectManagementProvider - Project CRUD operations
- TaskManagementProvider - Task lifecycle management
- AppSettingsProvider - User preferences
- ThemeProvider - Theme and appearance
Views
WelcomeScreen (src/renderer/views/Welcome.tsx)
- First-launch onboarding
- Shown when
FIRST_LAUNCH_KEYis true in localStorage - Single “Get Started” action transitions to Workspace
src/renderer/views/Workspace.tsx)
- Main application UI (~700 lines)
- Layout: Sidebar + Content panes (Editor/Chat/Browser)
- Manages active project, task, and terminal state
Key components
ChatInterface
src/renderer/components/ChatInterface.tsx (~1,000 lines) - Main conversation UI.
Responsibilities:
- Render terminal pane using xterm.js
- Handle PTY data streaming
- Manage conversation tabs (multi-chat)
- Send user input to PTY via IPC
- Terminal resize handling
EditorMode
src/renderer/components/EditorMode.tsx - Monaco editor integration.
Features:
- Syntax highlighting for 100+ languages
- File tree navigation
- Split pane diff view
- Inline comments
- Git integration (show modified lines)
FileChangesPanel
src/renderer/components/FileChangesPanel.tsx - Git diff visualization.
Features:
- List modified/added/deleted files
- Click to open diff view
- Approve/reject changes
- Bulk operations (approve all, discard all)
CommandPalette
src/renderer/components/CommandPalette.tsx - Keyboard-driven command menu.
Shortcuts:
Cmd/Ctrl + K- Open paletteCmd/Ctrl + P- Quick file switcherCmd/Ctrl + Shift + P- Action palette
- Create new task
- Switch projects
- Open settings
- GitHub operations (create PR, view checks)
- Worktree management
cmdk:
BrowserPane
src/renderer/components/BrowserPane.tsx - Embedded webview for previews.
Use cases:
- Preview web app during development
- View documentation
- Test responsive layouts
Key hooks
Emdash has 42 custom hooks insrc/renderer/hooks/. Here are the most important:
useTaskManagement
src/renderer/hooks/useTaskManagement.ts (~864 lines) - Complete task lifecycle.
Responsibilities:
- Create, delete, rename, archive, restore tasks
- Optimistic UI updates with rollback
- PTY lifecycle cleanup
- Worktree management
useAppInitialization
src/renderer/hooks/useAppInitialization.ts - Two-round loading strategy.
Why two rounds?
- Round 1: Fast skeleton (project list, active project ID)
- Round 2: Full hydration (tasks, conversations, git info)
useCliAgentDetection
src/renderer/hooks/useCliAgentDetection.ts - Detect installed CLI agents.
How it works:
useInitialPromptInjection
src/renderer/hooks/useInitialPromptInjection.ts - Inject initial prompt into agent.
Two strategies:
-
CLI flag (Claude, Codex):
-
Keystroke injection (Amp, OpenCode):
src/shared/providers/registry.ts) defines which strategy:
IPC communication
All main process communication goes throughwindow.electronAPI:
src/renderer/types/electron-api.d.ts (~1,870 lines):
State management
React Context for global state:AppContextProvider- Active project, task selectionProjectManagementProvider- Project CRUDTaskManagementProvider- Task lifecycle
Testing
Renderer tests located insrc/test/renderer/ (3 test files).
Example using Vitest + React Testing Library:
Performance considerations
Monaco disposal: Always dispose editor instances to prevent memory leaks:Next steps
- IPC handlers - Complete IPC reference
- Architecture overview - High-level architecture