Prerequisites
Before you begin, ensure you have the following installed:- Node.js: Version 20.0.0 or higher (recommended: 22.20.0)
- pnpm: Package manager version 10.28.0 or higher
- Git: For version control
- GitHub CLI (
gh): Install viabrew install gh, then rungh auth login - At least one coding agent CLI: Such as Claude, Codex, OpenCode, etc.
Quick Start
The fastest way to get Emdash running locally:Install the correct Node.js version
If you’re using nvm:This reads the
.nvmrc file and installs Node.js 22.20.0 if needed.Or install Node.js 22.x manually from nodejs.org.Install dependencies and start the dev server
- Installs all dependencies via
pnpm install - Launches both the Electron main process and Vite dev server
- Opens the Emdash application window
Development Commands
Once you’re set up, use these commands during development:Starting the Dev Server
Quality Checks
Always run these before committing:Native Modules
Emdash uses native Node.js modules (node-pty, sqlite3, keytar) that must be rebuilt for Electron:pnpm run rebuild after:
- Updating native dependencies
- Switching Node.js versions
- Encountering native module errors
Building
Development Workflow
Hot Reload Behavior
- Renderer changes (files in
src/renderer/): Hot-reload automatically via Vite - Main process changes (files in
src/main/): Require Electron restart (Ctrl+C →pnpm run dev) - Native module updates: Require
pnpm run rebuild
Port Configuration
The Vite dev server runs on port 3000 by default. This is configured invite.config.ts.
Environment Variables
All environment variables are optional. Create a.env file in the project root to configure:
Project Structure
Understanding the codebase layout:Path Aliases
TypeScript Configuration
Emdash uses two TypeScript configs:tsconfig.json: Renderer + shared code (module: ESNext,noEmit: true)tsconfig.main.json: Main process (module: CommonJS— required by Electron)
strict: true enabled. Prefer explicit types over any.
Common Development Issues
Native module errors after npm install
Native module errors after npm install
Run
pnpm run rebuild to rebuild native modules (node-pty, sqlite3, keytar) for your current Electron version.If issues persist, try a clean install:Electron app won't start
Electron app won't start
Check that:
- You’re using Node.js 20.0.0 or higher (run
node --version) - All dependencies are installed (
pnpm install) - The main process compiled successfully (check for TypeScript errors)
Changes not reflecting in the app
Changes not reflecting in the app
- Renderer changes: Should hot-reload automatically. Refresh with Cmd+R (Mac) or Ctrl+R (Windows/Linux)
- Main process changes: Require full restart (Ctrl+C →
pnpm run dev) - Native modules: Require rebuild (
pnpm run rebuild)
Database schema errors
Database schema errors
Never manually edit files in
drizzle/meta/ or migration files. Instead:- Edit
src/main/db/schema.ts - Generate migration:
pnpm exec drizzle-kit generate - Test locally before committing
Next Steps
Testing
Learn how to write and run tests
Contributing
Submit your first PR