Skip to content

sanajitjana/spring-boot-microservices

Repository files navigation

Spring Boot Microservices Project

(Eureka Server, Config Server, API Gateway, Kafka, File Storage, JWT, Authentication, Authorization, Redis, Docker)

About the project

  • This project is based Spring Boot Microservices
  • User can register and login through auth service by user role (ADMIN or USER) through api gateway
  • User 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
  • Job Service
  • User Service
  • Notification Service
  • File Storage

Used Dependencies

  • Core
    • Spring
      • Spring Boot
      • Spring Security
        • Spring Security JWT
        • Authentication
        • Authorization
      • Spring Web
        • FeighClient
      • Spring Data
        • Spring Data JPA
        • PostgreSQL
      • Spring Cloud
        • Spring Cloud Gateway Server
        • Spring Cloud Config Server
        • Spring Cloud Config Client
    • Netflix
      • Eureka Server
      • Eureka Client
  • Database
    • PostgreSQL
  • Kafka
  • Redis
  • Docker
  • Validation
  • File storage
  • Modelmapper
  • Openapi UI
  • Lombok
  • Log4j2

Explore Rest APIs

Method Url Description Valid Request Body Valid Request Params
POST /v1/auth/register Register for User Info
POST /v1/auth/login Login for User and Admin Info
GET /v1/user/getAll Get all user
GET /v1/user/getUserById/{id} Get user by id Info
GET /v1/user/getUserByEmail/{email} Get user by email Info
PUT /v1/user/update Update user Info
DELETE /v1/user/deleteUserById/{id} Delete user by id Info
POST /v1/job-service/category/create Category create Info
GET /v1/job-service/category/getAll Get all categories
GET /v1/job-service/category/getCategoryById/{id} Get category by id Info
PUT /v1/job-service/category/update Update category Info
DELETE /v1/job-service/category/deleteCategoryById/{id} Delete category Info
POST /v1/job-service/job/create Job create Info
POST /v1/job-service/job/getJobsThatFitYourNeeds Get jobs that fit your needs Info
GET /v1/job-service/job/getAll Get all jobs
GET /v1/job-service/job/getJobById/{id} Get job by id Info
PUT /v1/job-service/job/update Update job Info
DELETE /v1/job-service/job/deleteJobById/{id} Delete job Info
POST /v1/job-service/advert/create Adver create Info
GET /v1/job-service/advert/getAll Get all adverts
GET /v1/job-service/advert/getAdvertById/{id} Get advert by id Info
GET /v1/job-service/advert/getAdvertsByUserId/{id} Get advert by user id Info
PUT /v1/job-service/advert/update Update advert Info
DELETE /v1/job-service/advert/deleteAdvertById/{id} Delete advert Info
POST /v1/job-service/offer/makeAnOffer Make an offer Info
GET /v1/job-service/offer/getOfferById/{id} Get offer by id Info
GET /v1/job-service/offer/getOfferByUserId/{id} Get offer by user id Info
GET /v1/job-service/offer/getOfferByAdvertId/{id} Get offer by advert id Info
PUT /v1/job-service/offer/update Update offer Info
DELETE /v1/job-service/offer/deleteOfferById/{id} Delete offer Info
GET /v1/notification/getAllByUserId/{userId}} Get all notification by user id Info
GET /v1/file-storage/download/{id} Download image to file storage Info

