Getting Started

Getting Started

If you're new to Ktor, work your way through some of the tutorials we have prepared that guide you on a step-by-step journey covering different Ktor capabilities.

Samples

Samples

Samples are a series of self-contained applications that can you browse through to understand different ways to accomplish things in Ktor.



Application
  • Chat Application. Ktor application using web sockets and sessions to simulate a chat application.
  • Fullstack Client and Server Application. A Kotlin/JS client application talking to a Ktor server application.
  • HTTP Bin. An implemention of HttpBin using Ktor, demonstrating the majority of endpoints and functionality available.
  • Kweet. A messaging application simulating Twitter, and using Freemarker template engine.
  • Reverse Proxy. A Reverse Proxy implementation.
  • Reverse Proxy with WebSockets. A Reverse Proxy implementation which uses WebSockets.
  • YouKube. Demonstrates how to create an application that allows for uploading and viewing of videos, using Kotlinx.html as the templating engine.


Server
  • CSS DSL. Using Kotlin CSS in combination with Ktor.
  • Kodein DI. Using Kodein Dependency Injection framework with Ktor.
  • File Listing. How to create a file listing for a static site.
  • Location Header. Demonstrating how to use HTTP Location header.
  • Multiple Connectors. Showcasing how to create endpoints listening on different IPs and ports in a single Ktor application.
  • Redirect with Exception. Creating an HTTP direct when an exception is thrown.
  • RxJava. How to use RxJava in combination with Ktor.
  • Slow server simulation. Simulating a slow server using a custom interceptor.
  • Server Side Events. Using Server-Side Events to trigger callbacks on the client.
  • Structured Logging. Demonstrates how to log applications calls during the different phases of request and response pipeline.


Client


Deployment
  • Running Ktor with GraalVM. Run a Ktor Server application which uses a CIO engine, with GraalVM
  • Google AppEngine. Deploying a Ktor application to Google AppEngine, using Maven as the build tool.
  • Proguard. Sample on how to use Proguard with Ktor.
  • Docker Image. A demo project which shows how to configure building, running and publishing of Docker image with your application.


Maven
  • Maven and Netty. Using Maven to create an self-contained Netty Ktor server.