- NodeJS
- Express
- MongoDB/Mongoose
- Bcryptjs
- Winston
- RabbitMQ
- Nginx
- Docker
Online shop app that's divided into 3 microservices.
- Users are authenticated using JWTs, where a token is created when a customer logs-in with valid credentials. Passwords are also encrypted using Bcrypt.
- Authorization is managed using a middleware with the following role:
- Logged-in customer:
- This permission allows customer to interact with Product and Shopping services.
- Logged-in customer:
- This service responsible of the main customer operations.
- Authentication
- Customers can # and login through this service.
- Retrieve customer actions that's passed from other services.
- Profile
- Whishlist
- Cart
- Orders
- Authentication
- This service is responsible of the Product operations.
- Create new products.
- View products by category.
- View products in details.
- Customer realted operations.
- Add/Remove products to whishlist.
- Add/Remove products to cart.
- Communicate with the customer service to update .whishlist and cart state.
Currently, any logged-in customer can create products but additional permession should be added to authorize this endpoint.
- This service is responsible of the order operations.
- Create order.
- Communicate with the customer service to get the current cart.
- Create order based on current cart data.
- Communicate with the customer serviceto update the current order details.
- Create order.
- Nginx is used as a reverse proxy to send requests to each microservice. It routes incoming requests from
/servicename
the service's portservicename:port
.
- Microservices commuincates with each other using RabbitMQ via publisher and subscriber.
- Each microservice is deployed into a docker container.
- Each service has a Docker image. All images are deployed into containers managed through the docker-compose file, which contains MongoDB and RabbitMQ.
- Make sure to add a .env file to each serive folder, you can check the .env_template file for a reference.
- You can spin up all services used by running/building the docker-compose file:
docker-compose up --build