# Where to Find Insomnia’s Build Process in `package.json`: Complete Guide to Scripts and Workflows

> Discover Insomnia's build process in package.json. Find detailed scripts for development servers, bundling, linting, and testing in this comprehensive guide.

- Repository: [Kong/insomnia](https://github.com/Kong/insomnia)
- Tags: how-to-guide
- Published: 2026-06-27

---

**Yes, Insomnia’s complete build pipeline—including development servers, production bundling, linting, and testing—is defined in the `scripts` sections of the root [`package.json`](https://github.com/Kong/insomnia/blob/main/package.json) and [`packages/insomnia/package.json`](https://github.com/Kong/insomnia/blob/main/packages/insomnia/package.json) files.**

Insomnia is an open-source API client built as an Electron application using a monorepo architecture organized under the `packages/` directory. All build-related commands and workflows are centrally configured in these [`package.json`](https://github.com/Kong/insomnia/blob/main/package.json) files, making it easy to understand how the Kong/insomnia repository compiles, packages, and tests the application using industry-standard tools.

## Root [`package.json`](https://github.com/Kong/insomnia/blob/main/package.json) Build Orchestration

The repository root contains a [`package.json`](https://github.com/Kong/insomnia/blob/main/package.json) that orchestrates workspace-wide build tasks. This file defines the primary entry points for developers contributing to the codebase.

### Primary Development and Build Scripts

According to the source code, the root [`package.json`](https://github.com/Kong/insomnia/blob/main/package.json) contains these critical build scripts:

- **`dev`**: Starts the Vite development server for the renderer and watches the main process for changes
- **`build`**: Produces a production-ready bundle using Vite plus the Electron packager
- **`lint`**: Runs ESLint across all workspaces to enforce code quality
- **`type-check`**: Executes `tsc --noEmit` for TypeScript validation throughout the entire repository
- **`test`**: Runs Vitest unit tests for all packages in the monorepo

```bash

# Start the full development environment

npm run dev

# Create a production build

npm run build

# Validate code quality across the monorepo

npm run lint
npm run type-check

```

## Application-Specific Build Configuration

The core Electron application resides in `packages/insomnia/`, which contains its own [`package.json`](https://github.com/Kong/insomnia/blob/main/package.json) with granular build scripts for the renderer and main processes.

### Renderer and Main Process Scripts

The [`packages/insomnia/package.json`](https://github.com/Kong/insomnia/blob/main/packages/insomnia/package.json) defines separate scripts for the Electron main process and the React-based renderer:

- **`dev:renderer`**: Starts the Vite dev server for the UI (React + Tailwind)
- **`dev:main`**: Launches the Electron main process with hot-reloading enabled
- **`build:renderer`**: Bundles the React UI for production with minification
- **`build:main`**: Packages the Electron main process for distribution

```bash

# Run only the renderer development server

npm run dev:renderer --workspace=packages/insomnia

# Build only the main process (useful for CI debugging)

npm run build:main --workspace=packages/insomnia

```

## Testing and Quality Assurance Scripts

Beyond build tasks, the [`package.json`](https://github.com/Kong/insomnia/blob/main/package.json) files define comprehensive testing workflows using Vitest for unit tests and Playwright for end-to-end validation.

### Test Script Locations

- **[`packages/insomnia-testing/package.json`](https://github.com/Kong/insomnia/blob/main/packages/insomnia-testing/package.json)**: Contains the `test` script that runs Vitest for testing utilities
- **[`packages/insomnia-smoke-test/package.json`](https://github.com/Kong/insomnia/blob/main/packages/insomnia-smoke-test/package.json)**: Defines `test:smoke:dev` for executing Playwright smoke tests against development builds

```bash

# Run unit tests across all packages

npm test

# Execute smoke tests against a development build

npm run test:smoke:dev --workspace=packages/insomnia-smoke-test

```

## Build Pipeline Architecture

Understanding how these scripts interact clarifies Insomnia’s build architecture. The process relies on **Vite** for the renderer build and **Electron Builder** for packaging the main process.

### Key Configuration Files

The build scripts reference several configuration files in the repository:

- **[`packages/insomnia/vite.config.ts`](https://github.com/Kong/insomnia/blob/main/packages/insomnia/vite.config.ts)**: Configures the Vite build for the React renderer
- **[`electron-builder.yml`](https://github.com/Kong/insomnia/blob/main/electron-builder.yml)**: Defines packaging settings used by the production build scripts
- **[`tsconfig.json`](https://github.com/Kong/insomnia/blob/main/tsconfig.json)**: TypeScript configuration used by the `type-check` script

### Typical Build Workflow

When you execute `npm run build` from the root, the following sequence occurs:

1. The renderer is bundled using Vite (minified, hashed assets)
2. The Electron main process is compiled and packaged via `electron-builder`
3. Installable binaries are generated for macOS, Windows, and Linux

```bash

# Complete production build pipeline

npm run build

# Results in packaged applications in the dist/ directory

```

## Summary

- **Root [`package.json`](https://github.com/Kong/insomnia/blob/main/package.json)** contains high-level scripts (`dev`, `build`, `lint`, `type-check`, `test`) that orchestrate the entire monorepo
- **[`packages/insomnia/package.json`](https://github.com/Kong/insomnia/blob/main/packages/insomnia/package.json)** defines granular scripts for the Electron main process (`dev:main`, `build:main`) and renderer (`dev:renderer`, `build:renderer`)
- **Vite** handles the React UI compilation while **Electron Builder** packages the main process
- **Testing scripts** are distributed across workspace packages, with Vitest for unit tests and Playwright for smoke tests
- All build entry points are npm scripts defined in [`package.json`](https://github.com/Kong/insomnia/blob/main/package.json) files, making the build process transparent and reproducible

## Frequently Asked Questions

### What is the difference between `npm run dev` and `npm run build` in Insomnia?

`npm run dev` starts development servers with hot-reloading enabled, launching the Vite dev server for the renderer alongside the Electron main process. `npm run build` creates a production-ready bundle with minified assets and packaged binaries suitable for distribution, using Vite for the renderer and Electron Builder for the main process.

### Where are the Electron-specific build scripts defined?

The Electron-specific scripts are located in [`packages/insomnia/package.json`](https://github.com/Kong/insomnia/blob/main/packages/insomnia/package.json). This file contains `dev:main` and `build:main` for the main process, as well as `dev:renderer` and `build:renderer` for the UI, allowing independent builds of each component.

### How do I run only the renderer build without compiling the main process?

Navigate to the `packages/insomnia/` directory or use the workspace flag to run `npm run build:renderer`. This script executes Vite to bundle only the React frontend without triggering the Electron main process compilation, which is useful for debugging UI-specific build issues.

### Which script runs the smoke tests in Insomnia?

The smoke tests are executed via the `test:smoke:dev` script defined in [`packages/insomnia-smoke-test/package.json`](https://github.com/Kong/insomnia/blob/main/packages/insomnia-smoke-test/package.json). This command runs the Playwright test suite against a development build to validate core application functionality before release.