A distributed application for sending SMS and emails using FastAPI, RabbitMQ, Celery, Flower and PostgreSQL.
- Distributed Messaging System: Implemented a robust architecture for message processing using FastAPI, RabbitMQ, Celery, and PostgreSQL
- SMS Notifications: Integration with Twilio API for sending SMS messages
- Email Notifications: Integration with Brevo (formerly Sendinblue) for sending transactional emails
- Message Queuing: Separate queues for SMS and email tasks to optimize message processing
- Database Persistence: PostgreSQL integration for storing and tracking message status
- Containerization: Full Docker support with docker-compose for easy deployment
- Real-time Monitoring: Flower dashboard for monitoring Celery workers and task execution
- API Documentation: Swagger UI for easy API testing and documentation
- FastAPI Web Server: RESTful API endpoints for triggering notifications
- Celery Workers: Background task processing for non-blocking operations
- RabbitMQ Message Broker: Reliable message queuing with management interface
- Health Checks: Service health monitoring for all components
- Environment Configuration: Separate environment configurations for web and worker components
- Dependency Management: Poetry for Python dependency management
- Database: PostgreSQL 14
- Message Broker: RabbitMQ 3 with Management Plugin
- Monitoring: Celery Flower dashboard with authentication
- Service Orchestration: Docker Compose with health checks and dependency management
-
Clone the repository:
git clone https://github.com/ysskrishna/fastapi-rabbitmq-celery-flower cd fastapi-rabbitmq-celery-flower -
Update environment variables:
For webserver/.env:
TWILIO_FROM_PHONE="your-twilio-phone-number" BREVO_FROM_EMAIL="your-brevo-from-email"For worker/.env:
TWILIO_ACCOUNT_SID="your-twilio-account-sid" TWILIO_AUTH_TOKEN="your-twilio-auth-token" BREVO_API_KEY="your-brevo-api-key" -
Run the application using Docker Compose:
docker-compose up -d
-
Access the application:
- Swagger API documentation:
http://localhost:8000/docs - RabbitMQ Management UI:
http://localhost:15672/(Username: admin_user, Password: admin_pass) - Flower dashboard:
http://localhost:5555/(Username: admin, Password: supersecret)
- Swagger API documentation:
To modify the application:
- Update code in the
webserverorworkerdirectories - Restart the containers:
docker-compose down docker-compose up -d
# Start all containers
docker compose up --build
# Stop all containers
docker compose down
# Stop and delete volumes
docker compose down -vContributions are welcome! Please feel free to submit a Pull Request.
Copyright (c) 2025 Y. Siva Sai Krishna
This project is licensed under the GNU Affero General Public License v3.0 (AGPL-3.0) License - see the LICENSE file for details.