A Spring Boot-based microservices architecture for an e-commerce platform.
Each service is modular, independently deployable, and communicates through Netflix Eureka for service discovery.
- 🔹 NetflixEurekaApplication – Service Registry using Netflix Eureka
- 🔹 EcommerceSprig – Product & Category Management Service
- 🔹 EcommerceOrderService – Order Processing & Management Service
Ensure the following tools are installed on your system:
- 🔸 Java 17 or higher
- 🔸 Gradle (or use the provided
./gradlew) - 🔸 MySQL Server
- 🔸 Postman or cURL (for API testing)
Each service uses environment variables, configurable via a .env file or application.properties.
PORT=3000
EcommerceDB=jdbc:mysql://localhost:3306/ecommerce_db
DatasourceUsername=root
DatasourcePassword=password
spring.application.name=EcommerceService
server.port=${PORT}
spring.datasource.url=${EcommerceDB}
spring.datasource.username=${DatasourceUsername}
spring.datasource.password=${DatasourcePassword}
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
spring.jpa.hibernate.ddl-auto=update
eureka.client.service-url.defaultZone=http://localhost:8761/eurekagit clone https://github.com/sktagrwl/NetflixEurekaApplication
git clone https://github.com/sktagrwl/EcommerceSprig
git clone https://github.com/sktagrwl/EcommerceOrderServiceCREATE DATABASE ecommerce_db;
CREATE DATABASE order_db;Update the .env or application.properties for each service.
Run each service in a separate terminal:
cd NetflixEurekaApplication && ./gradlew bootRun
cd EcommerceSprig && ./gradlew bootRun
cd EcommerceOrderService && ./gradlew bootRun📍 Open your browser and go to:
http://localhost:8761
+-------------------------+
| Eureka Server |
| (Service Registry) |
+-----------^-------------+
|
+---------------+---------------+
| |
+---------------------+ +-------------------------+
| Product Service | <--> | Order Service |
| (EcommerceSprig) | | (EcommerceOrderService) |
+---------------------+ +-------------------------+
- Add / Edit / Delete products and categories
- Retrieve products by ID or category
- Built with layered architecture
- Schema versioning with Flyway
- Unit tests with JUnit & Mockito
- Test coverage via Jacoco
- Place new orders and retrieve them
- Automatically stores associated order items
- Uses dotenv-java for
.envsupport - Eureka-based service discovery
- Centralized service registry
- Tracks service availability and health
GET /api/products– Get all productsGET /api/products/id/{id}– Get product by IDGET /api/categories– Get all categoriesPOST /api/categories– Create a new categoryGET /api/categories/{id}/products– Products under category
POST /api/orders– Create a new orderGET /api/orders/{id}– Get order by ID
- MockMvc for integration testing
- Mockito for mocking unit test dependencies
- Jacoco for test coverage reports
./gradlew testOpen in browser:
build/reports/jacoco/test/html/index.html
- Java 17
- Spring Boot (MVC, REST, Eureka, JPA)
- MySQL
- Gradle
- Flyway
- Dotenv Java
- JUnit & Mockito
- Jacoco
- Lombok
- All services are modular and independently deployable
- Service discovery handled via Netflix Eureka
- Environment configuration supports
.envfiles - Structured and tested for scalability and maintainability