Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/n4ze3m/nest-nats-example
simple example of a nestjs microservice using NATS
https://github.com/n4ze3m/nest-nats-example
microservice nats nats-streaming nestjs nodejs typescript
Last synced: 7 days ago
JSON representation
simple example of a nestjs microservice using NATS
- Host: GitHub
- URL: https://github.com/n4ze3m/nest-nats-example
- Owner: n4ze3m
- Created: 2022-04-16T08:53:18.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2022-04-16T08:53:45.000Z (almost 3 years ago)
- Last Synced: 2025-01-13T12:48:29.098Z (15 days ago)
- Topics: microservice, nats, nats-streaming, nestjs, nodejs, typescript
- Language: TypeScript
- Homepage:
- Size: 215 KB
- Stars: 3
- Watchers: 2
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# NEST with NATS
This is a simple example of a NEST microservice using NATS.
## Architecture
![NEST NATS](./assets/nats-nest-example.png)
There are two microservices in this example:
1. service1
2. service2- `service1` can create a new user and can send user data to `service2` for processing.
`service2` can approve or reject the user and can send the result to `service1`.- `service1` requests `service2` for all approved users.
- `service2` requests `service1` for all rejected users.
Every request and response is sent over NATS.
## Setup
To run the example, you need to have a NATS server running. For that you can use `docker-compose up -d`. Server will be started in the background.
Navigate to the service1 and service2 directories and run `npm i` and `npm run start:dev`.
- Serivce1: start port: `4322`
- Service2: start port: `4321`Note: Current example is graphql.