The state of Java/Kotlin Microframeworks in 2018
Java has come a long way from being the monster that terrifies developers to being nice and friendly. The version 8 of Java was a step in the right direction with the support of Lambdas, Functional Interfaces and a lot more. And ever since with every version of Java, there are features added that makes Java more pleasant to use.
But still building a good web application or RESTful services in Java, whether it’s a monolith or a micro service, isn’t a walk in the park. Before, as Java developers, we didn’t really have many choices. The two obvious and safe choices were either the famous Spring Framework (which has really grown throughout the years to give us it’s version Spring Framework 5 and the beautiful Spring Boot 2.0), and the Play framework. But now it seems that we have a lot of interesting choices when it comes to choosing a web framework in Java or Kotlin for example : Jobby, Javalin, Micronaut (which I am a huge fan of BTW!), Ktor, and many more. This article will highlight some of these new frameworks.
So what is a Microframework ?
A microframework is a minimalist web framework that is meant to be lightweight and fast, thus making the development of Java web application much easier. Nevertheless, this doesn’t mean that you have to compromise. In fact a lot of these frameworks come packed with a ton of features straight out of the box.
A walk down the Microframework’s lane
Enough blah blah blah and let’s check out some of the options here. The frameworks that I’m displaying below are some of the frameworks that I have played with before and would totally recommend. So let’s start :
Jooby : DO MORE, MORE EASILY
Jooby is actually one of my favorite frameworks out there. It’s super lightweight and it’s super fast. It is also heavily inspired by Express.js and Sinatra.
Jooby supports both the scripting programming model and the MVC programming model so it’s a win-win. Jooby also comes with devtools that makes running and debugging your application a lot easier.
Get started : Jooby Quick Start
Javalin : A simple web framework for Java and Kotlin
Javalin is also a lightweight and simple Java framework. It is actively being developed as we speak. So expect that a new version is released twice every month. Javalin is built on top of Jetty which is one the most stable Java web-servers. It is worth to mention that Javalin is also heavily inspired by the Javascript framework Koa.js
Get started : Javalin Quick Start
Spark — A micro framework for creating web applications
With 7475 stars on Github, Spark is one of the most popular microframeworks for Java. Spark was built for productivity with Microservices in mind and just like the other frameworks mentioned above, it’s also fast and lightweight.
Get started : Spark Quick Start
Micronaut : The future of microservices
A modern, JVM-based, full-stack framework for building modular, easily testable microservice applications.
Just like they say : “save the best for last”.
Micronaut is one of my favorite new web frameworks for Java. It’s super fast, lightweight, easily testable and it comes with cloud support (for all the major cloud providers including AWS, Azure and GC). Micronaut is actually the extent to which we call a micro framework. You can think of it as a stripped-down version of Spring Boot with loads of features.
The milestone version was released May 30th and it’s still under heavy development, but I would recommend to keep an eye on it because of my humble opinion that it’s going to be the next big Java framework.
Also Micronaut comes with a CLI that makes it easier to create Micronaut projects : Micronaut CLI
Get started : Micronaut Quick Start
Honorable mentions :
Ktor : A framework for building asynchronous servers and clients in connected systems using Kotlin.
Dropwizard : AJava framework for developing ops-friendly, high-performance, RESTful web services.
Jodd : A set of micro-frameworks and developer-friendly tools and utilities. Simple code. Small size. Good performances. Whatever. Use what you like.
Ninja : A full stack web framework for Java. Rock solid, fast, and super productive.
Ratpack : A set of Java libraries for building scalable HTTP applications.
All the examples shown above are on my github :
What do you think ? Do you have any suggestions for other microframeworks that I might have missed ? Do not hesitate to comment down below.