As we mentioned, the backend consists of four microservices. One of them is an NGINX reverse proxy server. The other three are Express.js servers that contain the main logic of the app.
The three Express.js servers share the following features:
- They use MongoDB as a DBMS.
- They use Mongoose as an ODM.
- They use JWT for authentication and authorization.
- They use morgan as a logger.
We will discuss these microservices in detail.
This microservice contains an Express.js server that handles /products/
requests. Admins can create, update, delete and get products using this server. Admins can also upload images of the products into an AWS S3 bucket using signed URLs. Some of the endpoints of this server is protected using JWT.
This microservice contains an Express.js server that handles /users/
requests. Users can create users and login using this server. The passwords of the users are hashed using bcrypt. Some of the endpoints of this server is protected using JWT.
This microservice contains an Express.js server that handles /orders/
requests. Users can create and get orders using this server. The endpoints of this server is protected using JWT.
This microservice contains an NGINX server that works as a reverse proxy. The frontend microservice interacts with this server, and the server forwards the request to the microservice that can fulfill it.