Code Monkey home page Code Monkey logo

phincommerce's Introduction


Phincommerce

๐Ÿ›’ A simple ecommerce REST API to help people buy products online ๐Ÿ›’


Table of Contents

Description

^ back to top ^

Phincommerce is a reactive REST API that implements microservice architecture to help people buy products online. It is created for the final project in the Java phase of the Backend Development Training.

API Docs

^ back to top ^

Minimum Requirements

^ back to top ^

  • Add a new order.
  • Display list of orders.
  • Update order status (created, completed, or failed).
  • Update product quantity (deduct or add).
  • Add a transaction detail (approved or rejected).
  • Update balance amount (debit or credit).

Success scenario

Product deduction failed

Payment rejected

Tech Stack

^ back to top ^

Run Locally

^ back to top ^

  • Make sure you have Java, PostgreSQL, & Kafka installed on your computer.

  • Connect to the PostgreSQL server by providing a user name & password.

    psql -U postgres

    Then create databases for product service, order service, & payment service. You can name it as phincommerce_product, phincommerce_order, & phincommerce_payment.

    CREATE DATABASE phincommerce_product;
    CREATE DATABASE phincommerce_order;
    CREATE DATABASE phincommerce_payment;
  • Clone the repo.

    git clone https://github.com/nadiannis/phincommerce.git
    cd phincommerce
  • Run the zookeeper server & Kafka broker.

    cd kafka
    ./bin/zookeeper-server-start.sh ./config/zookeeper.properties
    ./bin/kafka-server-start.sh ./config/server.properties
  • Connect each service to its respective database by writing the information about the database you use in the application.properties file.

    # example
    
    spring.r2dbc.url=r2dbc:postgresql://localhost:5432/phincommerce_order
    spring.r2dbc.username=postgres
    spring.r2dbc.password=pass1234
    spring.r2dbc.driver-class-name=org.postgresql.Driver
    
  • Add Kafka config to application.properties in the order-service & orchestrator-service.

    # Kafka producer
    spring.kafka.producer.bootstrap-servers=localhost:9092
    spring.kafka.producer.key-serializer=org.apache.kafka.common.serialization.StringSerializer
    spring.kafka.producer.value-serializer=org.springframework.kafka.support.serializer.JsonSerializer
    
    # Kafka consumer
    spring.kafka.consumer.bootstrap-servers=localhost:9092
    spring.kafka.consumer.group-id=phincommerce
    spring.kafka.consumer.key-deserializer=org.apache.kafka.common.serialization.StringDeserializer
    spring.kafka.consumer.value-deserializer=org.apache.kafka.common.serialization.StringDeserializer
    spring.kafka.consumer.properties.spring.json.trusted.packages=*
    
  • Install the common project.

    cd ./common
    ./mvnw clean install
  • Run the orchestrator service first. The Kafka topics needed will be created. The web server will run on port 8080.

  • Then run other services. The product service will run on port 8081, order service will run on port 8082, & payment service will run on port 8083.

phincommerce's People

Contributors

nadiannis 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.