Javalin – Simple REST APIs for Java and Kotlin

Javalin is a very lightweight web framework for Kotlin and Java, inspired by Sparkjava and koa.js. Javalin is written in Kotlin with a few functional interfaces written in Java. This was necessary to provide an enjoyable and near identical experience for both Kotlin and Java developers.

Javalin is really more library than framework; you don’t need to extend or implement anything and there are very few “Javalin-concepts” you have to learn.

REST API Simplicity

Javalin started as a fork of the Spark Java and Kotlin web framework but quickly turned into a ground-up rewrite influenced by koa.js. All of these web frameworks are inspired by the modern micro web framework grandfather: Sinatra, so if you’re coming from Ruby then Javalin shouldn’t feel too unfamiliar.

Javalin is not aiming to be a full web framework, but rather just a lightweight REST API library. There is no concept of MVC, but there is support for template engines, websockets, and static file serving for convenience. This allows you to use Javalin for both creating your RESTful API backend, as well as serving an index.html with static resources (in case you’re creating an SPA). This is practical if you don’t want to deploy to apache or nginx in addition to your Javalin service. If you wish to use Javalin to create web-pages instead of just REST APIs, there are some simple template engine wrappers available for a quick and easy setup.

If you want a more established Java web framework, you could try Spark. If you want a more established Kotlin web framework, you can try the Spark Kotlin Wrapper.

https://javalin.io/

 

Advertisements