Introduction
What’s Astra?
Astra is a windows js to exe compiler. It’s compiles your javascript code to a standalone executable file.
Use Cases
- Make a commercial application without source code.
- Use your node.js application on a machine without node.js installed.
- For apps like installers, updaters, etc.
- Make a trial/demo version of your application.
Everything you have to know
- Astra is compiling to windows only for now. (working on macOS and linux)
- Astra is using Node SEA (Single Executable Applications) to compile your code. It’s still an experimental feaurte and things may crash unexpectedly.
- Average size of the executable is around 70~80 MB. (depends on your code)
Unsupported depencencies (to have used in your code)
- esbuild
- bcrypt
- sharp
- sqlite3
- better-sqlite3
- canvas
- serialport
- ffi-napi
- @node-rs/bcrypt
- keytar
- robotjs
- node-notifier
- puppeteer
- playwright
- cypress
- node-sass (deprecated)
- edge-js
And other using native solutions (.h
, .node
, .dll
, .so
, .dylib
, .exe
) or native modules.
But… why?
Astra uses esbuild to bundle your code. esbuild is a great bundler, but it doesn’t support native modules and leaves them unbundled (external).
Why Astra?
Astra is designed to build standalone executables effortlessly. I wanted simple tool to compile my source code to exe without any hassle, and I couldn’t find one. So, I built one.
Why… not?
nexe
Nexe is a great tool, but it’s not as simple as Astra.
- it’s biggest cons is that it’s not supporting latest vesions of node.js.
- poorly supprots esm.
Use it instead of Astra if:
- You are using older version of node.js and have cjs project
pkg
pkg is a great tool, i used it for a long time.
- it’s biggest cons is it generates heavy executables.
- it’s not supporting esm.
Use it instead of Astra if:
- You are not concerned about the size of the executable.
- You are not using esm.
- You are using older version of node.js.
Under the hood
Astra uses native method of compilation called Node SEA (Single Executable Applications) to compile your source code to exe. Astra is wrapper around Node SEA, with some additional features. Astra injects your code into node.exe file with postject.
For bundling, Astra uses esbuild. It’s the best bundler out on npm.
For editing icon and metadata, Astra uses rcedit.