Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Mobile Backend Development with Ktor


Published on

Simple examples of mobile back-end with Ktor in Kotlin Everywhere (Tehran, 20 June 2019)

Published in: Engineering
  • Be the first to like this

Mobile Backend Development with Ktor

  1. 1. Sina Rezaei Android & Back­End Developer at Kappa Technologies 20 June 2019 Mobile Back­end Development with      Ktor Kotlin Everywhere
  2. 2. What is Ktor? Kotlin Hype Android Developers Love KotlinFront­End DevelopersBack­End DevelopersData EngineersAll Programmers Yet another back­end framework (with Kotlin) Framework for quickly creating web applications with Kotlin Yet another back­end framework (with Kotlin) Kotlin Everywhere
  3. 3. 3 What is Ktor? Mobile Back­End Development with Ktor From Github Page of Ktor:
  4. 4. 4 Based on, Ktor is a: ● Pure Kotlin ● Unopinionated  Logging, Templating, Messaging, Persistence, Serializing, DI, etc.  Any servlet container (Servlet 3.0+ API), standalone with Netty or Jetty  Application composition ● Asynchronous ● Server development framework ● By JetBrains Started on Nov. 2015 First Released on Jan. 2018 (0.9.0) What is Ktor? Mobile Back­End Development with Ktor
  5. 5. 5 Source: Komparing Kotlin Server­Side Frameworks KotlinConf 2018 Ktor vs. Kotlin Frameworks Mobile Back­End Development with Ktor
  6. 6. 6 Ktor vs. Kotlin Frameworks Mobile Back­End Development with Ktor Ktor Http4K Spring Pure Kotlin Pure Kotlin Needs plug-ins Kotlin Coroutine Support No Kotlin Coroutine Support 3rd Party Coroutine Support No Opentracing or Micrometer Micrometer Opentracing + Micrometer 3rd Party Swagger Support Swagger Support Swagger Support Free-marker & Velocity 5 Template Engines Over 7 Template Engines Supports WebSockets Supports WebSockets Supports WebSockets Very fast Moderate Speed Slowest Kotlin framework Google App Engine AWS Lambda Deployment AWS Lambda & App Engine
  7. 7. 7 Ktor vs. Non Kotlin Frameworks Mobile Back­End Development with Ktor Ktor Web.Go Tornado Super Fast Very Fast Fast Statically Typed (Kotlin) Statically Typed (Go) Dynamically Typed (Python) Kotlin Coroutines Goroutines No Coroutines 3rd Party (Exposed, JDBC, etc.) 3rd Party (GORM, Sql packge, etc.) 3rd Party Supports WebSockets No WebSockets Supports WebSockets
  8. 8. 8 Why Back­Ends welcome Ktor Mobile Back­End Development with Ktor ✔ High Performance (Using Coroutines + Thread Pooling) ✔ Fast & Easy Implementation ✔ Strong Runtime Environment ✔ Statically Typed Language ✔ Includes multi­platform clients (Android/iOS/JavaScript) ✔ Suitable for creating RESTful apis and websockets Can help Android developers with creating mobile back­end easily with  Kotlin
  9. 9. 9 Mobile Back­End Mobile Back­End Development with Ktor Some examples: ● User Registration/Verification ● Subscription and In­App billing ● Chat
  10. 10. 10Mobile Back­End Development with Ktor How Ktor code looks like...
  11. 11. 11Mobile Back­End Development with Ktor User Registration RESTful service with Ktor
  12. 12. 12Mobile Back­End Development with Ktor User Verification
  13. 13. 13Mobile Back­End Development with Ktor Data Persistence (Repository)
  14. 14. 14Mobile Back­End Development with Ktor Data Persistence ­ Coroutines
  15. 15. 15Mobile Back­End Development with Ktor Users Admin
  16. 16. 16Mobile Back­End Development with Ktor Subscription
  17. 17. 17Mobile Back­End Development with Ktor Chat with WebSockets
  18. 18. 18Mobile Back­End Development with Ktor Ktor Cons Small Community ● Not even in stackoverflow trends ● Low search popularity in Google trends
  19. 19. Questions Hope you’ve enjoyed the presentation! Kotlin Everywhere