Example Nestjs microservices with different transports(GRPC, Kafka, Rabbit, NATS)
-
TO INSTALL packages of all services, RUN:
"cd gateway-demo" then,
If on windows, then "npm run install:win"
If on Mac/Linux, then "npm run install:unix" -
TO RUN containers:
"docker compose up"
Hot-reload is setup for dev mode(change variable MODE to "dev", could be "production")
TODO:
- complete Auth, implement refresh-token
- complete crud(getOne, remove, update all by user)
- Handle exceptions
- Handle Validation via Pipes
- Filter incoming data
- Health checks of each services
- Unit, Integration, end2end tests
- Logging solution
- Optimize duplicates by creating a module
Services: Gateway(forwards request to other services), Auth, Cards, Loan, Deposit.
Each service has separate DB(Postgres)
ORM: Prisma
Communication between Gateway and:
Auth is via GRPC
Cards is via Kafka RabbitMQ
Loan is via RabbitMQ
Deposit is via NATS
Authentication is with JWT(only access token is issued)
Dockerized all services
Endpoints:
Gateway: Login, CreateUser(not protected for convenience)
CRUD for Users, Cards, Loan and Deposit