Skip to content
/ ktor-template Public template

Template for the development of Ktor backend applications powered by Exposed/Hikari/PostgreSQL for database management, Firebase for authentication, and KotlinX Serialization for JSON parsing. Ready to be hosted on Heroku with GitHub Actions CI integration.

Notifications You must be signed in to change notification settings

xorum-io/ktor-template

Repository files navigation

Ktor template

This is a template for the development of backend applications using Ktor framework powered by Kotlin programming language.

Exposed ORM framework is used to wrap the PostgreSQL database connected by HikariCP JDBC pool.

Firebase Auth helps to authenticate users for each request by passing the bearer token generated on the client side by one of Firebase client SDKs.

Sentry is used for logging crashes.

Find more details on this template in our Medium blog.

To do

Once cloned do the following to adapt template to your needs.

  1. Change project name in settings.gradle.
  2. Change group in build.gradle
  3. Change name and description in app.json.
  4. Generate testToken (http://jwtbuilder.jamiekurtz.com/) and testUserId (https://www.uuidgenerator.net/) and set them in FirebaseAuth.kt. These variables are needed to simplify testing endpoints using Postman or similar tools.
  5. Create new Firebase project. Put firebase admin key file to resources and name it firebase-adminsdk.json. Set ADMIN_KEY environment variable at your server.
  6. Set defaultJdbcUrl in DatabaseFactory.kt. Here is an example used with PostgreSQL jdbc:postgresql://localhost:5432/<dbName>?user=<userName>&password=<password>&reWriteBatchedInserts=true
  7. When ready to deploy to Heroku, set GitHub secrets which are used in github/workflows YAML files (CI): HEROKU_APP_NAME_PROD, HEROKU_APP_NAME_STAGING, HEROKU_EMAIL, and HEROKU_API_KEY. Set GRADLE_TASK environment variable to shadowJar at your server.
  8. Set SENTRY_DSN environment variable at your server to send crashes to Sentry.

About

Template for the development of Ktor backend applications powered by Exposed/Hikari/PostgreSQL for database management, Firebase for authentication, and KotlinX Serialization for JSON parsing. Ready to be hosted on Heroku with GitHub Actions CI integration.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages