The Ninja Web framework

Hello there :-)

The Ninja framework is a fairly lightweight stack modelled loosely on the Play! framework. It’s dead easy to learn, open-source, scaleable and supports just about every other feature you’d expect to ensure full buzzword compliance.

I had a go at converting the framework examples from Java. Turned out to be pretty straightforward:

Though again, the need to support nullable types in the framework made a few bits of the code a little cumbersome.

Anyway, if you’re on the lookout for a web framework that’s pretty much production-ready and is a good fit for Kotlin, then the Ninja Web framework is worth a look. With any luck, the folk at Jetbrains could work with the Ninja folk to make the framework a little more Kotlin-friendly.

Message was edited by: Rayz

Fixed duff links.


I am not affliated with either company.


Just thought I’d mention that.

I don't see any Kotlin code anywhere, do you have a direct link?

Also, your links have weird linkedin redirects in them.



Thanks for that. I’ve fixed the links now.

Thanks, but I'm still not seeing any Kotlin anywhere (NinjaTest only has src/main/java).

Yes, I didn't change the name of folder. The Kotlin files are inside there.

I've been experimenting with Kotlin/Ninja as well.  Injecting services into controllers was a bit cumbersome at first when I tried field level injection.  Initially, I believe I was doing something like this (which is similar to your InjectionExampleController):

  var greetingService : GreetingService? = null

This of course gives you a nullable GreetingService which is rather annoying as you have to either add nullchecks everywhere or use the !! operator.  I find using constructor injection is much better:

public class HelloController [Inject] ( val greetingService : GreetingService) {

… since you get a non-null reference that doesn’t propagate throughout your code.

Ah! Thanks for that! I think I'd got something similar in the upload controller while experimenting with the injection:

private val lang: Lang by Delegates.lazy {
  val injector = Guice.createInjector(Module())

But it's not anywhere near as tidy.