This project demonstrates how to create a Single Executable Application (SEA) using Node.js. SEAs allow you to bundle your Node.js application into a single binary executable, making it easier to distribute and run without requiring Node.js installation on the target machine. For more information about SEAs, see the official Node.js documentation.
Stability note: SEA is still listed as Experimental (1.1 – Active development) in the Node.js docs, not Stable — treat it accordingly, even though it's functional enough for real use.
- Node.js 26 or later (see
.nvmrc) — required for the one-stepnode --build-seabuilder introduced in v25.5.0. It has not been backported to the Node 24 "Krypton" LTS line as of this writing; Node 26 becomes Active LTS in October 2026. If you're stuck on an older Node, see Building on older Node versions below. - macOS, Windows, or Linux (any distro except Alpine; any arch except s390x). On macOS, only arm64 is officially tested by Node — x64 is not currently covered.
- npm (Node Package Manager)
.
├── hello.ts # Main application entry point
├── lib/ # Application modules
│ ├── greeter.ts # Example module
│ └── greeter.test.ts # Tests (node:test)
├── assets/ # Files embedded into the binary via sea-config.json
│ └── greeting.txt
├── dist/ # Build output directory
│ ├── bundled/ # Contains bundled application
│ ├── hello # The final SEA executable (hello.exe on Windows)
│ └── transpiled/ # Contains compiled TypeScript
├── .github/workflows/ci.yml # Lint + cross-platform build matrix
├── build-bundle.js # esbuild bundling script
├── build-sea.js # SEA creation script
├── sea-config.json # SEA configuration
├── biome.json # Lint/format config
└── tsconfig.json # TypeScript configuration
-
Clone this repository:
git clone <repository-url> cd node-sea
-
Install dependencies:
npm install
-
The project uses TypeScript for type safety. The main application code is in
hello.ts. -
To run the application in development mode:
npm start
The build process consists of several steps, all automated through npm scripts:
-
Clean the previous build:
npm run clean
-
Build everything in one go:
npm run build:all
Or, you can run each step individually:
-
Compile TypeScript:
npm run build:js
This compiles TypeScript files to JavaScript in the
dist/transpileddirectory. -
Bundle the application:
npm run build:bundle
This uses esbuild to bundle all dependencies into a single file at
dist/bundled/bundle.js. -
Create the SEA binary:
npm run build:sea
This script runs
node --build-sea sea-config.json, which generates the blob, copies the Node.js binary, and injects the code in one step, then signs the result on macOS.
After building, you'll find an executable named hello in the dist directory. You can run it with or without parameters:
./dist/hello FAF
Hello, FAF!
This message was bundled directly into the binary via sea-config.json's "assets" field — no external file was shipped alongside the executable to read it from.This binary contains everything needed to run your application, including the Node.js runtime. The second line comes from assets/greeting.txt, embedded at build time and read back via node:sea — see below.
The project uses TypeScript for type safety. The tsconfig.json configures the compilation process, outputting to dist/transpiled.
The build-bundle.js script uses esbuild to:
- Bundle all dependencies
- Minify the code
- Generate source maps
- Output a single file in CommonJS format
The build-sea.js script handles the SEA creation process:
- Runs
node --build-sea sea-config.json, which generates the blob, copies the Node.js binary, and injects the code into it — all internally, using the same LIEF-based logic that used to live in the externalpostjecttool (now folded into Node core and no longer needed as a dependency) - Signs the resulting binary (macOS specific)
sea-config.json also enables useCodeCache, which pre-compiles the bundle to V8 bytecode at build time for a faster cold start, and demonstrates assets: assets/greeting.txt is embedded into the binary at build time and read back at runtime in hello.ts via node:sea's isSea() / getAsset(). It only prints when actually running as a SEA — npm start (plain ts-node, not a SEA) skips it. Another option worth knowing about: useSnapshot (V8 heap snapshot for even faster startup — not used here, since it requires restructuring the entry point around v8.startupSnapshot) and execArgv (bake in default CLI flags).
If you're on Node 24 LTS or earlier, --build-sea doesn't exist yet — use the legacy manual flow instead (blob generation + postject injection + codesign), as documented in the Node.js SEA docs for your version. This repo only implements the modern one-step flow.
- Modify
hello.tsand files inlib/for your application logic - Update
sea-config.jsonif you change the entry point - Adjust
build-bundle.jsfor different bundling options - Modify
build-sea.jsfor platform-specific requirements
- The SEA binary is platform-specific; you'll need to build it on each target platform. CI builds and smoke-tests it on Linux, macOS, and Windows on every push/PR (see
.github/workflows/ci.yml). - Source maps are included for debugging, but not used in the final SEA
ISC
Done so far: unit tests (node:test), CI with a cross-platform build matrix (GitHub Actions), and linting/formatting (Biome). Still open:
-
Testing
- Integration/end-to-end tests for the built binary itself, beyond the CI smoke test
- Test coverage reporting
-
Release automation
- Automated release management (tag → build matrix → attach binaries to a GitHub Release)
-
Code Quality
- Watch
ts-nodefor TypeScript 7 (native Go compiler, GA July 2026) support before upgrading past TS 5.9 — TS 7 shipped without a stable programmatic API, whichts-nodedepends on - Pre-commit hooks (e.g. via Biome's own git hooks support)
- Watch
-
Documentation
- Add JSDoc documentation for all functions
- Create contribution guidelines
-
Performance
- Add performance/startup-time benchmarking
- Consider
useSnapshotfor faster cold starts (seesea-config.jsondiscussion above)
Contributions are welcome! Please feel free to submit a Pull Request.
- Node.js Single Executable Applications Documentation - Official documentation for creating and working with SEAs