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 initElide 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.
Confirm Elide is available, then keep this page open as you try the examples locally.
elide --versionUse 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.
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 initJavaScript, 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>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.
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}`);
[ { "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" }]
elide run report.ts -- orders.json report.jsonElide’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.
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 }); },});
elide dev server.tselide dev runs the subject in development mode and watches for file changes. Useelide servewhen you want the same subject without the development watcher.
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.
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
One install command can resolve every ecosystem discovered in the workspace.
Formatting, testing, and build tasks use the project’s declared sources and tools.
Run an entrypoint directly or keep a subject live with the development watcher.