Awesome
Samples for Ktor
A collection of ready-to-use samples for Ktor. If you're looking for older samples, please see our note on Docs and Samples Migration.
Applications
- chat - A Chat application written using WebSockets and Sessions.
- fullstack-mpp - An example of using Ktor as a client and server in a Kotlin Multiplatform project.
- httpbin - HttpBin application implementing (large parts of) httpbin(1) HTTP request & response service.
- kweet - A messaging application that uses FreeMarker templates and the Locations plugin.
- reverse-proxy - A simple reverse proxy application.
- reverse-proxy-ws - A reverse proxy application written using WebSockets.
- youkube - A video upload/view application.
- version-diff - An application showing the difference between artifacts in two versions of a project.
- postgres - An application for creating, editing and deleting articles that uses Postgres database running on Docker image as a storage.
- mongodb - An application for creating, editing and deleting articles that uses Mongodb running on Docker image as a storage.
- mvc-web - An application for adding and removing wishes to wishlist that uses FreeMarker templates and Exposed.
- opentelemetry - An application that uses Kotlin DSL to work with OpenTelemetry Ktor plugins.
Server
- di-kodein - An application showing how to use Kodein with a Ktor server.
- filelisting - An application showing how to serve static files.
- location-header - An application demonstrating how to use the HTTP
Location
headers. - sse - A Server Sent Events application.
- structured-logging - An application showing how to use Ktor structured logging.
Client
- client-mpp - A sample project showing how to use a Ktor client in a multiplatform application.
- client-multipart - A sample showing how to send multipart data with the HTTP client.
- client-tools - A sample showing several useful extension methods not included in Ktor itself.
Deployment
- graalvm - Explains how to build and run a Ktor application in the GraalVM native image.
- native-image-server-with-yaml-config - A sample showing how to build and run a Ktor application in the GraalVM native image with a YAML configuration file.
- maven-google-appengine-standard - A sample showing how to deploy Ktor application to Google App Engine using Maven and Google App Engine.
Testing
- jwt-auth-tests - Shows how to write tests for RSA-signed JWT secured endpoints.
License
Samples are provided as is under the Apache 2 OSS license.