This is a test project demonstrating microservices approach, built using the NestJS framework. This project is not intended to be an ideal architecture example or production-ready use case, but rather a playground to experiment with messaging between services.
- Fully dockerized with Docker Compose support
- Microservice based architecture
- Monorepo based structure with common modules extracted out
- Showcases request response based communication (auth and profile microservices)
- Showcases pub sub pattern / fan-out (auth and metric microservices)
- Uses JOI to ensure required env vars are set correctly
- Different log levels based on the environment
- Uses Passport for authentication
- Uses Postgres as database
- Uses Prisma as ORM
- Uses RabbitMQ for messaging
- Ready for production
1- Copy sample env files within each app to non sample versions, and update the keys / tokens / passwords within it, as well as within docker compose
2- Install dependencies (optional)
# For IDE support (maybe)
$ pnpm i -r
# development
$ docker-compose up --build
# tear down
$ docker-compose down
# Ensure each service returns the success message
$ curl --location 'http://localhost:3010/'
$ curl --location 'http://localhost:3015/'
$ curl --location 'http://localhost:3020/'
# Register user
$ curl --location 'http://localhost:3010/auth/register' \
--header 'Content-Type: application/json' \
--data-raw '{
"name": "Q",
"email": "[email protected]",
"password": "SaMhSHDCJ!23sdyeUggxSD"
}'
# Login user
$ curl --location 'http://localhost:3010/auth/login' \
--header 'Content-Type: application/json' \
--data-raw '{
"email": "[email protected]",
"password": "SaMhSHDCJ!23sdyeUggxSD"
}'
# Get current user's profile
$ curl --location 'http://localhost:3015/profile/me' \
--header 'Authorization: Bearer [ACCESS_TOKEN_FROM_LOGIN_RESPONSE]'
Nest is MIT licensed.