Where to Find Insomnia’s Build Process in `package.json`: Complete Guide to Scripts and Workflows
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 and 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 files, making it easy to understand how the Kong/insomnia repository compiles, packages, and tests the application using industry-standard tools.
Root package.json Build Orchestration
The repository root contains a 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 contains these critical build scripts:
dev: Starts the Vite development server for the renderer and watches the main process for changesbuild: Produces a production-ready bundle using Vite plus the Electron packagerlint: Runs ESLint across all workspaces to enforce code qualitytype-check: Executestsc --noEmitfor TypeScript validation throughout the entire repositorytest: Runs Vitest unit tests for all packages in the monorepo
# 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 with granular build scripts for the renderer and main processes.
Renderer and Main Process Scripts
The 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 enabledbuild:renderer: Bundles the React UI for production with minificationbuild:main: Packages the Electron main process for distribution
# 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 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: Contains thetestscript that runs Vitest for testing utilitiespackages/insomnia-smoke-test/package.json: Definestest:smoke:devfor executing Playwright smoke tests against development builds
# 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: Configures the Vite build for the React rendererelectron-builder.yml: Defines packaging settings used by the production build scriptstsconfig.json: TypeScript configuration used by thetype-checkscript
Typical Build Workflow
When you execute npm run build from the root, the following sequence occurs:
- The renderer is bundled using Vite (minified, hashed assets)
- The Electron main process is compiled and packaged via
electron-builder - Installable binaries are generated for macOS, Windows, and Linux
# Complete production build pipeline
npm run build
# Results in packaged applications in the dist/ directory
Summary
- Root
package.jsoncontains high-level scripts (dev,build,lint,type-check,test) that orchestrate the entire monorepo packages/insomnia/package.jsondefines 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.jsonfiles, 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. 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. This command runs the Playwright test suite against a development build to validate core application functionality before release.
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:
curl -s "https://instagit.com/install.md" Maintain an open-source project? Get it listed too →