ktor-samples icon indicating copy to clipboard operation
ktor-samples copied to clipboard

Sample projects for Ktor

official JetBrains project

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.

Content

  • Samples for Ktor
    • Content
    • Applications
    • Server
    • Client
    • Deployment
    • Maven
    • License

Applications

  • chat - 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 Ktor application implementing (large parts of) httpbin(1) HTTP Request & Response Service.
  • kweet - Messaging application written with Ktor using freemarker templates and locations feature.
  • reverse-proxy - A simple reverse proxy application written with Ktor.
  • reverse-proxy-ws - A reverse proxy application written using Ktor and WebSockets.
  • youkube - A video upload/view application written with Ktor.
  • version-diff - An application showing the difference between artifacts in two versions of a project.

Server

  • css-dsl - Application showing how to use CSS DSL along HTML CSS with Ktor.
  • di-kodein - Application showing how to use Kodein with Ktor server.
  • filelisting - Application showing how to use Ktor to serve static files.
  • location-header - Location Header application demonstrating how to use HTTP Location headers.
  • multiple-connectors - Application showing how to serve both HTTP and HTTPS with a single Ktor server.
  • simulate-slow-server - Small application simulating a slow server with Ktor .
  • sse - Simple Server Sent Events application written with Ktor.
  • structured-logging - 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 - Sample showing how to send multipart data with HTTP client.
  • client-tools - Sample showing several useful extension methods not included in Ktor itself.
  • native-client - Sample showing how to use a Ktor HTTP client with kotlin-native.

Deployment

  • graalvm - Explains how to build and run Ktor application in the GraalVM native image.
  • maven-google-appengine-standard - Sample showing how to deploy Ktor application to Google App Engine using Maven and Google App Engine.
  • proguard - Sample showing how to pack Ktor application in minimized Jar using Proguard.
  • docker-image - Sample showing how to build and run a Ktor application in Docker image.

Maven

License

Samples are provided as is under the Apache 2 OSS license.