Valid Request Body

    http://localhost:8080/v1/auth/register
    
        {
          "username": "string",
          "password": "string",
          "email": "string"
        }
      http://localhost:8080/v1/auth/login
    
       {
         "username": "string",
         "password": "string"
       }
    http://localhost:8080/v1/user/update
    
    form-data:
        {
          "request": {
            "id": "string",
            "username": "string",
            "password": "string",
            "userDetails": {
              "firstName": "string",
              "lastName": "string",
              "phoneNumber": "string",
              "country": "string",
              "city": "string",
              "address": "string",
              "postalCode": "string",
              "aboutMe": "string",
              "profilePicture": "string"
            }
           },
         "file": "string"
        }
    
    Bearer Token : Authorized User or Admin
    http://localhost:8080/v1/job-service/category/create
    
    form data:
    {
      "request": {
        "name": "string",
        "description": "string"
      },
      "file": "string"
    }
    
    Bearer Token : Admin Token
    http://localhost:8080/v1/job-service/category/updateCategory
    
    form data:
    {
      "request": {
        "id": "string",
        "name": "string",
        "description": "string"
      },
      "file": "string"
    }
    
    Bearer Token : Admin Token
    http://localhost:8080/v1/job-service/job/create
    
    form data:
       {
      "request": {
        "name": "string",
        "description": "string",
        "categoryId": "string",
        "keys": [
          "string"
        ]
      },
      "file": "string"
    }
    
    Bearer Token : Admin Token
    http://localhost:8080/v1/job-service/job/updateJob
    
    form data:
     {
      "request": {
        "id": "string",
        "name": "string",
        "description": "string",
        "categoryId": "string",
        "keys": [
          "string"
        ]
      },
      "file": "string"
    }
        
    Bearer Token : Admin Token
    http://localhost:8080/v1/job-service/advert/create
    
    form data:
     {
      "request": {
        "name": "string",
        "description": "string",
        "deliveryTime": 0,
        "price": 0,
        "advertiser": "EMPLOYEE",
        "userId": "string",
        "jobId": "string"
      },
      "file": "string"
    }
    
    Bearer Token : User Token
    http://localhost:8080/v1/job-service/advert/update
    
    form data:
    {
      "request": {
        "id": "string",
        "name": "string",
        "description": "string",
        "deliveryTime": 0,
        "price": 0,
        "status": "OPEN"
      },
      "file": "string"
    }
        
    Bearer Token : Authorized User or Admin
    http://localhost:8080/v1/job-service/offer/makeAnOffer
    
    {
      "userId": "string",
      "advertId": "string",
      "offeredPrice": 0
    }
    
    Bearer Token : User Token
    http://localhost:8080/v1/job-service/offer/update
    
    {
      "id": "string",
      "offeredPrice": 0,
      "status": "OPEN"
    }
        
    Bearer Token : Authorized User or Admin

Valid Request Params

    http://localhost:8080/v1/user/getUserById/{id}
    
    Bearer Token : User Token
    http://localhost:8080/v1/user/getUserByEmail/{email}
    
    Bearer Token : User Token
    http://localhost:8080/v1/user/deleteUserById/{id}
    
    Bearer Token : Authorized User or Admin
    http://localhost:8080/v1/job-service/category/getCategoryById/{id}
    
    Bearer Token : User Token
    http://localhost:8080/v1/job-service/category/deleteCategoryById/{id}
    
    Bearer Token : Admin Token
    http://localhost:8080/v1/job-service/job/getJobById/{id}
    
    Bearer Token : User Token
    http://localhost:8080/v1/job-service/job/getJobsThatFitYourNeeds/{needs}
   
    Bearer Token : User Token
    http://localhost:8080/v1/job-service/job/deleteJobById/{id}
    
    Bearer Token : Admin Token
    http://localhost:8080/v1/job-service/advert/getAdvertById/{id}
    
    Bearer Token : Authorized User or Admin
    http://localhost:8080/v1/job-service/advert/getAdvertByUserId/{id}
    
    Bearer Token : User Token
    http://localhost:8080/v1/job-service/job/deleteAdvertById/{id}
    
    Bearer Token : Authorized User or Admin
    http://localhost:8080/v1/job-service/offer/getOfferById/{id}
    
    Bearer Token : User Token
    http://localhost:8080/v1/job-service/offer/getOfferByUserId/{id}
    
    Bearer Token : User Token
    http://localhost:8080/v1/job-service/offer/getOfferByAdvertId/{id}
    
    Bearer Token : User Token
    http://localhost:8080/v1/job-service/offer/deleteOfferById/{id}
    
    Bearer Token : Authorized User or Admin
    http://localhost:8080/v1/notification/getAllByUserId/{id}
    
    Bearer Token : Authorized User or Admin
    http://localhost:8080/v1/file-storage/download/{id}
    
    Bearer Token : User Token

🔨 Run the App

Local

1 ) Clone project git clone https://github.com/devsyx/spring-boot-microservices.git

2 ) Go to the project's home directory : cd spring-boot-microservices

3 ) Run docker compose docker compose up

4 ) Run Eureka Server

5 ) Run Gateway

6 ) Run Config Server

7 ) Run other services (auth-service, user-service, job-service, notification-service and lastly file-storage)

8 ) For swagger ui localhost:8080/v1/{service-name}/swagger-ui/index.html

Screenshots

Click here to show the screenshot of project

Eureka Server

User Service Swagger UI

Job Service Swagger UI

Auth Service Swagger UI

Notification Kafka UI

File Storage Postman