Zum Inhalt springen

Diese Seite ist noch nicht übersetzt und wird auf Englisch angezeigt.

Elide for Node users

Switching from Node.js to Elide: what runs unchanged, which commands and APIs change, TypeScript without a compile step, benchmarks and trade-offs.

Auf dieser Seite

Elide runs Node programs, node:* modules and npm packages; this page lists what changes when you switch.

Run the same code

elide app.js                    # or: elide run app.js
elide app.ts                    # no compile step, no tsconfig.json
elide install --ecosystems=npm  # dependencies from package.json
elide test                      # node:test files
  • Built-ins load with or without the node: prefix.
  • CommonJS and ES modules both work.
  • http.createServer serves as in Node, as does a module that default-exports a fetch handler or calls Elide.serve({ fetch }).

See JavaScript and TypeScript, module status in the API Overview, and suite results in the Compatibility Matrix.

What changes

NodeElide
node app.jselide app.js
npm installelide install --ecosystems=npm; plain elide install skips npm
package-lock.jsonaube-lock.yaml
npm run buildelide run build
npx toolelide run tool for a tool in node_modules/.bin; no download-and-run
node --testelide test
node --inspect app.jselide run --debugger=cdp app.js
node --watch app.jsNo equivalent
node --env-file=.env app.jsCall process.loadEnvFile() in code
node --permission --allow-fs-read=.elide --allow-read=. app.js; see Sandbox and Limits
node:worker_threadsSame module; new Worker honors only workerData, eval, transferList and env
node:sqlite DatabaseSyncDatabase from elide:sqlite; see SQLite

Elide does not set NODE_ENV.

Benchmarks

Hello-world startup with hyperfine -N -w 10 -r 100 on a 24-core AMD Ryzen Threadripper PRO 9965WX Linux workstation:

RuntimeCommandMean
Nodenode hello.js11.70 ± 0.90 ms
Elideelide run hello.js1.43 ± 0.06 ms
Bunbun hello.js1.63 ± 0.18 ms
Denodeno run hello.js6.31 ± 0.30 ms

Elide’s measured mean is lower than Bun’s in this recording. In the separate non-pipelined HTTP comparison, Elide served 635,510 requests/s and Node 24.22.0 LTS served 123,519 requests/s with the same load and CPU budget. See HTTP serving for the settings, latency, and raw reports.

Versions, setup, and recordings: Benchmarks.

Strengths

  • Runs .ts, .mts and .cts files directly.
  • Scopes network access by host and subprocesses by command: --allow-net=api.example.com, --allow-run=git.
  • Limits workers, open files, heap and run time: --limit=workers=4, --limit=fds=128, --max-mem=512m, --timeout=30s.
  • Includes SQLite, PostgreSQL and MySQL drivers as elide:sqlite, elide:postgres and elide:mysql.

Weaknesses

  • Node-API compatibility is 86.8% and WinterTC 95.9% on their test suites.
  • node:http2, node:cluster, node:inspector and node:wasi throw ERR_UNKNOWN_BUILTIN_MODULE.
  • https.createServer throws ERR_HTTPS_SERVER_UNSUPPORTED; terminate TLS in front of http.createServer.
  • No WebSocket global.
  • No bundler: elide web build transforms each file and keeps its imports.
  • No macOS Intel build; macOS releases are Apple Silicon only.

Next steps

War diese Seite hilfreich?