# Is Ktor ready for product development?

**URL:** https://discuss.kotlinlang.org/t/is-ktor-ready-for-product-development/18623
**Category:** Web Development
**Created:** [July 29, 2020, 11:33am UTC](https://discuss.kotlinlang.org/t/is-ktor-ready-for-product-development/18623 "2020-07-29T11:33:28Z")
**Posts on this page:** 20
**Page:** 1

<div class="post-metadata">

### Author: ![phucynwa](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.kotlinlang.org/phucynwa/32/7795_2.png) [@phucynwa](https://discuss.kotlinlang.org/u/phucynwa)
#### Post date: [July 29, 2020, 11:33am UTC](https://discuss.kotlinlang.org/t/is-ktor-ready-for-product-development/18623/1 "2020-07-29T11:33:28Z")

</div>

Ktor is an interesting web framework. I’ve learned it for several months. But is it ready for building a software product?

And, Ktor vs Spring with Kotlin, which is better for Kotlin web development?

---

<div class="post-metadata">

### Author: ![imanushin](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.kotlinlang.org/imanushin/32/5471_2.png) [@imanushin](https://discuss.kotlinlang.org/u/imanushin)
#### Post date: [July 29, 2020, 12:40pm UTC](https://discuss.kotlinlang.org/t/is-ktor-ready-for-product-development/18623/2 "2020-07-29T12:40:02Z")

</div>

We use Ktor Client and Spring for last year. Both are the best for their roles: Spring has a lot of components and large community. Ktor Client works perfectly with non-blocking approach.

If you need small application without any IoC or something, Ktor can solve the most of your tasks.  
However if you need huge one with potential integration with Kafka, multiple databases, IoC in tests, etc., then I recommend you to select Spring as more widely used approach in Java Enterprise.

However please note this is just my experience and my advices.

---

<div class="post-metadata">

### Author: ![darksnake](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.kotlinlang.org/darksnake/32/2479_2.png) [@darksnake](https://discuss.kotlinlang.org/u/darksnake)
#### Post date: [July 29, 2020, 12:56pm UTC](https://discuss.kotlinlang.org/t/is-ktor-ready-for-product-development/18623/3 "2020-07-29T12:56:22Z")

</div>

As @imanushin said it depends on the scale. Ktor is perfect for small scale application with no external integrations. I am using it for small services and quite happy with it. Spring now has nice kotlin integrations, but its main niche is enterprise applications. It does not make sense to use it for something small and simple.

---

<div class="post-metadata">

### Author: ![phucynwa](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.kotlinlang.org/phucynwa/32/7795_2.png) [@phucynwa](https://discuss.kotlinlang.org/u/phucynwa)
#### Post date: [July 29, 2020, 1:05pm UTC](https://discuss.kotlinlang.org/t/is-ktor-ready-for-product-development/18623/4 "2020-07-29T13:05:08Z")

</div>

Is Ktor fit for scalable web server ? Suppose I want to build a small server and I want to expand it in the future.

---

<div class="post-metadata">

### Author: ![imanushin](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.kotlinlang.org/imanushin/32/5471_2.png) [@imanushin](https://discuss.kotlinlang.org/u/imanushin)
#### Post date: [July 29, 2020, 6:52pm UTC](https://discuss.kotlinlang.org/t/is-ktor-ready-for-product-development/18623/5 "2020-07-29T18:52:25Z")

</div>

The word “scale” has two meanings: “performance scaling” and “functional scaling”.

Ktor corresponds to the both of them. You can configure different serialization, models, etc. for different endpoints. You can write your custom conversion and error handling logic, you can facade logging, etc. Of course you can support several authorization techniques (for all or parts of endpoints).

In case of performance: as I know, at least [YouTrack uses ktor](https://www.jetbrains.com/help/youtrack/standalone/Third-Party-Software-Used-by-YouTrack.html#YouTrack_Back-End_Libraries), which can be proof of the library power.

---

<div class="post-metadata">

### Author: ![phucynwa](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.kotlinlang.org/phucynwa/32/7795_2.png) [@phucynwa](https://discuss.kotlinlang.org/u/phucynwa)
#### Post date: [July 29, 2020, 6:55pm UTC](https://discuss.kotlinlang.org/t/is-ktor-ready-for-product-development/18623/6 "2020-07-29T18:55:23Z")

</div>

Thank you. 😊  
Have you built a website with Ktor?

---

<div class="post-metadata">

### Author: ![fvasco](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.kotlinlang.org/fvasco/32/1961_2.png) [@fvasco](https://discuss.kotlinlang.org/u/fvasco)
#### Post date: [July 30, 2020, 7:59am UTC](https://discuss.kotlinlang.org/t/is-ktor-ready-for-product-development/18623/7 "2020-07-30T07:59:59Z")

</div>

Hi, @phucynwa,  
usually it is quite hard to answer to the question: is a software production ready?  
Moreover, it is not possible to mark a product as a “silver bullet”.

Feel free to choose your preferred solution, in my opinion there is no reason to not consider Ktor as a good back-end.

---

<div class="post-metadata">

### Author: ![imanushin](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.kotlinlang.org/imanushin/32/5471_2.png) [@imanushin](https://discuss.kotlinlang.org/u/imanushin)
#### Post date: [July 30, 2020, 1:45pm UTC](https://discuss.kotlinlang.org/t/is-ktor-ready-for-product-development/18623/8 "2020-07-30T13:45:52Z")

</div>

Yes, however it is internal and isn’t heavy loaded (average load is about 1 request per second in a peak time).

---

<div class="post-metadata">

### Author: ![phucynwa](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.kotlinlang.org/phucynwa/32/7795_2.png) [@phucynwa](https://discuss.kotlinlang.org/u/phucynwa)
#### Post date: [July 30, 2020, 2:39pm UTC](https://discuss.kotlinlang.org/t/is-ktor-ready-for-product-development/18623/9 "2020-07-30T14:39:07Z")

</div>

Why is it so slow ? 🥴

---

<div class="post-metadata">

### Author: ![darksnake](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.kotlinlang.org/darksnake/32/2479_2.png) [@darksnake](https://discuss.kotlinlang.org/u/darksnake)
#### Post date: [July 30, 2020, 5:40pm UTC](https://discuss.kotlinlang.org/t/is-ktor-ready-for-product-development/18623/10 "2020-07-30T17:40:52Z")

</div>

Who said that it is slow? @imanushin only told you that he used it for low load.

---

<div class="post-metadata">

### Author: ![lamba92](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.kotlinlang.org/lamba92/32/5089_2.png) [@lamba92](https://discuss.kotlinlang.org/u/lamba92)
#### Post date: [July 30, 2020, 6:43pm UTC](https://discuss.kotlinlang.org/t/is-ktor-ready-for-product-development/18623/11 "2020-07-30T18:43:59Z")

</div>

I’m building a multi DB soon to production backend with Ktor and I must say, it has many clear edges over Spring.

The advantage is the philosophy behind Kotlin: concise and safe. I could pass an entire Ktor codebase to a neofite and he/she could be able ctrl+click everything and follow each and every flow, which by the way are mostly declarative and ence intuitive. Also coroutines in an inherently async context are godsend.

Writing a feature to incorporate code is not hard and, again, intuitive.

With Spring, good luck finding out which annotation is declared who knows where invoked by who knows who.

Indeed Spring has already proven to be worthy and frankly I doubt you could squeeze a better web framework given the limitations of Java (at least compared to Kotlin).

I am sure Ktor will find a way into the Kotlin backend world, It just needs time to find the trust of the devs!

Also, I love Ktor \<3

---

<div class="post-metadata">

### Author: ![phucynwa](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.kotlinlang.org/phucynwa/32/7795_2.png) [@phucynwa](https://discuss.kotlinlang.org/u/phucynwa)
#### Post date: [July 30, 2020, 6:52pm UTC](https://discuss.kotlinlang.org/t/is-ktor-ready-for-product-development/18623/12 "2020-07-30T18:52:42Z")

</div>

Do you have an open source built with Ktor ? I want to reference. Thank you.

---

<div class="post-metadata">

### Author: ![lamba92](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.kotlinlang.org/lamba92/32/5089_2.png) [@lamba92](https://discuss.kotlinlang.org/u/lamba92)
#### Post date: [July 30, 2020, 7:31pm UTC](https://discuss.kotlinlang.org/t/is-ktor-ready-for-product-development/18623/13 "2020-07-30T19:31:24Z")

</div>

Well, I cannot share them because it’s a business project.

Have a look [here](https://github.com/lamba92/maadb-project) instead.  
It’s a university project where I used Ktor+Docker. It’s not much but it’s something!

---

<div class="post-metadata">

### Author: ![phucynwa](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.kotlinlang.org/phucynwa/32/7795_2.png) [@phucynwa](https://discuss.kotlinlang.org/u/phucynwa)
#### Post date: [July 31, 2020, 12:48pm UTC](https://discuss.kotlinlang.org/t/is-ktor-ready-for-product-development/18623/14 "2020-07-31T12:48:49Z")

</div>

Wow, so is Ktor used for your business project?

---

<div class="post-metadata">

### Author: ![lamba92](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.kotlinlang.org/lamba92/32/5089_2.png) [@lamba92](https://discuss.kotlinlang.org/u/lamba92)
#### Post date: [July 31, 2020, 12:51pm UTC](https://discuss.kotlinlang.org/t/is-ktor-ready-for-product-development/18623/15 "2020-07-31T12:51:08Z")

</div>

Well yes, that was my point! 😛

---

<div class="post-metadata">

### Author: ![phucynwa](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.kotlinlang.org/phucynwa/32/7795_2.png) [@phucynwa](https://discuss.kotlinlang.org/u/phucynwa)
#### Post date: [July 31, 2020, 12:54pm UTC](https://discuss.kotlinlang.org/t/is-ktor-ready-for-product-development/18623/16 "2020-07-31T12:54:06Z")

</div>

How do you compare it vs Node.js ? Performance and cost of time ?

---

<div class="post-metadata">

### Author: ![lamba92](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.kotlinlang.org/lamba92/32/5089_2.png) [@lamba92](https://discuss.kotlinlang.org/u/lamba92)
#### Post date: [July 31, 2020, 1:08pm UTC](https://discuss.kotlinlang.org/t/is-ktor-ready-for-product-development/18623/17 "2020-07-31T13:08:01Z")

</div>

Both of them way better. The only comparison that may stand a chance is with Spring!

---

<div class="post-metadata">

### Author: ![imanushin](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.kotlinlang.org/imanushin/32/5471_2.png) [@imanushin](https://discuss.kotlinlang.org/u/imanushin)
#### Post date: [July 31, 2020, 7:03pm UTC](https://discuss.kotlinlang.org/t/is-ktor-ready-for-product-development/18623/18 "2020-07-31T19:03:32Z")

</div>

> How do you compare it vs Node.js ? Performance and cost of time ?

I’m not sure that we can simple to compare them.

First of all, JavaScript is single-threaded. You couldn’t have shared mutable object (for example - cache) between simultaneous threads. So if your code doesn’t need any caching, any shared state or something, NodeJS can be effective solution. Otherwise JVM/CLR work just better for this case.

Another point is that JavaScript isn’t strongly typed. So huge system couldn’t be refactored safely. TypeScript can help, however you still have library interaction with the same side effects. And this can be restriction for project growth in future, because you will need to split your service to smaller, just to have ability to control the codebase. However with strongly-typed language (Java, C#, Kotlin, Scala, etc.) you can keep more items in one process, which is better for productivity and performance purpose in general case.

From the other side, with NodeJS you can simply share the same TypeScript code between server and browser. For example, you don’t need to rewrite validation twice - first for client and second for server.

Of course there are more pros and cons for this selection, I just highlighted part of them.

---

<div class="post-metadata">

### Author: ![christoph.pickl](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.kotlinlang.org/christoph.pickl/32/6938_2.png) [@christoph.pickl](https://discuss.kotlinlang.org/u/christoph.pickl)
#### Post date: [August 1, 2020, 8:19am UTC](https://discuss.kotlinlang.org/t/is-ktor-ready-for-product-development/18623/19 "2020-08-01T08:19:47Z")

</div>

we used ktor in production in my previous work, and had very good experiences. sometimes missing the full blown power (+documentation) of spring, but besides that: i have the feeling of never wanting to go back to “annotation based programming” with spring, and rather use a proper programming language like kotlin 😉

---

<div class="post-metadata">

### Author: ![alamothe](https://avatars.discourse-cdn.com/v4/letter/a/c4cdca/32.png) [@alamothe](https://discuss.kotlinlang.org/u/alamothe)
#### Post date: [August 8, 2020, 6:04am UTC](https://discuss.kotlinlang.org/t/is-ktor-ready-for-product-development/18623/20 "2020-08-08T06:04:58Z")

</div>

I would say, if you’re starting from scratch then Node.js is by far the best choice right now. If you want static type-checking (and you should), TypeScript is way more powerful typing language than Kotlin. Kotlin is not without its advantages, like its Standard Library which is the best STL out there, but TypeScript is just more expressive. Node.js also has better community and better libraries than Java ecosystem, which is very outdated. Async programming is also way easier in JavaScript than Kotlin coroutines, which are extremely hard to grasp.

If you have a Java/Kotlin source code already, we did an analysis for our medium-sized web service to transition from servlets, and we chose Vert.x. Ktor seems attractive, but due to the lack of event-loop it can only handle simple use cases. Not only does Vert.x plays really well with Kotlin coroutines, it adds to them a very useful concept of event loop which coroutines lack.

EDIT: Spring is just garbage, so I don’t mention it here.

[Next page](https://discuss.kotlinlang.org/t/is-ktor-ready-for-product-development/18623.md?page=2)
