Simple demonstration of a shopping cart microservice
Table of Contents
This is a simple microservice that demonstrate functionalities of a shopping cart. A shopping cart on an ecomerce site is a service that facilitates the purchase of a product or service by accepting customers payment and sending to other services for processing.
Features of the shopping cart:
- Simple functionalities for adding product, categories, users and discounts to bootstrap the shopping cart.
- Add items to a cart.
- Remove items from a cart
- Edit items in a cart.
- Order selected items
The following is an ERD Diagram of the project.
The following is a list of technologies used in the project:
- Language: JavaScript
- Database: mysql
- Server: Node, Express
- Testing: Jest, supertest
- ORM used: Sequelize
- Caching: Redis (in progress)
In this section we discuss how to setup and run the application locally.
You should have npm and mysql installed.
-
Clone the repo
git clone https://github.com/erodrago/shopping-cart.git
-
Install NPM packages: Navigate to the cloned directory and run
npm install
-
Enter your DB configurations in
.env
file. the format of the dot env as described in .env.exampleDATABASE=db_name DATABASE_USER=db_username PASSWORD=db_password HOST=localhost DATABASE_DIALECT=mysql PORT=3000
-
Set up database table by running:
npm run db:setup
You can run by executing on terminal either:
npm start
or
npm run dev
To run tests
- Initialize test database:
npm run db:create:test
- Run tests
npm test
After running the project, to view documentation via swagger, in your browser navigate to:
http://localhost:PORT/api-docs
Alternatively in the project directory there is a directory called postman, navigate and download the json, import the Json file on postman and you will be ready to test the APIs.
- Docker integration
- Security integration
- Demonstration of caching
- Experiment with graphql
- Fork the Project
- Create your Feature Branch (
git checkout -b feature/AmazingFeature
) - Commit your Changes (
git commit -m 'Add some AmazingFeature'
) - Push to the Branch (
git push origin feature/AmazingFeature
) - Open a Pull Request