Kotlin backend app boilerplate
Introduction
I wrote a post on backend development in Kotlin some time back. After writing that post, I realised that for all my abandoned side projects I go through the same dance - set up maven and kotlin in intellij and get dependencies that end up being used in most projects.
I have been writing a lot more go code recently just because it is much easier to start on a go app than it is on a kotlin app. With Go - you can just do code main.go
and start hacking away - it is a bit more work on the kotlin side to setup maven, dependencies and intellij.
I decided to spend some time and get a maven project with everything already included setup that allows me to git clone
and get going.
Backend boilerplate
Getting a kotlin backend app started should be as easy as typing rails new
but for v1 we can use git clone
instead.
The repository is publically available here https://gitlab.com/asad-awadia/kotlin-server-app/
and can be cloned over https via git clone https://gitlab.com/asad-awadia/kotlin-server-app.git
It is a kotlin + maven project with the following already setup
- JDBI for database manipulation
- Ktorm as ORM
- Javalin for http server
- Lettuce as a redis client
- Caffeine as an in memory cache
- Unirest as an http client
- Jib to create docker images [mvn compile jib:dockerBuild]
- Maven assembly plugin to create fat jar [mvn package]
- Codehaus to run the app directly from terminal [mvn clean compile exec:java]
Looking ahead
I hope to add more niceties such as logging, metrics & tracing etc in the future.