# 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.

Elide runs JavaScript and TypeScript with Node APIs and npm packages. Check your application's modules and framework
before switching.

## Check your application

For an HTTP app, start with [framework compatibility](https://elide.help/docs/http-service#frameworks): Hono has a runnable example;
Express 5 has body-middleware limitations; Fastify 5 imports an unavailable module. Check the
[API Overview](https://elide.help/docs/api-overview) for other `node:*` modules your app imports.

The [Compatibility Matrix](https://elide.help/docs/compatibility) reports API test-suite results. Run your application's tests and exercise
its request handlers to check the dependencies and code paths you use.

## Run the same code

```bash
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 })`.

For a complete first example, follow [JavaScript and TypeScript](https://elide.help/docs/web). For a server, follow
[Build an HTTP service](https://elide.help/docs/http-service). If an installed package cannot be imported, see
[Module not found after `elide install`](https://elide.help/docs/troubleshooting#module-not-found-after-elide-install).

## What changes

| Node | Elide |
| --- | --- |
| `node app.js` | `elide app.js` |
| `npm install` | `elide install --ecosystems=npm`; plain `elide install` skips npm |
| `package-lock.json` | `aube-lock.yaml` |
| `npm run build` | `elide run build` |
| `npx tool` | `elide run tool` for a tool in `node_modules/.bin`; no download-and-run |
| `node --test` | `elide test` |
| `node --inspect app.js` | `elide run --debugger=cdp app.js` |
| `node --watch app.js` | No equivalent |
| `node --env-file=.env app.js` | Call `process.loadEnvFile()` in code |
| `node --permission --allow-fs-read=.` | `elide --allow-read=. app.js`; see [Sandbox and Limits](https://elide.help/docs/sandbox) |
| `node:worker_threads` | Same module; `new Worker` honors only `workerData`, `eval`, `transferList` and `env` |
| `node:sqlite` `DatabaseSync` | `Database` from `elide:sqlite`; see [SQLite](https://elide.help/docs/api-sqlite#nodesqlite-and-bunsqlite) |

Elide does not set `NODE_ENV`.

## Weaknesses

- `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.

## Benchmarks

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

| Runtime | Command | Mean |
| --- | --- | --- |
| Node | `node hello.js` | 11.70 ± 0.90 ms |
| Elide | `elide run hello.js` | 1.43 ± 0.06 ms |
| Bun | `bun hello.js` | 1.63 ± 0.18 ms |
| Deno | `deno run hello.js` | 6.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](https://elide.help/docs/benchmarks#http-serving) for the settings, latency, and raw reports.

Versions, setup, and recordings: [Benchmarks](https://elide.help/docs/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`.

## Next steps

- [Installation](https://elide.help/docs/installation)
- [JavaScript and TypeScript](https://elide.help/docs/web)
- [Build an HTTP service](https://elide.help/docs/http-service)
- [Troubleshooting](https://elide.help/docs/troubleshooting)
- [Sandbox and Limits](https://elide.help/docs/sandbox)
