Skip to content

E commerce microservices backend POC using spring cloud

Notifications You must be signed in to change notification settings

AravindSh/E-Commerce-POC

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

69 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

E-Commerce-POC

E-Commerce Microservices Backend POC using Spring Cloud

High Level Block Diagram

  • Eureka Discovery Server : Holds the information about all the client microservices i.e Admin and User microservice. All clients register themselves with eureka server and use it to communicate with each other.

  • Config Server : Centralized configuration server which facilitates external configuration. Client Microservices connect to this server to obtain necessary configuration information(eg: database host and port). The configuration file can be backed by a version control system like git.

  • Admin Microservice : Serves all the endpoints related to product catalog. Enables administrator of the website to add/update/delete products. MongoDB is used to store product related details.

  • User Microservice : Serves all endpoints related to user such as login by email, new user enrolment, editing existing user profile, fetching user profile details. PostgreSQL is used to store user details. Hibernate ORM is used to interact with PostgreSQL.

Build & Run from Source

  • Initial Setup : Java 1.8.0_191, Apache Maven 3.6.0, PostgreSQL 10.5, MongoDB 4.0.3
  • PostgreSQL Setup :
  • MongoDB Setup :
    • Host: localhost
    • Port: 27017
    • Database Name: e_commerce_db
    • Collection Name: product_catalog
    • Create Sample Data: Open a new terminal/cmd and enter the following commands
      cd ./etc/mongodbDataInit/
      mvn clean package -Dmaven.test.skip=true
      java -jar ./target/mongodbDataInit-0.0.1-SNAPSHOT.jar
  • Run Config Server : Open a new terminal/cmd and enter the following commands
    cd configServer/
    mvn clean package -Dmaven.test.skip=true
    java -jar ./target/configServer-0.0.1-SNAPSHOT.jar
  • Run Eureka Server :
    • Primary Profile - Open a new terminal/cmd and enter the following commands
      cd eurekaServer/
      mvn clean package -Dmaven.test.skip=true
      java -jar -Dspring.profiles.active=primary ./target/eurekaServer-0.0.1-SNAPSHOT.jar
    • Secondary Profile - Open a new terminal/cmd and enter the following commands
      cd eurekaServer/
      java -jar -Dspring.profiles.active=secondary ./target/eurekaServer-0.0.1-SNAPSHOT.jar
  • Run Admin Microservice :
    • Default Profile - Open a new terminal/cmd and enter the following commands
      cd admin/
      mvn clean package -Dmaven.test.skip=true
      java -jar ./target/admin-0.0.1-SNAPSHOT.jar
    • Replica Profile - Open a new terminal/cmd and enter the following commands
      cd admin/
      java -jar -Dspring.profiles.active=replica ./target/admin-0.0.1-SNAPSHOT.jar
  • Run User Microservice : Open a new terminal/cmd and enter the following commands
    cd user/
    mvn clean package -Dmaven.test.skip=true
    java -jar ./target/user-0.0.1-SNAPSHOT.jar
  • Testing Endpoints : Download Postman Rest Client and import postman collection OR use your favourite Rest Client and refer this folder for all endpoint details