Skip to content

Basic skeleton for Spring Boot Microservices. It includes spring spring security for basic Auth. Spring Cloud Gateway is also implemented as an API gateway. Lots of the spring cloud component integrated. UI component for the same can be found here: https://github.com/Nasruddin/angular-based-microservice

Nasruddin/spring-boot-based-microservices

Repository files navigation

spring-boot-based-microservices

Basic skeleton for Spring Boot Microservices. It includes spring security for basic Auth. Spring cloud gateway is also implemented as an Edge Service. Lots of the spring cloud component integrated.

How to run

  • Navigate to root of the project
    cd spring-boot-based-microservices
  • Build the project
    mvn clean package -DskipTests     

Maven Build

  • Locate the docker directory from the root directory and run docker compose to startup the containers
    cd docker && docker-compose up --build

Docker Compose Build

  • Check if all our services are running and healthy
    docker ps

Docker PS

  • Let's check if all the services are up and running. We will reach to eureka server using gateway. Open the browser and hit http://localhost:8443/eureka/web You will need to authenticate yourself before accessing the endpoint.
username : user
password : password

Eureka

curl -k http://writer:secret-writer@localhost:8443/oauth2/token -d grant_type=client_credentials -d scope="course:read course:write" 

Swagger OpenApi Specs Swagger OpenApi Specs

Note : Currently this project uses Spring Authorization server. Keep in mind, I'm planning to enhance the whole OAuth flow because it's in shaky state right now and, you may some face issues. We may also move to keycloak.

These instructions are basic starting point and, the project does lot of other stuff like elastic and mongo configuration etc. Please feel free to play around. I really want to maintain this and keep up-to-date, however my current role doesn't give me enough spare time. Therefore, contributors and their contributions are welcome :)