This project demonstrates a microservices-based architecture designed to manage user registration and email validation workflows. The architecture focuses on showcasing knowledge of software architecture, rather than emphasizing clean code or advanced code quality standards.
- User Registration: A service to register new users.
- Email Validation: Sending emails to users to validate their email addresses.
- RabbitMQ: Message broker to manage asynchronous communication between microservices.
- AWS API Gateway with Lambda Authorizer: Provides centralized API routing and authentication.
- MySQL: Separate databases for each microservice.
- AWS SQS: Used to queue email notifications.
- Auth Microservice: Handles user registration and authentication.
- Notification Microservice: Manages email notifications for user validation.
- RabbitMQ: Facilitates communication between the auth and notification microservices.
- MySQL Databases: Each microservice has its own isolated database for modularity and separation of concerns.
- AWS API Gateway with Lambda Authorizer: Secures API endpoints and delegates requests to the respective microservices.
- Docker and Docker Compose installed on your machine.
- AWS credentials for email queue integration.
Create a .env
file in the root directory with the following content:
# Example of environment variables
NODE_ENV=production
# RabbitMQ
RABBITMQ_DEFAULT_USER=user
RABBITMQ_DEFAULT_PASS=password
RABBITMQ_URL=amqp://user:password@rabbitmq:5672
RABBITMQ_NOTIFICATION_QUEUE=notifications
# Auth Microservice
AUTH_PORT=4000
AUTH_DATABASE_HOST=auth-db
AUTH_DATABASE_USERNAME=root
AUTH_DATABASE_PASSWORD=password
AUTH_DATABASE_NAME=auth
AUTH_DATABASE_PORT=3306
# Notification Microservice
NOTIFICATION_PORT=5000
NOTIFICATION_DATABASE_HOST=notification-db
NOTIFICATION_DATABASE_USERNAME=root
NOTIFICATION_DATABASE_PASSWORD=password
NOTIFICATION_DATABASE_NAME=notification
NOTIFICATION_DATABASE_PORT=3306
AWS_ACCESS_KEY_ID=your_aws_access_key
AWS_SECRET_ACCESS_KEY=your_aws_secret_key
SQS_EMAIL_QUEUE_URL=https://sqs.us-east-1.amazonaws.com/050451404615/email-notification-queue
WEB_URL=http://localhost:3000
- Clone the repository.
- Navigate to the project directory.
- Run the following command:
This will set up the RabbitMQ, MySQL databases, and both microservices.
docker-compose up --build
- RabbitMQ Management: http://localhost:15672
- Auth Microservice: http://localhost:4000
- Notification Microservice: http://localhost:5000
- This project is intended as an architectural demonstration and may not include production-ready configurations or optimizations.
- The focus is on microservices design, asynchronous communication, and modularity.
auth-microservice/
: Source code for the Auth Microservice.notification-microservice/
: Source code for the Notification Microservice.docker-compose.yml
: Orchestrates the microservices and dependencies..env.example
: Example environment variables for the project.
This project is open-source and available under the MIT License.