How geovanesv/user-service-rabbitmq works
This NestJS user microservice supports user registration and JWT-protected lookup, plus email/password and Passport login, token validation and refresh, profile, and logout routes. Registration checks for duplicates, hashes and stores the password, then publishes a user.created event for downstream consumers. Authentication verifies users through the user service and issues JWTs. The graph shows PostgreSQL and RabbitMQ as external systems; implementation details for some documented authentication routes and strategies are not fully sampled, so their internal flows are not expanded.
Main entry points: user.service.ts User Service · auth.controller.ts Auth Routes · app.module.ts App Module · auth.module.ts Auth Module
Components 19
User Management
- User Routes
src/user/user.controller.ts - User Service
src/user/user.service.ts - User Entity
src/user/entities/user.entity.ts
Authentication
- Auth Routes
src/auth/auth.controller.ts - Auth Service
src/auth/auth.service.ts - Login DTO
src/auth/dto/auth.dto.ts - JWT Guard
src/auth/jwt-auth.guard.ts - Local Guard
src/auth/local-auth.guard.ts - JWT Strategy
src/auth/jwt.strategy.ts
Event Messaging
- Messaging Service
src/messaging/messaging.service.ts
Application Platform
- Nest Bootstrap
src/main.ts - App Module
src/app.module.ts - User Module
src/user/user.module.ts - Auth Module
src/auth/auth.module.ts - Messaging Module
src/messaging/messaging.module.ts
Other components
- API Client
- PostgreSQL
- JWT Service
- RabbitMQ
Connections 23
- API Client → User Routes: calls user routes
README.md - API Client → Auth Routes: calls auth routes
README.md - User Routes → User Service: delegates to
src/user/user.controller.ts - User Routes → JWT Guard: guards lookup
src/user/user.controller.ts - User Service → User Entity: persists users
src/user/user.service.ts - User Service → PostgreSQL: reads and writes
src/user/user.service.ts - User Service → Messaging Service: publishes event
src/user/user.service.ts - Messaging Service → RabbitMQ: publishes message
src/messaging/messaging.service.ts - Auth Routes → Auth Service: delegates to
src/auth/auth.controller.ts - Auth Routes → JWT Guard: guards routes
src/auth/auth.controller.ts - Auth Routes → Local Guard: guards Passport login
src/auth/auth.controller.ts - Auth Service → User Service: looks up users
src/auth/auth.service.ts - Auth Service → JWT Service: signs and verifies
src/auth/auth.service.ts - Nest Bootstrap → App Module: starts application
src/main.ts - App Module → User Module: registers module
src/app.module.ts - App Module → Auth Module: registers module
src/app.module.ts - App Module → Messaging Module: registers module
src/app.module.ts - Auth Module → Auth Routes: registers controller
src/auth/auth.module.ts - Auth Module → Auth Service: provides service
src/auth/auth.module.ts - Auth Module → JWT Strategy: registers strategy
src/auth/auth.module.ts - User Module → User Routes: registers controller
src/user/user.module.ts - User Module → User Service: provides service
src/user/user.module.ts - Messaging Module → Messaging Service: provides service
src/messaging/messaging.module.ts