A microservice that consumes notification events from the BankApp auth service and delivers emails via supported providers (currently Resend).
This service acts as a consumer in BankApp's event-driven notification architecture:
- Consumes notification messages from RabbitMQ
- Delivers emails via email service providers
- Handles queue management and error handling
- Docker and Docker Compose
- A running RabbitMQ instance (from auth-service stack)
- Resend.com account with verified domain
-
Clone the repository
git clone https://github.com/BankApp-project/notification-service.git cd notification-service -
Configure environment variables
cp .env.example .env -
Edit
.envand add your credentials:# Required: Add your Resend API key RESEND_API_KEY=re_YOUR_API_KEY_HERE # Required: Add your verified sender email [email protected] # Optional: Configure RabbitMQ connection if not using defaults RABBIT_MQ_HOST=rabbitmq RABBIT_MQ_USER=guest RABBIT_MQ_PASSWORD=guest -
Start the service
docker compose up -d -
Verify it's running
docker compose logs -f bankapp-notification-service
| Variable | Required | Default | Description |
|---|---|---|---|
RESEND_API_KEY |
Yes | - | Your Resend.com API key |
SENDER_EMAIL_ADDRESS |
Yes | - | Verified sender email address |
RABBIT_MQ_HOST |
No | localhost |
RabbitMQ server hostname |
RABBIT_MQ_PORT |
No | 5672 |
RabbitMQ server port |
RABBIT_MQ_USER |
No | guest |
RabbitMQ username |
RABBIT_MQ_PASSWORD |
No | guest |
RabbitMQ password |
APP_SEND_TEST_EMAIL |
No | false |
Send test email on startup |
APP_TEST_EMAIL_ADDRESS |
No | - | Recipient for test email |
LOGGING_LEVEL_BANKAPP |
No | DEBUG |
Application logging level |
- Sign up at Resend.com
- Verify your domain following Resend's domain verification guide
- Generate an API key from the Resend dashboard
- Use an email address that matches your verified domain (e.g.,
[email protected])
This service is designed to work with BankApp's auth service. Ensure:
- Network connectivity: The notification service must be on the same Docker network as RabbitMQ
- Exchange configuration: Default exchange is
notifications.commands.v1.exchangewith routing keysend.otp.email - Auth service is configured: See the auth service notification integration docs
The notification service connects to the auth service's Docker network (auth_bankapp-auth):
# The network should already exist from the auth-service deployment
# If it doesn't exist, start the auth service first:
cd /path/to/auth-service
docker compose up -d
Note: The compose.yml uses the external network auth_bankapp-auth created by the auth service. Ensure the auth service is running before starting the notification service.
- Start the notification service
- Access the auth service Swagger UI at
http://localhost:8080/api/ - Trigger an OTP email via the
/verification/complete/emailendpoint - Check your inbox for the notification email
Enable the test email feature in .env:
APP_SEND_TEST_EMAIL=true
[email protected]
A test email will be sent when the service starts successfully.
- Check RabbitMQ connection: Ensure RabbitMQ is running and accessible
- Verify network: Confirm the service is on the correct Docker network
- Check logs:
docker compose logs bankapp-notification-service
- Verify Resend API key: Ensure your API key is valid and active
- Check sender domain: Sender email must match a verified domain in Resend
- Review logs: Look for RabbitMQ connection errors or email delivery failures
- Confirm queue binding: Check RabbitMQ management UI to ensure queues are properly bound
- Check credentials: Verify
RABBIT_MQ_USERandRABBIT_MQ_PASSWORD - Verify hostname: Ensure
RABBIT_MQ_HOSTpoints to your RabbitMQ instance - Network connectivity: Confirm both services are on the same Docker network
The service consumes EmailNotificationPayload messages with the following structure:
{
"recipientEmail": "[email protected]",
"subject": "Your OTP Code",
"htmlBody": "<html>...</html>"
}
For full message contract specifications, see the auth service documentation.
# Run with local RabbitMQ
docker compose -f compose.yml up
# Or run outside Docker
./mvnw spring-boot:run
# Build Docker image
docker build -t bankapp-notification-service .
# Or use Maven
./mvnw clean package
For production environments:
- Use strong RabbitMQ credentials (not guest/guest)
- Enable TLS/SSL for RabbitMQ connections
- Configure proper logging (set
LOGGING_LEVEL_BANKAPPtoINFOorWARN) - Set up monitoring for queue depth and message processing rates
- Implement dead letter queues for failed message handling
- Use environment-specific configurations (separate
.envfiles)
Contributions are welcome! Please feel free to submit a Pull Request.
This project is under MIT license.
- Issues: GitHub Issues
- Auth Service Integration: Auth Service Notification Docs