We are about to start a financial news and analyti...
# ktor
d
We are about to start a financial news and analytics app project. The client is going to be Flutter, which we've successfully used before, and we've decided to use Kotlin for the backend. We are contemplating wether to use Ktor or Spring Boot + Kotlin. We are leaning toward Ktor because its idiomatically aligned with Kotlin and has a simple, consistent and concise set of APIs, but there is a larger community and more written about Spring Boot. Any advice on this decision (Ktor vs. Spring Boot + Kotlin)? There is a short but interesting conversation about this choice on Reddit: https://www.reddit.com/r/Kotlin/comments/pgfuhn/ktor_vs_spring_for_creating_an_api/
i
As someone who ditched Spring Boot I recommend Ktor. Spring Boot has a lot of legacy design which hurts maintainability more than the benefit. It's also nearly impossible to figure out due to the entangled dependency injection, and having multiple different way to configure the same thing doesn't help. Ktor is on the other hand much more unopinionated, and allowed me to focus on actual code not a million lines of configuration and gluing. It does not come with a lot of batteries though, database-persisted sessions etc have to be implemented on your own, but it's not much work if you are already familiar with one of the database libs (I use jOOQ, don't recommend JPA because it's an ultra leaky abstraction and a pain in the ass to deal with when you want to write direct SQL).
­čĹŹ 2
d
Thank you Ishi. This confirms what we suspected and is very helpful. We've used Spring Boot on previous Java projects and have the same opinion. It does everything, but it's big, it's an annotation-palooza, and there is a lot of cruft. We are new to Ktor, but it seems like a framework that would facilitate much faster development velocity when building the service layer for our new project.
k
I'd suggest you look at what your API service has to talk to and work backwards. If it needs to use things that ktor doesn't support an integration for, use something else. If it just reads/writes data from a DB, it'll work fine...if it does other stuff ktor supports, it'll work fine...
That person in the other thread brought up a good point that's true of any 3rd party lib... Once you have a kotlin/Java boundary, weird things can happen...
d
Thank you @kenkyee. re: Kotlin / Java boundary - We are painfully aware of this ­čÖé I spent a lot of time with Kotlin and interop with Java when I wrote the Kotlin implementation of KD: http://kixi.io