Fork me on GitHub

A simple web framework
for Java and Kotlin

  • Java
  • Kotlin
import io.javalin.Javalin;

public class HelloWorld {
    public static void main(String[] args) {
        Javalin app = Javalin.create().start(7000);
        app.get("/", ctx -> ctx.result("Hello World"));
    }
}
import io.javalin.Javalin

fun main() {
    val app = Javalin.create().start(7000)
    app.get("/") { ctx -> ctx.result("Hello World") }
}
Microsoft Redhat Uber Telenor Revolut C6 Bank Nordstrom Deutsche Kreditbank

Why Javalin?

Simple

Unlike other Java and Kotlin web frameworks, Javalin has very few concepts that you need to learn. You never extend classes and you rarely implement interfaces.

Lightweight

Javalin is just a few thousand lines of code on top of Jetty, and its performance is equivalent to raw Jetty code. Due to its size, it's very easy to reason about the source code.

Interoperable

Other Java and Kotlin web frameworks usually offer one version for each language. Javalin is being made with inter-operability in mind, apps are built the same way in both Java and Kotlin.

Flexible

Javalin is designed to be simple and blocking, as this is the easiest programming model to reason about. But, if you set a Future as a result, Javalin switches into asynchronous mode.

Educational

Visit our educators page if you're teaching web programming and looking for a web framework which will get out of your way and let you focus on the core concepts of your curriculum.

OpenAPI

Many lightweight Java and Kotlin web frameworks don't support OpenAPI, but Javalin does (including Swagger UI and ReDoc). Learn more at the OpenAPI plugin page.

Jetty

Javalin runs on top of Jetty, one of the most used and stable web-servers on the JVM. You can configure the Jetty server fully, including SSL and HTTP2 and everything else that Jetty offers.

Declare server and API
in the same place

  • Java
  • Kotlin
import io.javalin.Javalin;
import static io.javalin.apibuilder.ApiBuilder.*;

Javalin app = Javalin.create(config -> {
    config.enableCorsForAllOrigins();
    config.asyncRequestTimeout = 10_000L;
    config.enforceSsl = true;
}).routes(() -> {
    path("users", () -> {
        get(UserController::getAll);
        post(UserController::create);
        path("{userId}", () -> {
            get(UserController::getOne);
            patch(UserController::update);
            delete(UserController::delete);
        });
        ws("events", userController::webSocketEvents);
    });
}).start(port);
import io.javalin.Javalin;
import io.javalin.apibuilder.ApiBuilder.*;

val app = Javalin.create { config ->
    config.enableCorsForAllOrigins()
    config.asyncRequestTimeout = 10_000L
    config.enforceSsl = true
}.routes {
    path("users") {
        get(UserController::getAll)
        post(UserController::create)
        path("{userId}") {
            get(UserController::getOne)
            patch(UserController::update)
            delete(UserController::delete)
        }
        ws("events", userController::webSocketEvents)
    }
}.start(port)

Creating a REST API has never been easier

An active community

Javalin Infographic

Javalin 1.0 was released in 2017, and has been in steady development since.

As of June 2021, the project consists of less than 7000 lines of code with more than 10 000 lines of tests. It has more than a hundred contributors, more than four hundred forks, and almost five thousand stars on GitHub. The project has around 110 000 downloads per month, and has has been released 82 times in four years (about two times per month).

Who's using Javalin?

JHU Microsoft Redhat NTNU Pleo Uber Measures for Justice WIT Briar Two Sigma nav Virgil Security Working Group Two Talan Labs Datawire Swatt Telenor Revolut Express Scripts Deutsche Kreditbank C6 Bank Nordstrom Apexar Celer Essential.gg Carilion Clinic

Are you using Javalin? Let us know!

What is Javalin used for?

Check out our current survey results (Fall 2021)
to learn more about how people use Javalin.

Like Javalin?
Star us 😊

×