FE
FernandoAlvarez28/kotlin-crud-mongodb
Kotlin CRUD with Spring WebFlux + Security + MongoDB
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
- Java 17 and a Kotlin/Gradle capable IDE.
- Or Docker and docker-compose.
Contains/Uses
- Java 17.
- Dockerfile.
- Basic REST API endpoints with Kotlin, Spring Boot 3.1.1 and Spring WebFlux.
- Check/Import the Postman collection + environment.
- MongoDB database via Docker.
- Connection informations here.
- Spring Security with JWT and Spring WebFlux.
- Based on soasada's guide.
- Fake "Users API" with Mockoon via Docker.
- Load test with K6 via Docker.
How to run
Locally
- Clone this repository.
- Import this project on your Kotlin capable IDE, like IntelliJ.
- Run the dockerized MongoDB database (or you can use your own MongoDB instance).
- Run the dockerized Mockoon.
- Run KotlincrudApplication.kt.
- Access the endpoints exposed at http://localhost:8080.
- Use the available Postman collection + environment.
- 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
- Clone this repository.
- Build the Dockerfile and run the Docker image with its dependencies using one of the methods:
- Makefile:
$ make
- Docker compose:
./docker$ docker-compose up --build kotlincrud-mongodb
- More details at docker/README.md#kotlincrud-mongodb.
- Makefile:
- Run KotlincrudApplication.kt.
- Access the endpoints exposed at http://localhost:8080.
- Use the available Postman collection + environment.
- Use the login endpoint to generate a JWT token; it will be save on your active environment and used by the other endpoints.
On this page
Languages
Kotlin88.1%JavaScript9.4%Dockerfile1.4%Shell0.7%Makefile0.4%
Contributors
MIT License
Created July 17, 2023
Updated July 17, 2023