The goal of this project was to build a scalable RESTful API service for the Products component of an e-commerce website. The service was optimized by leveraging database indexing, connection pooling, and Redis caching. The server and Postgres database were containerized with Docker and scaled using Docker Swarm.
- Clone this repo https://github.com/sdc-cirrus/products-api.git
- Install Docker
- Create a .env file in the project's root directory and provide POSTGRES_USER, POSTGRES_PASSWORD, POSTGRES_DB, POSTGRES_HOST and POSTGRES_PORT.
- In the project's root directory, run:
docker-compose up
- Inherited legacy dataset consisting of 40M records.
- Used Node streams to transform data.
- Designed appropriate schemas for the data
- Leveraged Node-PG connection pools and DBeaver to load the data into the local development database and deployed database.
- Incorporated Docker Swarm to replicate multiple instances of the server and scale the API
Used Loader.IO and Artillery to stress test the API.
HTTP METHOD | Endpoint | Returns | Status |
---|---|---|---|
GET | /products/:productId/related | Returns the IDs of products related to the specified product | 200 |
GET | /products/:productId/styles | Returns the all styles available for the given product | 200 |
GET | /products/:productId | Returns all product level information for a specified product id | 200 |
GET | /products/list | Retrieves the list of products | 200 |