Skip to content

A playground for REST API with Spring framework and Kotlin

Notifications You must be signed in to change notification settings

ablil/spring-starter

Repository files navigation

The project is an implementation of a RESTfull API, and it serves as a playground for me test new concepts. It's developed primarily with Spring framework and Kotlin and another bunch of technologies

Get started

  1. Start a bunch of containers docker-compose up -d database keycloak
  2. Run the app ./gradlew bootRun
  3. Check app health curl http://localhost:8080/actuator/health

docker-compose up -d will start all containers behind a nginx container exposed on port 80

Links

This is a non-exhaustive list of some useful links:

Development

Keycloak

Keycloak container import a sample realm with a couple of users and clients; check local/realm.json for details.

Get access token:

curl 'http://0.0.0.0:8081/realms/springstarter/protocol/openid-connect/token' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--data-urlencode 'client_id=springstarter' \
--data-urlencode 'username=bob' \
--data-urlencode 'password=supersecurepassword' \
--data-urlencode 'grant_type=password'

API specification

OpenAPI Generator Gradle plugin is used to generate code from Open API specifications with Spring generator, and they are defined in src/main/resources/specs .

Generate code

./gradlew openApiGenerate

Docker

Jib Gradle plugin is used to generate docker image, it's already configured as a part of the build steps. And there is a GitHub action that pushes the image to ghrc

Generate image

./gradlew jibDockerBuild

Known issues

About

A playground for REST API with Spring framework and Kotlin

Topics

Resources

Stars

Watchers

Forks