Deploy
Introduction
Suppose you have a Ktor application named app and you want to deploy it to a remote server.
Fat JAR
Deploying a Ktor application involves packaging your code into a runnable format (usually a “Fat JAR”) and configuring a remote server to run it continuously while handling incoming web traffic.
Executable JAR file
To run the application on a server, you need to bundle your code and all its dependencies into a single, executable JAR file.
Open your terminal in the root of your project and run the build command:
Once the build succeeds, locate your packaged application. It will be located at build/libs/ and will likely be named something like app.jar.
Server
Connect to your server via SSH and install the Java Runtime Environment (JRE) so it can execute your JAR file.
Update your package manager and install Java (replace 17 with 21 if your project uses Java 21):
Create a directory to hold your application:
You're reading a preview.
Sign in to read the full article. Any account opens 4 free articles a month; students and teachers read their course pages without limit.
Sign in