Delphi System Designs is a back-end focused initiative that optimized inherited front end legacy code. The front-end consists of the Ratings and Reviews module of a single page e-commerce web application within a service-oriented / microservices architecture. I was tasked with building out a clean and scalable back-end that could handle high production-level web traffic.
-
I ultimately chose PostgresQL because of my preference towards object-relational SQL databases and because it is open source.
-
I wrote three data generation scripts in order to generate over a total of 17 million records spread between the three tables I have in my schema.
- My goal was to optimize the back end in order to verify that the queries used by my API ran under 50ms.
Monitored response time / latency, throughput, and error rate using New Relic
-
Stress tested my service in development using the simulated data I created and realistic requests to the API by scaling the number of request per second (RPS): 1, 10, 100, 1K via Artiller.io
-
Blew passed my goal of reaching 1k RPS with low latency times (2016.52 RPS)
These instructions will get you a copy of the project up and running on your local machine for development and testing purposes.
NodeJS and Xcode
First, navigate to the preferred local directory.
Next, fork the repo to your Github.
Next, access the demo site by cloning the Github repository:
$ git clone https://github.com/Back-end-to-the-Future/ratings-and-reviews-module.git
Navigate inside the directory './ratings_and_reviews_module' and run the following commands:
$ npm i
After all dependencies are installed, run the following commands in two seperate terminal windows to start the server and the react development enviornment:
$ npm run start
$ npm run react-dev
In your browser, open up a window or tab to http://localhost:3000/
- Amazon Web Services using EC2 instances
- Honorio Taveras - Initial work - HonorioTaveras
- https://github.com/Back-end-to-the-Future/QandA_Module
- https://github.com/Back-end-to-the-Future/product-overview
Returns a list of reviews for a particular product. This list does not include any reported reviews.
GET /reviews/:product_id/list
Parameters
Parameter | Type | Description |
---|---|---|
product_id | integer | Specifies the product for which to retrieve reviews. |
page | integer | Selects the page of results to return. Default 1. |
count | integer | Specifies how many results per page to return. Default 5. |
sort | text | Changes the sort order of reviews to be based on "newest", "helpful", or "relevant" |
Response
Status: 200 OK
{
"product": "2",
"page": 0,
"count": 5,
"results": [
{
"review_id": 5,
"rating": 3,
"summary": "I'm enjoying wearing these shades",
"recommend": 0,
"response": "",
"body": "Comfortable and practical.",
"date": "2019-04-14T00:00:00.000Z",
"reviewer_name": "shortandsweeet",
"helpfulness": 5,
"photos": [{
"id": 1,
"url": "urlplaceholder/review_5_photo_number_1.jpg"
},
{
"id": 2,
"url": "urlplaceholder/review_5_photo_number_2.jpg"
},
// ...
]
},
{
"review_id": 3,
"rating": 4,
"summary": "I am liking these glasses",
"recommend": 0,
"response": "Glad you're enjoying the product!",
"body": "They are very dark. But that's good because I'm in very sunny spots",
"date": "2019-06-23T00:00:00.000Z",
"reviewer_name": "bigbrotherbenjamin",
"helpfulness": 5,
"photos": [],
},
// ...
]
}
Returns review metadata for a given product.
GET /reviews/:product_id/meta
Parameters
Parameter | Type | Description |
---|---|---|
product_id | integer | Required ID of the product for which data should be returned |
Response
Status: 200 OK
{
"product_id": "2",
"ratings": {
2: 1,
3: 1,
4: 2,
// ...
},
"recommended": {
0: 5
// ...
},
"characteristics": {
"Size": {
"id": 14,
"value": "4.0000"
},
"Width": {
"id": 15,
"value": "3.5000"
},
"Comfort": {
"id": 16,
"value": "4.0000"
},
// ...
}
Updates a review to show it was found helpful.
PUT /reviews/helpful/:review_id
Parameters
Parameter | Type | Description |
---|---|---|
reveiw_id | integer | Required ID of the review to update |
Response
Status: 204 NO CONTENT