Getting Started with Elide

Elide can be as small as a command that runs one source file, or the tool that coordinates an entire project. This tour starts with a useful script, grows it into a service, and shows the commands you’ll use once the work becomes a team project.

Before you begin

Confirm Elide is available, then keep this page open as you try the examples locally.

elide --version

Choose a workflow

Use an Elide project when commands, dependencies, and outputs need to be repeatable. For quick experiments, you can also run a supported source file directly without creating a project.

Work in a project

A project gives Elide an entrypoint, source sets, dependencies, and a build graph. It is also how Java and Kotlin applications become part of the same workflow.

elide init

Run a source file

JavaScript, TypeScript, and Python files can run directly. Elide chooses the language from the file and forwards arguments after the separator.

elide run <source-file> -- <optional-arguments>
Example #1

Run a useful TypeScript script

This script reads an order export, calculates paid revenue per customer, and writes a machine-readable report. It uses TypeScript, top-level await, Node-compatible filesystem promises, and command-line arguments in one file.

report.ts
typescript
import { readFile, writeFile } from "node:fs/promises";
type Order = {  customer: string;  total: number;  status: "paid" | "pending";};
const [input = "orders.json", output = "report.json"] =  process.argv.slice(2);
const orders: Order[] = JSON.parse(await readFile(input, "utf8"));const paidOrders = orders.filter((order) => order.status === "paid");
const revenueByCustomer = paidOrders.reduce<Record<string, number>>(  (totals, order) => {    totals[order.customer] = (totals[order.customer] ?? 0) + order.total;    return totals;  },  {},);
const report = {  generatedAt: new Date().toISOString(),  paidOrders: paidOrders.length,  totalRevenue: paidOrders.reduce((sum, order) => sum + order.total, 0),  revenueByCustomer,};
await writeFile(output, JSON.stringify(report, null, 2) + "");console.log(`Wrote revenue from ${report.paidOrders} orders to ${output}`);
NORMALreport.tsutf-8 · typescript · 32L
Add a sample orders.json
orders.json
json
[  { "customer": "Aster Labs", "total": 128.5, "status": "paid" },  { "customer": "Northstar", "total": 84, "status": "pending" },  { "customer": "Aster Labs", "total": 215, "status": "paid" },  { "customer": "Northstar", "total": 49.5, "status": "paid" }]
NORMALorders.jsonutf-8 · json · 6L
elide run report.ts -- orders.json report.json
  • No separate transpile command for TypeScript
  • Node-compatible filesystem imports
  • Arguments available through process.argv
  • Async work at the top level

Turn it into a service

Elide’s server API uses familiar Request, Response, URL, and JSON primitives. This in-memory notes service has collection reads, creation, health reporting, status codes, and a fallback route.

server.ts
typescript
type Note = { id: number; text: string; done: boolean };
const notes = new Map<number, Note>();let nextId = 1;
Elide.serve({  port: 3000,  async fetch(request) {    const url = new URL(request.url);
    if (request.method === "GET" && url.pathname === "/notes") {      return Response.json([...notes.values()]);    }
    if (request.method === "POST" && url.pathname === "/notes") {      const { text } = await request.json();      const note = { id: nextId++, text, done: false };      notes.set(note.id, note);      return Response.json(note, { status: 201 });    }
    if (request.method === "GET" && url.pathname === "/health") {      return Response.json({ ok: true, notes: notes.size });    }
    return new Response("Not found", { status: 404 });  },});
NORMALserver.tsutf-8 · typescript · 28L
elide dev server.ts

elide dev runs the subject in development mode and watches for file changes. Useelide servewhen you want the same subject without the development watcher.

The daily project loop

Once a repository has an Elide project, the same commands can cover multiple language ecosystems. Installation discovers npm, PyPI, and Maven dependencies; build tasks handle the configured source sets and artifacts.

bash
elide project info       # Inspect the project Elide discoveredelide install            # Resolve npm, PyPI, and Maven dependencieselide dev src/server.ts  # Run with file watching during developmentelide format             # Format the project's supported sourceselide test               # Run the configured test sourceselide build              # Execute the project's default build graphelide build --inspect    # See available build tasks and their options

Dependencies

One install command can resolve every ecosystem discovered in the workspace.

Build & quality

Formatting, testing, and build tasks use the project’s declared sources and tools.

Run & develop

Run an entrypoint directly or keep a subject live with the development watcher.

Where to go next