Code Monkey home page Code Monkey logo

e-commerce-microservices-sample's Introduction

Sample E-Commerce App using Microservices Architecture

A fictitious cloud-native e-commerce sample application using micro-services architecture powered by Spring Cloud, Docker, React.JS, MongoDB, Redis and more.

This sample e-commerce application demonstrates how to build an application using microservices architecture paradigm with Polyglot Languages (Java, JavaScript) & Polyglot Persistance software (MongoDB, Redis). This sample application includes following functional microservices & infrastructure microservices. All of these microservices are independently deployable applications and are organized around business capabilities.

###Functional Microservices

  • Product Catalog Microservice
  • Cart Microservice
  • Order Management Microservice [TODO]
  • Inventory Microervice [TODO]
  • Pricing Microservice [TODO]

###Infrastructure Microservices

  • Global Configuration Microservice
  • Service Registration & Discovery Miroservice
  • API Gateway [TODO]

High-level Block Diagram

The application is setup as multi-level project where each microservice is arranged as a sub-module under single parent project. It enables to run each microservice individually.

##Prerequisites

##Installation

Clone Repository

Clone respository source code by executing following instruction to any folder on your machine,

git clone https://github.com/venkataravuri/e-commerce-microservices-sample.git
cd e-commerce-microservices-sample

###Building Application

Building Microservices

Gradle has been used as a build tool to build Spring Boot based Microservices applications. Issue following command on your terminal/console window,

gradlew build

This command might take a while for first time as it needs to download serveral dependency libraries from Maven repository. This command will build & package all microservice applications.

Building Docker Containers & Run Containers

Upon successful building of microservices, you can now build Docker images and run containers Docker host on your machine, Note: Prior to execute below instructions, ensure you have started 'Docker Quickstart Terminal'. If you are new to docker, read more about Docker at, https://docs.docker.com/engine/getstarted/ Excute below commands in sequence on 'Docker Quickstart Terminal',

cd <Replace this with e-commerce-microservices-sample folder path>
docker-compose build --no-cache

Above command may take time for first time, as it needs to download base images. All docker containers are based on light-weight LinuxOS called 'Alpine Linux', which is hardly ~5MB.

Issue following command, to run Docker containers,

docker-compose up

Above command starts all Microsevices Docker containers as specified in 'docker-compose.yml' file. Important Note: Some Microservices may not start properly due to interdependcy on infrastructure Microservices' containers. Unfortunately, docker-compose command will NOT wait till dependent containers started. It will start all containers simultaneously. You may need to re-start failed containers manually. I recommend to use 'Kitematic (Alpha)' console shipped with 'Docker Toolbox' to restart failed containers.

You can bring the docker containers down (when needed) using below command,

docker-compose down --remove-orphans

Building Frontend App (React.JS)

Frontend application is a Single Page Appliction built using React.JS library. The source code of this application is available under, 'ecommerce-app' folder. Issue following commands in sequence to build & run frontend app,

cd ecommerce-app
npm install
npm run start-dev

Note: 'npm install' command may take a while, as it needs to download all dependent npm modules used by frontend app.

Once above instructions successfully executed, you can view e-commerce application by browsing below URL, http://localhost:3333

##Prodcut Catalog Microservice

Overview

Product Catalog Microservice manages e-commerce application's products. This microservice is built as Spring Boot application with MongoDB as persistance store for product information.

REST API

Product Catalog REST API supports following opertations,

Method URI Description Parameters Request JSON Response JSON
GET /products/recommendations List of recommended products None [TODO]
GET /products/{id} Fetch product information based on id None [TODO]
PUT /products Adds new product [TODO] [TODO]
POST /products/{id} Updates existing product [TODO] [TODO]

##Cart Microservice

Overview

Cart Microservice provides e-commerce application's shopping cart functionality. This microservice is built as Spring Boot application with Redis as InMemory persistance store for cart information.

REST API

Cart REST API supports following opertations,

Method URI Description Parameters Request JSON Response JSON
GET /cart/{id} Fetches cart by id None [TODO]
POST /cart/{id} Creates or updates cart [TODO] [TODO]

e-commerce-microservices-sample's People

Contributors

venkataravuri avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.