Elide runs JavaScript and TypeScript directly, with CommonJS, ES modules, and a subset of the Node and Web APIs. This quickstart builds a small greeting program, adds an npm dependency, and tests the greeting.
Bringing an existing app? Start with Elide for Node users and the framework compatibility table.
Install
Install Elide, open a new terminal, then check:
elide --version
If the command is not found, follow Verify the install.
Run a file
TypeScript runs as written
No compile step and no tsconfig.json: elide app.ts runs the file.
mkdir hello-elide
cd hello-elide
Save this as app.ts:
const name: string = "Ada";
console.log(`Hello, ${name}!`);
elide run app.ts
Hello, Ada!
You can also use elide app.ts. For JavaScript, remove : string and save the file as app.js.
~/demo bat greet.ts
───────┬────────────────────────────────────────────────────────────────────────────────────────────
│ File: greet.ts
│ Size: 253 B
───────┼────────────────────────────────────────────────────────────────────────────────────────────
1 │ interface User {
2 │ id: number;
3 │ name: string;
4 │ }
5 │
6 │ const greet = (user: User): string => `Hello, ${user.name}!`;
7 │
8 │ const users: User[] = [
9 │ { id: 1, name: "Ada" },
10 │ { id: 2, name: "Linus" },
11 │ ];
12 │
13 │ for (const user of users) {
14 │ console.log(greet(user));
15 │ }
───────┴────────────────────────────────────────────────────────────────────────────────────────────
~/demo elide ./greet.ts
Hello, Ada!
Hello, Linus!
npm packages
Create package.json in the same directory:
{
"type": "module",
"dependencies": { "zod": "3.24.1" }
}
Install the dependency:
elide install --ecosystems=npm
Plain elide install installs Maven dependencies and skips npm. If an import cannot find its package, check
Module not found after elide install.
Save the greeting logic as greeting.ts:
import { z } from "zod";
const User = z.object({ name: z.string() });
export function greeting(user: unknown): string {
return `Hello, ${User.parse(user).name}!`;
}
Replace app.ts with:
import { greeting } from "./greeting.ts";
console.log(greeting({ name: "Ada" }));
elide run app.ts
Hello, Ada!
This confirms the installed package imports and validates the input.
~/demo elide install --ecosystems=npm
[479ms] ✓ NPM packages installed (477ms)
[481ms] ✓ Dependencies installed in 481ms
~/demo elide run app.ts
Hello, Ada!
Packages go into node_modules. If the project also has Maven dependencies, use --ecosystems=maven,npm or
--workspace. Lockfiles and options: NPM Installer.
Tests
Create greeting.test.ts beside the other files. elide test discovers *.test.ts files and runs node:test tests:
import test from "node:test";
import assert from "node:assert";
import { greeting } from "./greeting.ts";
test("greets a named user", () => {
assert.equal(greeting({ name: "Ada" }), "Hello, Ada!");
});
test("rejects a user without a name", () => {
assert.throws(() => greeting({}));
});
elide test
Both tests should pass. If no tests are found, check the filename and run the command from hello-elide.
More discovery rules and runner options: Testing.
Servers
Continue with Build an HTTP service for a complete server you can run and query. For an existing directory of web files:
elide serve --no-tui ./dist # static files on 127.0.0.1:8080
elide dev --no-tui ./src # port 3000; pages reload on change
Given a script, serve and dev run it; a module that exports a fetch handler is served directly. See
Development Server.
Executable scripts
On macOS and Linux, start a file with #!/usr/bin/env elide and mark it executable:
#!/usr/bin/env elide
const name: string = process.argv[2] ?? "world";
console.log(`Hello, ${name}!`);
Save it as hello.ts, then run:
chmod +x hello.ts
./hello.ts Ada
The output is Hello, Ada!. The same first line works for .js, .mjs and .py files.
Samples
More
Extensions: .js, .mjs, .cjs, .jsx, .ts, .mts, .cts, .tsx. JSX and TSX are transformed; install the
runtime they import, such as react/jsx-runtime. Elide provides no UI framework or DOM. See
TypeScript and modules for module resolution and type checking.
Implemented Node and Web modules: API Overview. SQLite, PostgreSQL and MySQL drivers:
Databases. Measured results:
Compatibility Matrix. Traces, metrics, and logs through @opentelemetry/api, with no SDK:
OpenTelemetry in JavaScript.