Crimmit-Task: Building a Microservices Architecture with NestJS framework.
You are tasked with creating a microservices architecture using NestJS. The architecture will consist of three services: Owner, Products, and Order. Each service will interact with a MongoDB database, and the communication between these services will be handled using two different protocols: RabbitMQ and gRPC. Additionally, the Order service will implement a caching mechanism for product data.
# create a nestJS app - crimmit
$ nest new crimmit# create the microservices
$ cd crimmit
$ nest generate app owner-service
$ nest generate app product-service
$ nest generate app order-service# install all the necessary dependencies needed for the project
$ npm install @nestjs/mongoose mongoose @golevelup/nestjs-rabbitmq amqplib @nestjs/microservices @grpc/grpc-js @grpc/proto-loader cache-manager cache-manager-redis-store redis
$ npm install class-validator class-transformer
$ npm install ioredis @nestjs/cache-manager
$ npm install @nestjs/config
$ npm install concurrently --save-dev# clone the repository to your local machine
$ git clone https://github.com/kanmitcode/crimmit.git$ npm install# build the microservices (owner-service, product-service, order-service)
$ docker-compose up --build
# you can press Ctrl+C to stop the services from running
# remove the microservices
$ docker-compose down# development
$ npm run start
# watch mode
$ npm run start:dev
# production mode
$ npm run start:prodKindly use the postman collection (Crimmit.postman_collection.json) attached to the project repo
- For owner-service: http://localhost:3001/owners
- For product-service: http://localhost:3002/products
- For order-service: http://localhost:3003/orders
The technological tools/resources used:
- System: Macbook Pro - Apple M2 Pro
- IDE: Visual Studio Code
- Framework: NestJS
- Database: MongoDB
- Queuing: RabbitMQ
- Protocol: gRPC
- Caching: Redis
- Containerization: Docker
- VSCode Docker Extension: Docker v1.29.2
- Author - Oyekanmi Owolabi
- StackOverflow - oyekanmi-owolabi
- Email - @kanmit
The project is GNU General Public License v3.0.
