
This project consists of four microservices: user-service
, order-service
, payment-service
, and notification-service
. Each service has its own functionality and interacts with either a PostgreSQL or MongoDB database. Contract testing is implemented using Keploy to ensure the services work as expected.
- Database: PostgreSQL
- Endpoints:
POST /user
: Create a new user in the PostgreSQL database.GET /user
: Retrieve user data from the PostgreSQL database.
- Database: MongoDB
- Endpoints:
POST /order
: Create a new order in the MongoDB database after checking if the order ID exists in the PostgreSQL database.GET /order
: Retrieve order data from the MongoDB database.
- Functionality: Updates the payment status of an order in the MongoDB database.
- Endpoint:
POST /pay
: Updates the payment status by hitting thelocalhost:8081/order/update-payment
endpoint.
- Functionality: Updates the email status of an order in the MongoDB database.
- Endpoint:
POST /pay
: Updates the email status by hitting thelocalhost:8081/update-email
endpoint.
Before running the project, ensure you have the following installed:
- Docker
- Docker Compose
- Keploy (running via Docker, as it doesn't support macOS natively)
- Clone the Repository:
git clone https://github.com/arpit529srivastava/contract_testing_keploy.git
- Start the Databases and Services:
Use Docker Compose to start the PostgreSQL and MongoDB databases along with the microservices.docker-compose up -d
- Verify Services :
Ensure all services are running by checking their respective endpoints:
- User-Service: localhost:8080/user
- Order-Service: localhost:8081/order
- Payment-Service: localhost:8082/pay
- Notification-Service: localhost:8083/pay
- User-Service:
POST /users: Create a new user.<br>
GET /users: Retrieve user data.
- Order-Service:
POST /orders: Create a new order.
GET /orders: Retrieve user data.
- Payment-Service:
POST /pay: Update payment status.
- Notification-Service:
POST /notify: Update email status and send the email.