Ktor Server for Tasky (Task Management) Android App
Tasky is a reminder app that allows users to create, manage, and receive reminders for events. The backend server is built using Ktor, a Kotlin framework for building asynchronous servers and clients in connected systems. The server is designed to handle user authentication, task management, and event reminders.
- Kotlin 2.1.2
- Ktor 3.1.3 server application
- Koin 4.0.4 for dependency injection
- MongoDB for data storage
- S3 for file storage (Images)
- Tasky Android Application Source: https://github.com/realityexpander/Tasky
- All secret keys and credentials are stored in a separate configuration file for security purposes.
- Demonstrates the use of Koin for dependency injection, Ktor for server-side development, and MongoDB for data storage.
- includes a sample API key generation and validation process, as well as a sample task management system with reminders and attendees.
- Server uses JWT and refresh tokens for authentication and authorization.
- All API endpoints are secured with JWT authentication.
- Ability to kill tokens for security purposes.
- Uses HOCON for configuration management.
- Clone this repository
- Get FREE S3 bucket credentials from iDrive e2 (https://www.idrive.com/)
- Get FREE MongoDB Atlas credentials from MongoDB Atlas (https://cloud.mongodb.com/)
- Set up environment variables in
authenticationSecrets.confin thesrc/main/resourcesdirectory- Refer to the sample authenticationSecrets.conf.example file for the required variables.
- Make sure to rename the file to
authenticationSecrets.confafter editing.
- Set up the database in MongoDB Atlas
- Create the
taskydatabase. - Create the following collections:
userapiKeytaskeventreminderattendeekilledToken
- Create the
- Run Server Locally
- Use the command
./gradlew runto start the server. (Or just run from IDE) - The server will be available at
http://localhost:8080.
- Use the command
- Instructions for deploying the server to VPS
- IDE: IntelliJ IDEA
-
IntelliJ IDEA 2025.1.1.1 (Community Edition) Build #IC-251.25410.129, built on May 9, 2025 Source revision: b815cfdcaa594 Runtime version: 21.0.6+9-b895.109 aarch64 (JCEF 122.1.9) VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o. Toolkit: sun.lwawt.macosx.LWCToolkit macOS 15.4.1 Kotlin plugin: K2 mode GC: G1 Young Generation, G1 Concurrent GC, G1 Old Generation Memory: 3048M Cores: 10 Metal Rendering is ON Registry: ide.experimental.ui=true completion.cloud.enableTextCompletion=false llm.show.ai.promotion.window.on.start=false kotlin.scripting.index.dependencies.sources=true Non-Bundled Plugins: com.jetbrains.space (251.23774.318) com.jetbrains.edu (2025.4-2025.1-530) org.jetbrains.settingsRepository (251.25410.28) wu.seal.tool.jsontokotlin (3.7.6) com.github.DerekBum.composeSlidesPresenter (0.1.2) DBN (3.5.3.0) net.ashald.envfile (3.4.2) org.jetbrains.plugins.hocon (2025.1.0) com.intellij.mermaid (0.0.25+IJ.243) com.github.fisherman08.Idea-WebSocket (1.0.1) com.wakatime.intellij.plugin (15.0.3) com.intellij.ml.llm (251.23774.42.28.7) com.intellij.grazie.pro (0.3.377) org.jetbrains.plugins.gitlab (251.25410.159-IU) org.jetbrains.plugins.github (251.25410.159-IU) com.google.CoroutineStacks (1.0.3) org.jetbrains.compose.desktop.ide (1.7.3) org.jetbrains.android (251.25410.131) com.eric-li.layout-inspector-v2 (1.0.6) androidx.compose.plugins.idea (251.23774.318) com.github.copilot (1.5.45-243) com.jetbrains.writerside (2025.04.8412) mobi.hsz.idea.gitignore (4.5.6) com.intellij.java.rareRefactorings (251.23774.318) Kotlin: 251.25410.129-IJ
-
- ENVIRONMENT VARIABLES
AWS_JAVA_V1_DISABLE_DEPRECATION_ANNOUNCEMENT=true- This is to disable the Java 1.x use deprecation warning for AWS SDK (S3 bucket)
java --version 1 ↵ 1144 14:08:36
openjdk 21.0.6 2025-01-21
OpenJDK Runtime Environment (build 21.0.6+-13391695-b895.109)
OpenJDK 64-Bit Server VM (build 21.0.6+-13391695-b895.109, mixed mode)
S3 Bucket Free AWS-Compatible Alternative - iDrive e2 - (realityexpanderdev@gmail.com)
- https://app.idrivee2.com/region/LA/buckets/tasky/object-storage?prefix=%2F
- Bucket:
tasky.w1d1.la5.idrivee2-10.com - Developer Guide:
- Installation: https://min.io/open-source/download
- Use AWS CLI to configure: https://aws.amazon.com/cli/
aws configure set aws_access_key_id <access-key-id>
aws configure set aws_secret_access_key <secret-access-key>
aws s3api list-buckets --endpoint-url http://127.0.0.1:9000
aws s3api create-bucket --bucket tasky --endpoint-url http://127.0.0.1:9000
- Startup (CLI):
minio server /Volumes/TRS-83/data - Dashboard: http://127.0.0.1:63009/browser
- MongoDB Atlas (realityexpanderdev@gmail.com)
- https://cloud.mongodb.com/v2/6822725603bd487e26487991#/metrics/replicaSet/682272b8fb8c845215074f78/explorer/tasky/reminder/find
- Database:
Tasky-1 @ AWS Oregon (us-west-2)
- Database:
- https://cloud.mongodb.com/v2/6822725603bd487e26487991#/metrics/replicaSet/682272b8fb8c845215074f78/explorer/tasky/reminder/find
- Credentials Saved in LastPass as Note
- Version 0.0.7 - Uses Configuration Files
- Version 2.0.1 - Fixes Image Uploading, support multiple S3 services, harmonize version numbering
- Version 2.0.2 - Fix database not saving remindAt time, improve readability of code, add comments
