Electron Build Guide
January 4, 2026 · View on GitHub
Complete guide for building the Electron desktop application.
Prerequisites
- Node.js 20+ (LTS version recommended)
- Rust and wasm-pack (for building WASM SDK)
# Install Rust curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh # Install wasm-pack cargo install wasm-pack - data-modelling-sdk repository (for WASM build)
- Clone the SDK repository:
git clone <sdk-repo-url> data-modelling-sdk - Place it at:
../data-modelling-sdk(relative tofrontend/directory) - Or update the path in
scripts/build-wasm.sh
- Clone the SDK repository:
Quick Start
Development Mode
cd frontend
npm install
npm run build:wasm
npm run electron:dev
This will:
- Build Electron main/preload scripts
- Start Vite dev server (http://localhost:5173)
- Launch Electron app connected to dev server
- Enable hot-reload for frontend changes
Production Build
cd frontend
npm install
npm run build:wasm
npm run build
npm run build:electron
npm run electron:build
This creates platform-specific installers in release/:
- macOS:
.dmgor.pkgfiles - Windows:
.exeor.msifiles - Linux:
.AppImageor.debfiles
Detailed Build Steps
Step 1: Install Dependencies
cd frontend
npm install
Step 2: Build WASM SDK
The WASM SDK is required for offline functionality. Build it manually:
npm run build:wasm
This script will:
- Locate the
data-modelling-sdkrepository - Build the WASM module using
wasm-pack - Copy built files to
public/wasm/
Note: The WASM build also runs automatically before npm run build via the prebuild script.
Step 3: Build Frontend
npm run build
This will:
- Run TypeScript compilation (
tsc) - Build the frontend with Vite
- Include WASM files from
public/wasm/in the build output - Output to
dist/directory
Step 4: Build Electron Main Process
npm run build:electron
This uses vite.electron.config.ts to build:
electron/main.ts→dist-electron/main.cjselectron/preload.ts→dist-electron/preload.cjs
Step 5: Create Production Package
npm run electron:build
This uses electron-builder to create distributable packages:
- Reads configuration from
electron/electron-builder.yml - Creates platform-specific installers
- Outputs to
release/directory
Running the Electron App
Development Mode
npm run electron:dev
Runs Electron connected to Vite dev server with hot-reload.
Production Mode
npm run electron
Runs Electron using built files from dist/ (offline mode).
Note: You must run npm run build first to create the dist/ folder.
Complete Build Script
For a complete build from scratch:
cd frontend
# 1. Install dependencies
npm install
# 2. Build WASM SDK
npm run build:wasm
# 3. Build frontend
npm run build
# 4. Build Electron scripts
npm run build:electron
# 5. Create production package
npm run electron:build
Troubleshooting
WASM SDK Not Found
Error: WASM SDK build skipped (SDK not found or wasm-pack not installed)
Solutions:
-
Clone the SDK repository:
cd .. git clone <sdk-repo-url> data-modelling-sdk -
Verify wasm-pack is installed:
wasm-pack --version -
Update SDK path in
scripts/build-wasm.shif needed
Electron App Shows Blank Screen
- Check that frontend build completed:
ls -la dist/index.html - Check Electron console:
View > Toggle Developer Tools - Verify Electron scripts built:
ls -la dist-electron/main.cjs - For dev mode, ensure Vite server is running
Build Errors
- TypeScript errors: Run
npm run type-check - Vite build errors: Check
vite.config.tsandvite.electron.config.ts - Electron build errors: Ensure Electron dependencies are installed
Port Already in Use
If port 5173 is in use:
# Find process using port
lsof -i :5173
# Kill process
kill -9 <PID>
File Structure
frontend/
├── electron/
│ ├── main.ts # Electron main process
│ ├── preload.ts # Preload script (IPC bridge)
│ ├── electron-builder.yml # Electron Builder config
│ └── icons/ # App icons
├── scripts/
│ └── build-wasm.sh # WASM SDK build script
├── public/
│ └── wasm/ # WASM SDK output (generated)
├── dist/ # Frontend build output
├── dist-electron/ # Electron build output
│ ├── main.cjs
│ ├── preload.cjs
│ └── wasm/ # Copied WASM files
└── release/ # Production packages (generated)
Environment Variables
NODE_ENV=development- Development mode (uses Vite dev server)NODE_ENV=production- Production mode (uses built files, offline mode)
Additional Notes
- The Electron app operates in offline mode by default (no API connection)
- WASM SDK is required for offline functionality
- File system access is available through Electron IPC handlers
- Native file dialogs are used for workspace folder selection
- All data is stored locally in YAML files
Related Documentation
- README.md - Project overview
- HOW_TO_RUN.md - Running instructions
- QUICK_START.md - Quick start guide