An online shopping application which sell the products.
User can search the products they want then add to a shopping cart and proceed to place an order.
To manage and make the users satisfied, all the users' activities are related to the products such as finding, filtering, viewing detail information will be stored.
Entity Relationship Diagram
System Architecture
System Workflow
Configuration Repository
Service Details
How To Run
Generated Data
CURL Commands
To manage and share the configuration between the micro services, configuration repository is required for the entire system.
Repo: icommerce-config
The repository contains the configuration of all services with 'default' profile.
Structure
├── apigateway-default.yml
├── application-default.yml
├── authenticationservice-default.yml
├── eurekaserver-default.yml
├── productservice-default.yml
└── shoppingcartservice-default.yml
The project description, structure and dependencies will be in each project folder.
Service folders
apigateway
authenticationservice
configserver
eurekaserver
zipkinserver
productservice
shoppingcartservice
swaggerservice
Make sure that the machine installed java 8 (at least) and maven.
The services should be started by the order.
mvn clean install
java -jar target/configserver-*.jar
mvn clean install
java -jar target/eurekaserver-*.jar
The place to trace the requests through all services.
Access: http://localhost:9411
java -jar zipkinserver.jar
mvn clean install
java -jar target/apigateway-*.jar
mvn clean install
java -jar target/authenticationservice-*.jar
mvn clean install
java -jar target/productservice-*.jar
mvn clean install
java -jar target/shoppingcartservice-*.jar
The swagger service is a centralized swagger tool for all services.
Access: http://localhost:8085/swagger-ui.html
mvn clean install
java -jar target/swaggerservice-*.jar
For testing purpose, when starting the services, there are some data are generated (based on the configuration) as the table below.
id | name | color | branch | description | price | qty |
---|---|---|---|---|---|---|
1 | MacBook Pro 2013 | White | Apple | Apply MacBook Pro 2013 13 Inch | 43000000 | 20 |
2 | MacBook Air 2017 | White | Apple | Apply MacBook Air 2017 13 Inch | 30000000 | 5 |
3 | Dell Vostro 3590 | Black | Dell | Core i7 - 8GB RAM | 35000000 | 7 |
4 | Acer Predator | Black | Acer | Triton 500 - 8GB RAM | 79900000 | 2 |
Before testing, make sure all services are up and registered to Eureka Server correctly.
Access Eureka Server: http://localhost:9090/
Return the jwt token that use for the requests later.
curl -i -H "Accept: application/json" -H "Content-Type: application/json" -X GET http://localhost:8080/api/v1/auth/login/facebook
Make sure the authorization is replaced by the new token.
curl -d '{"branch":"Apple","price":{"from":10000000,"to":90000000},"sort":{"sortBy":"branch","orderBy":"asc"}}' -H "Content-Type: application/json" -H "Authorization: eyJhbGciOiJIUzI1NiJ9.eyJqdGkiOiIzIiwiaWF0IjoxNTkxNDI5MjYzLCJpc3MiOiJodHRwOi8vaWNvbW1lcmNlLmNvbSIsImV4cCI6MTU5MTQzMjg2M30.RtuIjc2QgyNw2IzINZn5gcOsG1hPmiLbbnosU7bpFUw" -X POST http://localhost:8080/api/v1/product/search
Make sure the authorization is replaced by the new token.
curl -H "Content-Type: application/json" -H "Authorization: eyJhbGciOiJIUzI1NiJ9.eyJqdGkiOiIzIiwiaWF0IjoxNTkxNDI5MjYzLCJpc3MiOiJodHRwOi8vaWNvbW1lcmNlLmNvbSIsImV4cCI6MTU5MTQzMjg2M30.RtuIjc2QgyNw2IzINZn5gcOsG1hPmiLbbnosU7bpFUw" -X GET http://localhost:8080/api/v1/product/1
Make sure the authorization is replaced by the new token.
curl -d '{"productId":2,"qty":1}' -H "Content-Type: application/json" -H "Authorization: eyJhbGciOiJIUzI1NiJ9.eyJqdGkiOiIzIiwiaWF0IjoxNTkxNDI5MjYzLCJpc3MiOiJodHRwOi8vaWNvbW1lcmNlLmNvbSIsImV4cCI6MTU5MTQzMjg2M30.RtuIjc2QgyNw2IzINZn5gcOsG1hPmiLbbnosU7bpFUw" -X POST http://localhost:8080/api/v1/shopping-cart
Make sure the authorization is replaced by the new token.
curl -H "Content-Type: application/json" -H "Authorization: eyJhbGciOiJIUzI1NiJ9.eyJqdGkiOiIzIiwiaWF0IjoxNTkxNDI5MjYzLCJpc3MiOiJodHRwOi8vaWNvbW1lcmNlLmNvbSIsImV4cCI6MTU5MTQzMjg2M30.RtuIjc2QgyNw2IzINZn5gcOsG1hPmiLbbnosU7bpFUw" -X GET http://localhost:8080/api/v1/shopping-cart