Production Build Commands for Insomnia from package.json: The Complete Guide

The Kong/insomnia repository defines two primary commands—npm run app-build to compile the TypeScript source and bundle assets, and npm run app-package to generate native installers using electron-builder.

The Kong/insomnia project automates its production pipeline through npm scripts defined in the root package.json. These commands wrap complex build steps, including React Router compilation, TypeScript transpilation, and Electron packaging, to produce distributable binaries for macOS, Linux, and Windows. Understanding these production build commands is essential for developers who need to create release-ready binaries from the source code.

Primary Production Build Commands

Build the Application with npm run app-build

The npm run app-build command initiates the compilation phase of the pipeline. According to the root package.json, this script executes npm run build -w insomnia, which invokes the build process defined in packages/insomnia/package.json.

This step runs react-router build followed by the custom scripts/build.ts script. The output is a production-ready /build directory containing the minified entry.main.min.js file and all static assets required for the Electron application.

Create Installers with npm run app-package

The npm run app-package command transforms compiled assets into native installers. This script first ensures a fresh build, then invokes electron-builder using the configuration defined in packages/insomnia/electron-builder.config.js.

The process generates platform-specific distributables—including DMG and ZIP for macOS, AppImage and DEB for Linux, and NSIS installers for Windows—placing them in the ./dist directory. The electron-builder.config.js file controls signing options, target formats, and extra resources like the bundled yarn-standalone.js.

Windows-Specific Distribution

For Windows-specific releases, use the npm run package:windows:dist command. This specialized script creates a signed NSIS installer optimized for Windows distribution, handling platform-specific signing requirements and packaging conventions that differ from the cross-platform app-package command.

Run the complete production pipeline using these commands:


# Compile TypeScript and bundle assets

npm run app-build

# Create native installers for all platforms

npm run app-package

# Create signed Windows installer only

npm run package:windows:dist

How the Build Pipeline Works

Step 1: TypeScript and React Compilation

The build process begins with TypeScript and React compilation orchestrated by packages/insomnia/scripts/build.ts. This script invokes react-router build to handle the frontend assets, then compiles TypeScript source files using ESBuild. The result is a tree-shaken bundle containing the minified entry.main.min.js referenced by the extraMetadata field in the Electron Builder configuration.

Step 2: Electron Entry Point Generation

The packages/insomnia/scripts/esbuild.entrypoints.ts script generates the critical Electron entry-point files. It bundles the main process and preload scripts that Electron requires to start the application, outputting them to the build directory alongside the React assets.

Step 3: Electron Builder Packaging

During the final phase, electron-builder reads packages/insomnia/electron-builder.config.js to create native installers. This configuration file defines target platforms, code signing certificates, and extra metadata. The builder packages the compiled files from the build directory into distributable formats ready for deployment.

Critical Configuration Files

Several key files control the production build process:

Summary

  • Use npm run app-build to compile TypeScript, bundle the React UI, and create the /build directory with entry.main.min.js and static assets.

  • Use npm run app-package to generate native installers for all supported platforms using the configuration in electron-builder.config.js.

  • Use npm run package:windows:dist specifically for signed Windows NSIS installers.

  • The build pipeline relies on packages/insomnia/scripts/build.ts for compilation and packages/insomnia/electron-builder.config.js for packaging configuration.

  • No manual webpack or electron commands are required—the npm scripts handle the entire production workflow.

Frequently Asked Questions

What is the difference between app-build and app-package?

The app-build command compiles the source code and prepares the /build directory containing the minified JavaScript and assets, while app-package takes those compiled files and creates the actual native installers (DMG, EXE, AppImage, etc.) using electron-builder. You must run app-build before app-package, though the latter typically ensures a fresh build automatically.

Where are the compiled build artifacts located?

After running npm run app-build, the compiled artifacts reside in packages/insomnia/build, including the entry.main.min.js file and static assets. After running npm run app-package, the final distributable installers appear in the ./dist directory at the repository root.

How do I create a Windows-specific installer?

Run the npm run package:windows:dist command to generate a signed Windows NSIS installer. This command uses platform-specific configuration in packages/insomnia/electron-builder.config.js to handle Windows signing requirements and produce a distributable executable suitable for direct distribution.

Which file controls the electron-builder configuration?

The packages/insomnia/electron-builder.config.js file contains all electron-builder settings, including target platforms (DMG, ZIP, AppImage, DEB, NSIS), code signing configurations, extra resources, and the extraMetadata field that references the compiled entry.main.min.js file.

Have a question about this repo?

These articles cover the highlights, but your codebase questions are specific. Give your agent direct access to the source. Share this with your agent to get started:

Share the following with your agent to get started:
curl -s "https://instagit.com/install.md"

Works with
Claude Codex Cursor VS Code OpenClaw Any MCP Client

Maintain an open-source project? Get it listed too →