Skip to content

kirsing/StoreApp

Repository files navigation

Store Application - Spring Boot Microservice Example(Eureka Server, Config Server, API Gateway, Services , Grafana Stack, RabbitMQ Redis, Resilience4j, Docker, Kubernetes)

StoreApp

About the project

  • This project is based Spring Boot Microservices with the usage of Docker and Kubernetes
  • Customer can't register himself but login through auth service (provided by Okta) by user role (ADMIN or USER) through api gateway
  • Customer can send any request to relevant service through api gateway with its bearer token

8 services whose name are shown below have been devised within the scope of this project.

  • Config Server
  • Eureka Server
  • API Gateway
  • Auth Service
  • Order Service
  • Payment Service
  • Product Service
  • Message Service

Explore Rest APIs

Method Url Description Valid Request Body Valid Request Params Valid Request Params and Body
POST /product Add Product Info
GET /product/{product_id} Get Product By Id Info
PUT /reduceQuantity/{product_id}?quantity={quantity_value} Reduce Quantity of Product Info
POST /order/placeorder Place Order Info
GET /order/{order_id} Get Order By Id Info

Used Dependencies

  • Core
    • Spring
      • Spring Boot
      • Spring Boot Test (Junit, WireMock and Mockito)
      • Spring Security
      • Spring Web
        • RestTemplate
        • FeignClient
      • Spring Data
        • Spring Data JPA
      • Spring Cloud
        • Spring Cloud Gateway Server
        • Spring Cloud Config Server
        • Spring Cloud Config Client
    • Netflix
      • Eureka Server
      • Eureka Client
  • Database
    • MySQL
  • Redis
  • Grafana Stack
  • Docker Compose
  • Google Jib
  • Kubernetes
  • RabbitMQ
  • Junit
  • Log4j2

Valid Request Body

    Customer Role
    http://localhost:8072/authenticate/login
    
        username : customer@store.com,
        password : user12345!
    
    Admin Role
    http://localhost:8072/authenticate/login
        username : admin@admin.com,
        password : store.123456789!
    http://localhost:8072/services/products/product
    
    {
        "name" : "Google Pixel 8",
        "price" : 1000,
        "quantity" : 15
    }
    
    Bearer Token : User (ADMIN ROLE) Token
    http://localhost:8072/services/orders/order/placeOrder
    
    {
        "productId" : 1,
        "totalAmount" : 100,
        "quantity" : 1,
        "paymentMode" : "CASH"
    }
    
    Bearer Token : User (CUSTOMER Role) Token

Valid Request Params

    http://localhost:8072/services/products/product/reduceQuantity/1?quantity=1
    
    Bearer Token : User Token

Valid Request Params and Body

    http://localhost:8072/services/products/product/{productId}
    
    Bearer Token : Both Token
    http://localhost:8072/services/payments/payment/order/{orderId}
    
    Bearer Token : Both Token
    http://localhost:8072/services/orders/order/{orderId}"
    
    Bearer Token : Both Token

Additional information

If Docker:

Access to see queses by RabbitMQ:

http://localhost:15672/
user: guest
password: guest

Access to see metrics, tracing and so on, Grafana Dashboard

http://localhost:3000/
user: admin
password: admin

If K8s:

Access to see queses by RabbitMQ:

kubectl port-forward --namespace default svc/rabbitmq 5672:5672 echo "URL : http://127.0.0.1:15672/"

Access to see metrics, tracing and so on, Grafana Dashboard

echo "Browse to http://127.0.0.1:8080" 
kubectl port-forward svc/grafana 3000:3000 &
echo "User: admin" 
echo "Password: $(kubectl get secret grafana-admin --namespace default -o jsonpath="{.data.GF_SECURITY_ADMIN_PASSWORD}" | base64 -d)"

🔨 Run the App

1 ) Download your project from this link https://github.com/kirsing/StoreApp

2 ) Go to the project's home directory : cd ~/StoreApp-main

Docker

1 ) Install Docker Desktop. Here is the installation https://www.docker.com/get-started/ :

2 ) Go to the specific directory: cd ~/StoreApp-main/docker-compose/local

3 ) Run all Containers through this command - docker compose up -d

Kubernetes

1 ) Install minikube or enable Kubernetes on Docker Desktop

2 ) Install Helm https://helm.sh/docs/intro/quickstart/

3 ) Go to the directory : cd ~/StoreApp/helm/env

4 ) Install all Helm Charts using Helm through this command helm install <your-application-name> dev-env

Screenshots

Click here to show the screenshot of project

Docker Desktop to show all running containers

Okta

Grafana

RabbitMQ

Kubernetes Dashboard