This is a template to help you get started building amazing Kotlin applications and libraries. Over time, examples will be compiled as individual modules, that users can pick and choose from when starting their repo.
This repo loosely follows hexagonal architecture patterns, decoupling the persistence and api layers through a lightweight domain layer. Feel free to abandon course if this is not your cup of tea.
Sourdough aims to provide you with a starter point for any type of JVM based Kotlin application you choose to build.
Certain information on module approach will also be detailed in the gradle section, as there is a lot of cross over between the modules and the necessary Gradle configuration.
Bare bones Ktor API server. Since it is wired to the persistence module, you will need to run the
database prior to launch via the docker-compose up -d
command.
Simple application to run background processes.
Kotlinx CLI Demo. Includes ability to seed database with pseudo-random data
TODO
Lightweight module containing domain models that enable easy decoupling of API and persistence modules
Lightweight persistence module leveraging Flyway for migrations along with Kotlin Exposed as the ORM. Out of the box it is configured to point directly at the postgres instance defined in the docker compose file in the root of the project.
Database schema is managed using Atlas and Flyway. Migrations can be generated by running the following command
# Requires docker running
atlas migrate diff {{migration_name}} \
--dir "file://persistence/src/main/resources/db/migration?format=flyway" \
--to "file://persistence/schema/public" \
--dev-url "docker://postgres/15/text?search_path=public"
Migrations are applied automatically by Flyway when the application is started.
This repo leverages the sourdough-gradle collection of plugins to autoconfigure a majority of the boilerplate necessary to get this repo up and running. For more information on all the setup that plugin does, please refer to its documentation
Docker is used to provide a local postgres instance for development. To start the database, run the following command
docker-compose up -d