explaingit

vercel/pkg

24,370JavaScriptAudience · developerComplexity · 3/5DormantLicenseSetup · easy

TLDR

Bundle a Node.js project into a standalone executable that runs on Windows, macOS, or Linux without requiring Node.js to be installed.

Mindmap

mindmap
  root((pkg))
    What it does
      Bundles Node.js apps
      Creates executables
      Embeds dependencies
      Includes assets
    How it works
      Scans project files
      Traces dependencies
      Compiles to binary
      Outputs cross-platform
    Use cases
      Distribute CLI tools
      Ship commercial apps
      Deploy single file
      No Node.js needed
    Tech stack
      JavaScript
      Node.js runtime
    Audience
      CLI developers
      App distributors

Things people build with this

USE CASE 1

Distribute a command-line tool to non-technical end users as a single downloadable file.

USE CASE 2

Ship a commercial application without exposing your source code to customers.

USE CASE 3

Create a cross-platform CLI that users can download and run instantly without installing Node.js.

USE CASE 4

Deploy a server application as one executable file instead of managing hundreds of dependency folders.

Tech stack

JavaScriptNode.js

Getting it running

Difficulty · easy Time to first run · 5min
Use freely for any purpose, including commercial use, as long as you keep the copyright notice.

In plain English

pkg is a command-line tool that bundles a Node.js project into a standalone executable file, a single program that can run on Windows, macOS, or Linux even on machines that don't have Node.js installed. Normally, sharing a Node.js application requires the recipient to install Node.js and then download all the project's dependencies (often hundreds of files). pkg eliminates that friction entirely. It works by scanning your project's code, tracing all the files and dependencies it needs, compiling the JavaScript into an internal format, and embedding everything, including assets like images or templates, into one self-contained binary. You point it at your entry file or package.json, tell it which platforms to target, and it outputs ready-to-run executables. You would use this when distributing a command-line tool to end users who aren't developers, when shipping a commercial app without exposing your source code, when building a cross-platform CLI that people can download and run instantly, or when deploying a server application as a single file instead of a folder of hundreds of modules. Note: the project has been deprecated as of version 5.8.1 and is now archived. The maintainers recommend exploring Node.js 21's built-in support for single executable applications as a modern alternative. The tool is written in JavaScript and targets the Node.js runtime.

Copy-paste prompts

Prompt 1
How do I use pkg to bundle my Node.js CLI tool into a Windows, macOS, and Linux executable?
Prompt 2
Show me how to configure pkg in my package.json to include asset files like templates or images in the final binary.
Prompt 3
What's the best way to use pkg to distribute a commercial Node.js app without exposing the source code?
Prompt 4
How do I specify which files and dependencies pkg should include when creating a standalone executable?
Open on GitHub → Explain another repo

Generated 2026-05-18 · Model: sonnet-4-6 · Verify against the repo before relying on details.