Skip to content

FernandoAlvarez28/kotlin-crud

Repository files navigation

Kotlin CRUD w/ PostgreSQL

Small project to experiment and learn Kotlin and other libraries.

There is also a CRUD with MongoDB: https://github.com/FernandoAlvarez28/kotlin-crud-mongodb

Requirements

Contains/Uses

  • Java 17.
  • Dockerfile and GitHub Actions to publish amd64 and arm64 images on Docker Hub and Amazon Elastic Container Registry/Service (ECR and ECS).
  • Basic REST API endpoints with Kotlin, Spring Boot 3.1.1 and Spring WebFlux.
  • PostgreSQL database via Docker with Flyway migration.
    • Connection informations here.
  • Spring Data R2DBC (reactive driver for relational databases, similar to JPA).
  • 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 Postgres database (or you can use your own Postgres 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.