The Product Service is a Spring Boot application that provides product details functionalities. It utilizes MongoDB for data storage, Index Service for indexing products, Image Service for handling product images and integrates with Swagger for API documentation.
- Features
- Technologies Used
- Getting Started
- Configuration
- API Documentation
- Error Messages
- Contributing
- License
- Saving Product Details to MongoDB database and indexing in SOLR
- Getting PDP details for the product
- Deleting and Deindexing Product Details
- Getting Products for particular user
- APIs are authenticated using JWT token
- API documentation using Swagger
- Error messages for common scenarios
- Java 17
- Spring Boot 3.0.5
- MongoDB
- Swagger (OpenAPI)
- Actuator
- Feign Client
- Jacoco
To get started with the Product Service, follow these steps:
- Clone the repository:
git clone https://github.com/PublicisSapient/retailsustainability-pem-product-service.git
- Clone the repository:
git clone https://github.com/PublicisSapient/retailsustainability-pem-common-framework.git
- Navigate to the common framework directory:
cd common-framework
- Build the common-framework:
mvn clean build
- Configure the environment variables to your environment (see Configuration)
- Build the project:
mvn clean build
- Navigate to the target directory:
cd target
- Run the application:
java -jar product-service.jar
The service will start running on the configured port (default: 9000). You can access the APIs using the base URL http://localhost:9000/api/v1/product-service
and Swagger UI: http://localhost:9000/api/v1/product-service/swagger-ui
The application can be configured using the following properties:
- mongodb-root-password: The Password for MongoDB database
- MONGODB_SERVICE_HOST: The host of MongoDB (e.g. localhost)
- MONGODB_SERVICE_PORT: The port of the MongoDB database (e.g. 27017)
- SVC_IMG: The url to Image Service (e.g. http://localhost:9002/api/v1, https://p2pmarket.dev/api/v1)
- SVC_INX: The url to Index Service (e.g. http://localhost:9001/api/v1) [for index service to use we need to bind cluster port to localhost using gcloud
kubectl -n pem port-forward svc/index 9001:9001
] - SVC_PRF: The url to Profile Service (e.g. http://localhost:9004/api/v1, https://p2pmarket.dev/api/v1)
- SVC_NOT: The url to Notification Service Service (e.g. http://localhost:9006/api/v1, https://p2pmarket.dev/api/v1)
Ensure that you have MongoDB installed and running before starting the service.
The product Service provides API documentation using Swagger(Open API). You can access the Swagger UI by navigating to http://localhost:9000/api/v1/product-service/swagger-ui
in your web browser. This UI provides detailed information about the available API endpoints, request/response schemas
The application defines a set of error messages for common scenarios. These messages are configurable and can be found in the application.yml
file. You can customize the error messages according to your needs.
Contributions to the Product Service are welcome! If you find any issues or have suggestions for improvements, please open an issue or submit a pull request.
- Fork the repository.
- Create your feature branch:
git checkout -b feature/my-new-feature
. - Commit your changes:
git commit -m 'Add some feature'
. - Push to the branch:
git push origin feature/my-new-feature
. - Submit a pull request.
The Product Service is open-source and available under the MIT License.
Feel free to modify and adapt the code to suit your needs.