This is the source code about my MongoDB articles.
Mastering Kotlin: Creating an API With Ktor and MongoDB Atlas
Beyond Basics: Enhancing Kotlin Ktor API With Vector Search
Kotlin's simplicity, Java interoperability, and Ktor's user-friendly framework combined with MongoDB Atlas' flexible cloud database provide a robust stack for modern software development. Together, we'll demonstrate and set up the Ktor project, implement CRUD operations, define API route endpoints, and run the application. By the end, you'll have a solid understanding of Kotlin's capabilities in API development and the tools needed to succeed in modern software development.
- Kotlin - Programming Language
- Ktor - Asynchronous framework
- Koin - Dependency Injection framework
- MongoDB Kotlin Driver — Kotlin Coroutine
Follow the steps below to get the Fitness Tracker App up and running local / MongoDB Atlas.
-
Clone the repository to your local machine:
git clone https://github.com/your-username/fitness-tracker-app.git cd fitness-tracker
-
Start the application using Docker Compose:
docker-compose up -d
-
Compile the application jar using Gradle:
./gradlew shadowJar
-
Run the application
java -jar -DMONGO_URI="mongodb://localhost:27017/fitness/" -DMONGO_DATABASE="my_database" build/libs
-
Clone the repository to your local machine:
git clone https://github.com/your-username/fitness-tracker-app.git cd fitness-tracker
-
Compile the application jar using Gradle:
./gradlew shadowJar
-
Run the application
java -jar -DMONGO_URI="mongodb+srv://<username>:<password>@<cluster>/?retryWrites=true&w=majority" -DMONGO_DATABASE="my_database" build/libs
To explore the API documentation and interact with the Fitness Tracker App, you can use Swagger. Open your web browser and navigate to: