Skip to content

API Gateway Service with Spring Cloud Gateway, Spring Boot 3, Java 21

Notifications You must be signed in to change notification settings

musabbozkurt/api-gateway-service

Repository files navigation

Table of Contents

  1. Summary
  2. Getting Started
  3. References

Summary

  • api-gateway-service project established by combination of the following services and features

Services

 * api-gateway
 * payment-service
 * student-service
 * swagger-application
 * openai-service
 * service-registry

Features

 * Spring Cloud Gateway
 * SpringDoc Swagger
 * Event Driven Architecture with RabbitMQ
 * micrometer-tracing dependencies to track the logs
 * Postman collection to test by using Postman
 * Keycloak integration is completed under the payment-service
 * Feign Client secure call with Keycloak integration is completed under the student-service
 * MDC was added to improve logging between microservices
 * Google reCAPTCHA was added to secure endpoint calls
 * HCaptcha repo migration is completed under the student-service
 * openai-service repo migration is completed
 * Spring Cloud Eureka Server and Client integrations are completed with service-registry repo
 * KubernetesDeploymentGuide.md is added

Getting Started

  • To get a local copy up and running please follow these steps

Prerequisites


Installation

  1. Clone the repo
     git clone https://github.com/musabbozkurt/api-gateway-service.git

  1. Run all services

    • (OPTION 1)
      • Run docker-compose --profile start_application up -d --build command in the docker-compose.yml directory
    • (OPTION 2)
      1. Enable spring.docker.compose property and just run ApiGatewayApplication.java to install RabbitMQ, PostgreSQL and Keycloak
      2. Run mvn clean install or mvn clean package command under each service's directory
      3. Run mvn spring-boot:run command under each service's directory

  1. Log in to http://localhost:9090/admin with username: admin and password: admin
    1. Create realm --> Import payment-service-realm-export.json
    2. Clients --> payment-service --> Credentials --> Regenerate copy the value and add it as PAYMENT_CLIENT_SECRET_ENV value in the .env
    3. Users --> Add user --> Username --> payment-service-user
    4. Users --> payment-service-user --> Credentials --> Set password to test and turn off Temporary toggle
    5. Users --> payment-service-user --> Role Mapping --> Assign role add admin role
    6. Restart student-service to fetch PAYMENT_CLIENT_SECRET

  1. Additional information to access endpoints, swagger and actuator

  1. Kubernetes Deployment Guide (OPTIONAL)

References