Elide

0

elide: verb. to omit (a sound or syllable) when speaking. to join together; to merge.

Infrastructure

kotlin
multiplatform
graalvm
jvm

Elide

elide: verb. to omit (a sound or syllable) when speaking. to join together; to merge.


Code of Conduct
Python 3.11.x

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.

Installation

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.

Other ways to try Elide

You can also use Elide in a container, or in a GitHub Codespace.

Using Elide via Docker

docker run --rm -it ghcr.io/elide-dev/elide --help
elide --help

Using Elide via GitHub Codespaces

We provide a GitHub Codespace with Elide pre-installed. You can click below to try it out, right from your browser:

Open in GitHub Codespaces

Features

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.

Multi-language

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

"Just enough" Node API support

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.

Dotenv support

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

Closed-world I/O

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.

Server engine

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.

Planned features

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.

Use with server frameworks

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.

Version compatibility

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:

StatusJavaKotlinGraalVMMicronautReactProtobuf/gRPC
StatusJava 232.0.024.1.x4.4.x19.x3.25.2/1.61.0
StatusJava 212.0.0-Beta423.1.x4.3.x18.x3.25.2/1.61.0
StatusJava 201.9.2023.0.x4.0.x18.x3.21.11/1.56.1
StatusJava 201.9.1023.0.x3.11.x18.x3.21.11/1.56.1
StatusJava 171.8.2022.3.x3.9.x18.x3.21.11/1.42.0
StatusJava 111.7.2222.3.x3.5.x18.x3.20.1/1.46.0
StatusJava 8-10----------

Language support

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:

LanguageStatusVersionElide releaseSandboxingServerCoverageVFSDebugger
JavaScriptStatusECMA 2023alpha4+✅ Full support
WebAssemblyStatusWASI P2alpha4+✅ (With JS)✅ (With JS)
PythonStatus3.11.xalpha7+Not supportedNot supported⚠️
RubyStatus3.2alpha8+Not supportedNot supported⚠️
JavaStatusJava 22edge✅ Partial supportNot supportedExperimentalExperimental
KotlinStatusJava 22edge✅ Partial supportNot supportedExperimentalExperimental
LLVMStatus12.0.1edge⚠️ Requires licenseNot supportedNot supportedN/A
TypeScriptStatus5.x.xFuture releaseN/AN/AN/AN/AN/A
CUDAStatusN/AFuture releaseN/AN/AN/AN/AN/A
PHPStatus7.xFuture releaseN/AN/AN/AN/AN/A
.NETStatusECMA 335Future releaseN/AN/AN/AN/AN/A
GroovyStatus4.0.xFuture releaseN/AN/AN/AN/AN/A
ScalaStatus3.4.xFuture releaseN/AN/AN/AN/AN/A

Performance

For officialy supported languages, rough benchmarks are shown below, for server performance, language performance, and startup time:

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

Reports

Licensing

Elide itself is licensed under MIT as of November 2022. Dependencies are scanned for license compatibility; the report is available via FOSSA:

FOSSA Status

Building and using Elide with Oracle GraalVM requires license compliance through Oracle. For more information, see the GraalVM website.

Coverage

Code coverage is continuously reported to Codecov and SonarCloud:

Coverage grid

Contributing

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.

Star History

Star History Chart