elide: verb. to omit (a sound or syllable) when speaking. to join together; to merge.
Latest: 1.0.0-alpha11
Elide is a cloud-first polyglot runtime for developing fast web applications. It aims to reduce the barriers between languages and improve performance of existing code, without forcing developers to abandon their favorite APIs and libraries.
Important
Elide is still in alpha, some features are not fully supported and others may fail on certain environments.
You can install the runtime by running:
curl -sSL --tlsv1.2 elide.sh | bash -s -
After installation, you can run elide help
or elide info
to see more information.
You can also use Elide in a container, or in a GitHub Codespace.
docker run --rm -it ghcr.io/elide-dev/elide --help
elide --help
We provide a GitHub Codespace with Elide pre-installed. You can click below to try it out, right from your browser:
The Elide CLI supports JavaScript out of the box, and includes experimental support for Python, while more languages such as Ruby are planned for future releases.
With Elide, you can write your app in any combination of JavaScript, Python, Ruby, and JVM. You can even pass objects between languages, and use off-the-shelf code from multiple dependency ecosystems (e.g. NPM and Maven Central) all without leaving the warm embrace of your running app.
That means fast polyglot code with:
- No network border, no IPC border
- No serialization requirement
Elide supports enough of the Node API to run things like React and MUI. Just like platforms such as Cloudflare Workers and Bun, Elide aims for drop-in compatibility with most Node.js software, but does not aim to be a full replacement.
Elide provides .env
files support at the runtime level, without the need for manual configuration or third-party packages.
Environment variables from .env
files will be picked up and injected into the application using a language-specific API (e.g. process.env
in JavaScript).
Elide, by default, works on a closed-world I/O assumption, meaning that it will not allow access to the host machine's file system unless told to do so. This is a security feature but also an immutability feature which can be used to "seal" your application or perform advanced build caching.
Let's see an example, the following JavaScript application configures a built-in HTTP server and adds a route handler with path variables:
// access the built-in HTTP server engine
const app = Elide.http;
// register a route handler
app.router.handle("GET", "/hello/:name", (request, response, context) => {
// respond using the captured path variables
response.send(200, `Hello, ${context.params.name}`);
});
// configure the server binding options
app.config.port = 3000;
// receive a callback when the server starts
app.config.onBind(() => {
console.log(`Server listening at "http://localhost:${app.config.port}"! 🚀`);
});
// start the server
app.start();
The server can be started with:
> elide serve app.js
> elide 17:43:09.587 DEBUG Server listening at "http://localhost:3000"! 🚀
Important
The Elide HTTP intrinsics are under active development and provide only limited features. We are actively working to improve performance and support more use cases.
The following features are currently planned or under construction:
- Secret management: access secrets as environment variables visible only to your application, decouple your code from secret management SDKs and let the runtime handle that complexity for you.
- Isolated I/O: use pre-packaged archives to provide read-only, sealed Virtual File Systems, allowing access to the host File System only where needed.
- Built-in telemetry: managed, configurable integration with telemetry APIs.
- Native distributions: build your app into a truly native binary using GraalVM's Native Image technology, ship optimized applications without including a runtime in your container.
Elide integrates with Micronaut to provide Server-Side and Hybrid rendering options with very high performance, by running JavaScript code inside your JVM server:
// gradle.properties
elideVersion = 1.0.0-alpha10
// settings.gradle.kts
val elideVersion: String by settings
dependencyResolutionManagement {
versionCatalogs {
create("framework") {
from("dev.elide:elide-bom:$elideVersion")
}
}
}
// then, in your build.gradle.kts files, add the modules you want...
implementation(framework.elide.core)
implementation(framework.elide.base)
implementation(framework.elide.server)
See our samples to explore the features available when integrating with server frameworks, the following code for a server application uses React with Server-Side Rendering:
// server/App.kt
/** State properties for the root page. */
@Props data class HelloProps (
@Polyglot val name: String = "Elide"
)
/** GET `/`: Controller for index page. */
@Page class Index : PageWithProps<HelloProps>(HelloProps::class) {
/** @return Props to use when rendering this page. */
override suspend fun props(state: RequestState) =
HelloProps(name = state.request.parameters["name"] ?: "Elide v3")
// Serve an HTML page with isomorphic React SSR.
@Get("/") suspend fun index(request: HttpRequest<*>) = html(request) {
head {
title { +"Hello, Elide!" }
stylesheet("/styles/base.css")
stylesheet("/styles/main.css")
script("/scripts/ui.js", defer = true)
}
body {
render() // 👈 this line executes javascript without leaving your JVM!
}
}
// Serve styles for the page.
@Get("/styles/main.css") fun styles() = css {
rule("body") {
backgroundColor = Color("#bada55")
}
rule("strong") {
fontFamily = "-apple-system, BlinkMacSystemFont, sans-serif"
}
}
// Serve the built & embedded JavaScript.
@Get("/scripts/ui.js") suspend fun js(request: HttpRequest<*>) = script(request) {
module("scripts.ui")
}
}
By evaluating the JavaScript code built using a Kotlin/JS browser app:
// client/main.kt
// React props for a component
external interface HelloProps: Props {
var name: String
}
// React component which says hello
val HelloApp = FC<HelloProps> { props ->
div {
strong {
+props.name
}
}
}
// Entrypoint for the browser
fun main() {
hydrateRoot(
document.getElementById("root"),
Fragment.create() {
HelloApp {
name = "Elide"
}
}
)
}
Note
More versatile integration with frameworks like Micronaut and Ktor is planned but not yet supported. The API and packages used for these integrations may change as we add more features.
The following version matrix indicates tested support across tool and platform versions, including Java, Kotlin, GraalVM, Micronaut, and React.
Following this guide is recommended but optional. Depending on the style of development you're doing with Elide, you may not need some of these components:
The following version matrix describes language support for Elide, including JavaScript, Python, Ruby, WASM, and experimental languages (LLVM, JVM) and future languages which could be supported based on the architecture:
For officialy supported languages, rough benchmarks are shown below, for server performance, language performance, and startup time:
Language | Server | Language | Startup |
---|---|---|---|
JavaScript | ~660K RPS (75x vs. Node 20) |
(Unavailable) | ~0.5s |
Python | (Unavailable) | Up to ~3.0x CPython |
~0.5s |
Ruby | (Unavailable) | Up to ~22.4x CRuby |
~1.5s |
Note
Newer languages don't have clear benchmarks yet; more are coming soon.
Elide itself is licensed under MIT as of November 2022. Dependencies are scanned for license compatibility; the report is available via FOSSA:
Building and using Elide with Oracle GraalVM requires license compliance through Oracle. For more information, see the GraalVM website.
Code coverage is continuously reported to Codecov and SonarCloud:
Issue reports and pull requests are welcome! See our contribution guidelines or join our discord community and let us know which features you would like to see implemented, or simply participate in the discussions to help shape the future of the project.