Hey folks :wave: new to the community but current...
# server
n
Hey folks 👋 new to the community but currently kicking off development at a venture-backed startup and we’re exploring using Go vs Kotlin on the server-side. I have experience running kotlin with spring before but definitely want to move away from that into something more lightweight. Ktor has been awesome to play around with, but I feel there’s a couple of concerns I have would be great to get some opinions: • Kotlin is more feature-rich as a language but that means there’s higher developer onboarding time • Frameworks such as Ktor leverage DSLs and extension functions very heavily, and more often than not you’ll pull in java/kotlin dependencies that might not use those patterns but stick to more traditional OO design patterns. With this mix of paradigms, could it lead to higher onboarding times (as devs have to decide between multiple approaches within their own code) and style/pattern inconsistency? • The lack of functional, stable modern ORM in Kotlin - do most folks use exposed/ktorm or stick to Java ORMs? Looking for something lightweight, typesafe like https://entgo.io/ but can’t find much other than JOOQ which isn’t really great for dealing with object graphs
d
Hi, I have tested Ktor in production(was building a slack application), for database exposed library was used. What was bad: 1. High CPU load on one of the rest clients( don't remember which one) but it was fixed in later versions of Ktor 2. No swagger ui 3. Lack of additional connectors (for example no native library for Redis as you will find for Spring, Quarkus or Micronaut) 4. Profiling and configuring wasn't so easy (usually i am using vault, consul or spring cloud for this) What was good: 1. Perfect Kotlin experience, cause framework support all its features (coroutines, dsl and etc.) 2. No annotation developement like in Spring 3. Fast application start Would I recommend Ktor for production? Yes for small projects where you have time to implement connectors by yourself. No for big enterprise projects where you need fast development and easy finding new developers. But Kotlin is not only Ktor framework, take a look at others in the market. For example Quarkus( small builds, fast start, ready for containers and also graal native builds), Micronaut (AOT compilation), Helidon, Spark and others.
a
Regarding the ORM question. A lot of users prefer Exposed with Ktor https://github.com/JetBrains/Exposed But if there's really a need to use Hibernate/JPA, then... you can just use Hibernate/JPA 🙂
t
Ktor is definitly more lightweight, I at some point did switch back to Spring though. This was because at least at the time Spring supplied a lot more non-functionals for me (i ended up using spring jdbc, security, oauth, actuator, web, webtest and a few other things) With Ktor (at least at the time, it was a bit ago) i needed to do my own implementation/stitching together of these things. That was the point where I started to think how big of a deal startup time actually was for my services.. and decided it was not as important to me as being responsible for building/maintaining the enterprise features spring gave me out of the box. So I would say also take into account how many non-functionals (enterprisy) your service has to be before switching to lightweight (because there is a reason Spring got bloated.. and that is because people needed these features in production). That being said, Micronaut and quarkus also look interesting 🙂
Also, between GO and Kotlin for backend, I would suggest kotlin for backend. Go is great for scripting things but if your application grows and starts having a more complex domain models/features go will start lacking and you will want the correctness kotlin gives you
d
I don't think there will be a problem with any of your points of concern. Coroutine contexts are about the only aspect I found a bit confusing, Ktor is almost invisible (it gets out of the way), and Exposed is fine for most purposes.