10 ms·
Ask HN: Is Ktor a good back end framework to learn?
How does it compare to FastAPI, Express and Gin Gonic (Golang)? My goal is to make a REST API that a React Frontend will consume.
Also, I already know Python, JavaScript, a bit of Go and Kotlin.
- armchairhacker 5y agoI can’t speak for other apis but i’ve used Ktor and I thought it was good. JetBrains is invested in it, there are a lot of docs and even a compiler plugin / website to generate starter code. Generally I recommend using Ktor if you’re familiar with Kotlin or want to use Kotlin for some reason. Elixir or Go might be easier for a beginner, but if you have to learn a new language / paradigm this difference cancels out.
- nassimsoftware 5y agoWhat do you think of the developer experience? Does it scale? Is it easy to deploy?
- armchairhacker 5y agoDeveloper experience is top-notch because it’s JetBrains. Nothing else compares. It’s supposed to be scalable but idk because i don’t have a big app. It uses coroutines so it can serve multiple requests simultaneously. Deployment is easy although idk what to compare to. I created a jar and ran it in linode and i got a working server. You can also create a docker app.
- nassimsoftware 5y agoNice, last question : do you use JDBC to connect to a postgres database or are there specific libraries in Kotlin?
- armchairhacker 5y agoA bit late but I use this which is a wrapper over JDBC: https://github.com/JetBrains/Exposed https://github.com/JetBrains/Exposed
- slively 5y agoWe use it as a rest api framework for a react front end and it’s just fine. Performance is not really and issue for us so far. If you like express you will like Ktor, but you will find less libraries for middleware stuff. Exposed is also pretty nice as a JDBC wrapper and object mapper. If you like composing libraries over using a framework then it’s a good choice. If you are invested in coroutines like us Ktor is great, but Exposed isn’t really async all the way through and you’d want something like r2dbc ideally. Exposed has a wrapper for coroutines though. Clikt is a nice config parser as well, and Koin is fine for DI. Jackson has good Kotlin support, and I haven’t tried the Kotlin serialization package yet but it looks interesting. These days i prefer some of the library stitching done for me and would probably opt for spring boot and webflux which has nice Kotlin and coroutine support now.