Skip to content

FernandoAlvarez28/kotlin-crud-mongodb

Repository files navigation

Kotlin CRUD w/ MongoDB

Small project to experiment and learn Kotlin and other libraries.

Based on the Postgres CRUD: https://github.com/FernandoAlvarez28/kotlin-crud

Requirements

Contains/Uses

  • Java 17.
  • Dockerfile.
  • Basic REST API endpoints with Kotlin, Spring Boot 3.1.1 and Spring WebFlux.
  • MongoDB database via Docker.
    • Connection informations here.
  • Spring Security with JWT and Spring WebFlux.
  • Fake "Users API" with Mockoon via Docker.
  • Load test with K6 via Docker.

How to run

Locally

  1. Clone this repository.
  2. Import this project on your Kotlin capable IDE, like IntelliJ.
  3. Run the dockerized MongoDB database (or you can use your own MongoDB instance).
  4. Run the dockerized Mockoon.
  5. Run KotlincrudApplication.kt.
  6. Access the endpoints exposed at http://localhost:8080.
    1. Use the available Postman collection + environment.
    2. Use the login endpoint to generate a JWT token; it will be save on your active environment and used by the other endpoints.

Via Docker

  1. Clone this repository.
  2. Build the Dockerfile and run the Docker image with its dependencies using one of the methods:
  3. Run KotlincrudApplication.kt.
  4. Access the endpoints exposed at http://localhost:8080.
    1. Use the available Postman collection + environment.
    2. Use the login endpoint to generate a JWT token; it will be save on your active environment and used by the other endpoints.