- Clone this project and use your IDE of choice (IntelliJ is recommended)
- This project uses MongoDB for product storage and MySQL for the rest, insert your own MongoDB and MySQL credentials in each services' .env file.
- Make sure Docker and Postman are both installed.
- Run
docker compose up -d
to get Keycloak and Kafka running. - Start all the services. A convenient way to do so is go to
Run
->Edit Configurations
and add all of the services' application, and pressOK
. PressAlt+8
, select all of the services added earlier and press the green button to start. - Open Postman and head to your browser's
http://localhost:8181
and click into Keycloak's administrator console, sign in withusername=admin
andpassword=admin
. - Under
Clients
go tospring-cloud-client -> Credentials
and copy the client secret. - Now go to
Realm Settings
and pressOpenID Endpoint Configuration
, copy thetoken_endpoint
URL. - Go to Postman's
Authorization
tab, set type toOAuth 2.0
and underConfigure New Token
, set the properties as below:
Grant Type = Client Credentials
Access Token URL = {the token endpoint copied earlier}
Client ID = spring-cloud-client
Client Secret = {the client secret copied earlier}
- Press
Get New Access Token
and pressUse Token
. - Now you can start making requests to the endpoints, do remember to get new access tokens from time to time as the token would expire.