Coder Social home page Coder Social logo

pad-labs's Introduction

Digital market for stationery materials

System architecture diagram - lab 2

System architecture diagram

Application Suitability

The app is suitable for this project because:

  • as the marketplace grows, specific services which require more resources can be scaled. Such as payment processing, inventory management or search functionality.
  • Each service can be developed and tested independently.
  • The fault of one microservice, let's say payment, won't stop the entire marketplace from working.
  • Each resource can be optimized for its specific workload, There are a lot of similar apps using microservices. Any online marketplace such as Amazon or Ebay, or if talking about stationery materials - Etsy may be a more suitable example.

System architecture diagram

Service Boundaries

  1. User microservice: will encapsulate the log in and register functionalities and the management of user rules and permissions.

  2. Product Catalog Microservice will encapsulate functionalities such as product management (creating and modifying products), search by some criteria and viewing product details.

Technology stack and communication patterns

  1. API Gateway - Golang. API Gateways usually need to handle a large number of incoming requests and route them, and Go is a good choice ecause of its performance. It is also designed for concurrent programming.

  2. Favorites microservice - Python with Flask. This will allow adding products to favorites and to view a user's favorite products. Flask aligns well with the microservices architecture and Python has strong database support.

  3. Product Catalog Microservice - Python with Flask. This will allow creating new products, deleting products by the seller, and searching for products by the users. Flask aligns well with the microservices architecture and Python has strong database support.

  4. Communication patterns - REST API. They follow the standard HTTP methods, are compatible with the web infrastructure and the supports caching.

Data management

Request

POST /add_product - Adding a new product
Request Body:

{
    "user_id": "5",
    "product_name": "product name",
    "product_description": "product description",
    "price": 7
}

Response Body:

{
    "product_id": "e75e82fe-7971-4ca6-94c8-a93e131decf7",
    "user_id": "5",
    "product_name": "product name",
    "product_description": "product description",
    "price": 7
}

GET /search_products?name= - search product by name
Query Parameters - The name of the product to search for.
Response Body:

[
  {
    "productId": "string",
    "userId": "string",
    "name": "string",
    "productDescription": "string",
    "price": "numeric",
    "favorites": "numeric",
    "timestamp": "string"
  },
  {
    "productId": "string",
    "userId": "string",
    "name": "string",
    "productDescription": "string",
    "price": "numeric",
    "favorites": "numeric",
    "timestamp": "string"
  },
  // More matching products can be included here
]

GET /search_all_products - get all available products
Response Body:

[
  {
    "productId": "string",
    "userId": "string",
    "name": "string",
    "productDescription": "string",
    "price": "numeric",
    "favorites": "numeric",
    "timestamp": "string"
  },
  {
    "productId": "string",
    "userId": "string",
    "name": "string",
    "productDescription": "string",
    "price": "numeric",
    "favorites": "numeric",
    "timestamp": "string"
  },
  // More matching products can be included here
]

POST /users/<user_id>/favorites/add - add product to favorites
Request Body:

{
  "productId": "string"
}

Response body

"Product with ID 7 <product_id> added to favorites for user ID: <user_id>"

GET /users/<user_id>/favorites - add product to favorites
Response body

"Favorites for User ID 6: <product_id>, <product_id>, ...."

DELETE delete_product/<product_id> - delete product from sale
Response Body:

"Product with ID e75e82fe-7971-4ca6-94c8-a93e131decf7 has been deleted successfully"

Running the code

To create the databases enter the command docker-compose up --build inside the project directory.

In order to run the code, please run the following files: python favourites.py, python products.py , go run main.go.

Creating docker for the whole system in progress...

To test the app you can use the requests from the Postman Collection. Use the requests from the gateway folder.

pad-labs's People

Contributors

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