Skip to main content

Build Process

Flow Browser uses electron-builder to package the application for distribution. The build process compiles TypeScript, bundles assets, and creates platform-specific installers.

Quick Build Commands

bun build:win
Build output will be in the ./dist directory.

Build Steps

1

Type Checking

The build process starts by running TypeScript type checks:
bun run typecheck
This runs two separate type checks:
  • typecheck:node - Main process and Node.js code
  • typecheck:web - Renderer process and web code
2

Vite Build

electron-vite compiles and bundles the application:
cross-env PRODUCTION_BUILD=true electron-vite build
This:
  • Compiles TypeScript to JavaScript
  • Bundles renderer code with Vite
  • Optimizes assets and code
  • Generates source maps
3

Frontend Routes Pruning

Removes development-only routes:
bun run script:prune-frontend-routes
4

electron-builder Packaging

Packages the app for the target platform:
  • Creates installers (Windows)
  • Builds DMG files (macOS)
  • Generates AppImage/deb/rpm (Linux)

Platform-Specific Builds

Windows

bun build:win
Output files in ./dist:
  • Flow-{version}-setup.exe - NSIS installer
  • Flow-{version}-win.zip - Portable version
Windows builds can be created on Windows, macOS, or Linux.

macOS

bun build:mac
Output files in ./dist:
  • Flow-{version}.dmg - Disk image installer
  • Flow-{version}-mac.zip - Zip archive
macOS builds must be created on macOS due to code signing requirements.

Linux

bun build:linux
Output files in ./dist:
  • Flow-{version}.AppImage - Universal Linux binary
  • Flow-{version}.deb - Debian/Ubuntu package
  • Flow-{version}.rpm - Fedora/RHEL package
Linux builds can be created on Linux, macOS, or Windows (with WSL).

Development Builds

For testing the build process without creating installers:
bun build:unpack
This builds the app and unpacks it to ./dist/{platform}-unpacked without creating installers. Useful for:
  • Testing production builds locally
  • Debugging build issues
  • Inspecting bundled files

Build Configuration

Build settings are configured in package.json under the build key:
{
  "build": {
    "appId": "com.multiboxlabs.flow",
    "productName": "Flow",
    "directories": {
      "output": "dist"
    },
    "files": [
      "out/**/*",
      "package.json"
    ]
  }
}

Widevine VMP Signing

For production builds with full DRM support, you need Widevine VMP signing.

What is VMP Signing?

Widevine Verified Media Path (VMP) signing ensures your browser can play DRM-protected content from streaming services like Netflix, Spotify, and Disney+.

Setup Process

1

Create EVS Account

Sign up for a Castlabs EVS (Electron Video Services) account:Create EVS Account
2

Configure Credentials

Add your EVS credentials to your build environment:
export CASTLABS_EVS_USERNAME="your-username"
export CASTLABS_EVS_PASSWORD="your-password"
3

Build with Signing

The build pipeline will automatically VMP-sign your application when credentials are present.Signed builds will have full Widevine DRM support.
Development builds work without VMP signing, but DRM content playback may be limited.

Build Troubleshooting

Native Module Errors

If you encounter native module build errors:
# Rebuild native modules for Electron
electron-builder install-app-deps

Build Cache Issues

Clear build artifacts and rebuild:
bun run reset
bun install
bun build:linux  # or your target platform
The reset script removes:
  • dist/ - Build output
  • out/ - Compiled code
  • node_modules/ - Dependencies
  • .yalc/ - Local package links
  • Package manager cache

Type Check Failures

Fix type errors before building:
# Check for type errors
bun typecheck

# Check specific processes
bun run typecheck:node  # Main process
bun run typecheck:web   # Renderer process

CI/CD Builds

For automated builds in CI/CD pipelines:
# Install dependencies
bun install

# Run all checks
bun run lint
bun run typecheck
bun run format

# Build for target platform
bun run build
bun run build:linux  # or :win, :mac
The postinstall script automatically rebuilds native modules during bun install, so no manual rebuild is needed in CI.

Build Scripts Reference

ScriptCommandDescription
buildbun run buildCompile source (no packaging)
build:unpackbun build:unpackBuild and unpack (no installer)
build:winbun build:winBuild Windows installer
build:macbun build:macBuild macOS DMG
build:linuxbun build:linuxBuild Linux packages
resetbun run resetClean all build artifacts

Next Steps

Contributing

Learn how to contribute to Flow Browser

Architecture

Understand the codebase structure

Build docs developers (and LLMs) love