This project provides a full example of a full-stack Ktor application using Compose Multi-platform, Amper, Exposed, Koin, and other bleeding-edge Kotlin libraries.
The project consists of the following amper modules:
module | description |
---|---|
core | domain data objects, interfaces, and exceptions |
server / db | exposed database schema types and repository implementations |
server / common | common server functionality |
server / rest | ktor server REST implementation |
server / htmx | HTMX server implementation |
server / admin | admin service for making sensitive changes |
client | common client library for interacting with the back-end |
app / common | shared front-end application code |
app / android | android front-end application |
app / desktop | jvm desktop front-end application |
The dependencies of the modules flow towards the domain module: core.
Below is a diagram of how the modules depend on one another:
mindmap
root((core))
id(app)
desktop
android
id(server)
rest
htmx
admin
id{{client}}
id{{db}}
Note, "common" module is implied for the server and app modules here.
There are multiple chat client implementations under ./chat-app-*
that can be executed independently
with a mock environment, or with a server running.
Here is a list of the commands for running each program:
application | main source | gradle command |
---|---|---|
server-rest | server/rest/src/io/ktor/chat/Application.kt |
./gradlew :server:rest:run |
server-htmx | server/htmx/src/io/ktor/chat/Application.kt |
./gradlew :server:htmx:run |
desktop app | app/desktop/src/main.kt |
./gradlew :app:desktop:jvmRun |
android app | app/android/src/io/ktor/chat/MainActivity.kt |
./gradlew :app:android:jvmRun |
If you'd like to run everything in a containerized environment:
Firstly, publish images locally using:
./gradlew :server:rest:publishImageToLocalRegistry
./gradlew :server:admin:publishImageToLocalRegistry
Now, you can run docker compose:
docker compose up