A Spring Boot microservice for managing product catalogs in the Shopkart e-commerce platform.
- Product management (CRUD operations)
- Category management
- Integration with external product APIs (FakeStore API)
- MySQL database for persistent storage
- OAuth2 security
- Java 21
- Maven
- Docker and Docker Compose (for containerized deployment)
This project includes Docker configuration for easy deployment.
-
Clone the repository:
git clone <repository-url> cd shopkart-product-catalog-service -
Build and start the containers:
docker-compose up -dThis will:
- Build the application using the Dockerfile
- Start a MySQL database container
- Start the application container
- Set up networking between containers
-
Access the application:
http://localhost:8080/resources
The following environment variables can be configured in the docker-compose.yml file:
| Variable | Description | Default Value |
|---|---|---|
| SPRING_DATASOURCE_URL | JDBC URL for database connection | jdbc:mysql://mysql:3306/product_catalogue_service |
| SPRING_DATASOURCE_USERNAME | Database username | product_root_user |
| SPRING_DATASOURCE_PASSWORD | Database password | product@#123 |
| SPRING_PROFILES_ACTIVE | Active Spring profile | database |
| SPRING_SECURITY_OAUTH2_RESOURCESERVER_JWT_ISSUER_URI | OAuth2 JWT issuer URI | http://auth-server:9090 |
- Ensure MySQL is running and accessible with the credentials in application.properties
- Build the application:
mvn clean package - Run the application:
java -jar target/*.jar
- Products:
/resources/products - Categories:
/resources/categories