spring-boot-microservices
spring-boot-microservices copied to clipboard
Spring Boot Microservices project (Gateway, Config Server, Kafka)
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
- Spring
- 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
Register for User
http://localhost:8080/v1/auth/register
{
"username": "string",
"password": "string",
"email": "string"
}
Login for User and Admin
http://localhost:8080/v1/auth/login
{
"username": "string",
"password": "string"
}
Update User
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
Create Category
http://localhost:8080/v1/job-service/category/create
form data:
{
"request": {
"name": "string",
"description": "string"
},
"file": "string"
}
Bearer Token : Admin Token
Update Category
http://localhost:8080/v1/job-service/category/updateCategory
form data:
{
"request": {
"id": "string",
"name": "string",
"description": "string"
},
"file": "string"
}
Bearer Token : Admin Token
Create Job
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
Update Job
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
Create Advert
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
Update Advert
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
Make An Offer
http://localhost:8080/v1/job-service/offer/makeAnOffer
{
"userId": "string",
"advertId": "string",
"offeredPrice": 0
}
Bearer Token : User Token
Update Offer
http://localhost:8080/v1/job-service/offer/update
{
"id": "string",
"offeredPrice": 0,
"status": "OPEN"
}
Bearer Token : Authorized User or Admin
Valid Request Params
Get User By Id
http://localhost:8080/v1/user/getUserById/{id}
Bearer Token : User Token
Get User By Email
http://localhost:8080/v1/user/getUserByEmail/{email}
Bearer Token : User Token
Delete User By Id
http://localhost:8080/v1/user/deleteUserById/{id}
Bearer Token : Authorized User or Admin
Get Category By Id
http://localhost:8080/v1/job-service/category/getCategoryById/{id}
Bearer Token : User Token
Delete Category By Id
http://localhost:8080/v1/job-service/category/deleteCategoryById/{id}
Bearer Token : Admin Token
Get Job By Id
http://localhost:8080/v1/job-service/job/getJobById/{id}
Bearer Token : User Token
Get Jobs That Fit Your Needs
http://localhost:8080/v1/job-service/job/getJobsThatFitYourNeeds/{needs}
Bearer Token : User Token
Delete Job By Id
http://localhost:8080/v1/job-service/job/deleteJobById/{id}
Bearer Token : Admin Token
Get Advert By Id
http://localhost:8080/v1/job-service/advert/getAdvertById/{id}
Bearer Token : Authorized User or Admin
Get Advert By User Id
http://localhost:8080/v1/job-service/advert/getAdvertByUserId/{id}
Bearer Token : User Token
Delete Advert By Id
http://localhost:8080/v1/job-service/job/deleteAdvertById/{id}
Bearer Token : Authorized User or Admin
Get Offer By Id
http://localhost:8080/v1/job-service/offer/getOfferById/{id}
Bearer Token : User Token
Get Offer By User Id
http://localhost:8080/v1/job-service/offer/getOfferByUserId/{id}
Bearer Token : User Token
Get Offer By Advert Id
http://localhost:8080/v1/job-service/offer/getOfferByAdvertId/{id}
Bearer Token : User Token
Delete Offer By Id
http://localhost:8080/v1/job-service/offer/deleteOfferById/{id}
Bearer Token : Authorized User or Admin
Get All Notification By User Id
http://localhost:8080/v1/notification/getAllByUserId/{id}
Bearer Token : Authorized User or Admin
Download Image to File Storage
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

