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 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
- 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.
- Redirect with Exception. Creating an HTTP direct when an exception is thrown.
- RxJava. How to use RxJava in combination with Ktor.
- Server-Sent Events. Using Server-Sent 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
- Client Multiplatform Application. A Ktor client compiled with Kotlin/Native to run on Android, iOS, JavaScript, and macosX64
- Client Multipart. Ktor client that can send multipart data.
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.