Prerequisites
Before building, ensure you have:- Node.js 20 or higher
- pnpm package manager (version 9)
- All required environment variables configured in
.env.local
Build Scripts Overview
The build process uses several npm scripts defined infrontend/package.json:12-19:
Building for Windows
1
Navigate to frontend directory
Open your terminal and change to the frontend directory:
2
Install dependencies
Install all required dependencies using pnpm:
3
Run the build command
Execute the dist command to create the production executable:Or using npm:This command:
- Builds the Next.js application with Turbopack
- Compiles the Electron main process using tsup
- Packages everything into a Windows installer using electron-builder
4
Locate the executable
The resulting The installer uses NSIS (Nullsoft Scriptable Install System) with the following configuration:
.exe installer will be created in:- Allows user to choose installation directory
- Creates desktop and start menu shortcuts
- Supports per-machine installation
Building for Linux
1
Navigate to frontend directory
2
Run the Linux build command
To create a Debian package (.deb):This creates a
.deb package in the frontend/dist/ directory.The Linux build is configured in
package.json:197-203 to target the Development category and includes proper icon configuration.Build Configuration
The electron-builder configuration inpackage.json includes:
Application Settings
- Product Name: Tabby
- App ID: com.tabby.ai-keyboard
- ASAR Packaging: Enabled for code protection
Included Files
The build packages:- Electron build artifacts (
build/) - Next.js standalone output (
.next/standalone) - Static assets (
.next/static) - Public files (
public/) - Required native modules (
*.node,*.dll)
Windows NSIS Installer
Troubleshooting
Build Fails on Windows
If the build fails, ensure:- You have the latest Windows Build Tools installed
- Visual Studio C++ build tools are available
- All dependencies installed successfully with
pnpm install
Missing Dependencies
The postinstall script automatically runselectron-builder install-app-deps. If you encounter native module issues, try:
TypeScript Errors
Run type checking before building:tsc --noEmit to check for TypeScript errors without generating output files.