This is a sample project designed to become more familiar with backend background tasks. It demonstrates scheduling campaigns, importing recipients from CSV files, and sending emails to each recipient when a campaign is started. It has:
- CRUD operations for campaigns
- Import recipients from CSV files into the database for campaigns. Handles large CSV files efficiently using Celery tasks
- Track the number of sent emails for each campaign to later mark it as complete
- Schedule Celery tasks for checking which campaigns need to be started and which ones are finished
- Containerized with Docker. Simply run docker compose up -d
Create an .env file in the root project directory for base setup that has these values.
REDIS_URL=redis
REDIS_PORT=6379
REDIS_DB=0
RABBITMQ_PORT=567
RABBITMQ_HOST=rabbitmq
RABBITMQ_PASSWORD=RABBITMQ_PASSWORD
RABBITMQ_USERNAME=RABBITMQ_USERNAME
RABBITMQ_VHOST=myvhost
DB_PORT=5432
DB_HOST=postgres
DB_PASSWORD=DB_PASSWORD
DB_USERNAME=postgres
DB_NAME=app
run
docker compose up -d
- PostgreSQL for the database
- FastAPI as the server
- Celery for background tasks
- Redis for Celery task storage and campaign sent email count tracking
- RabbitMQ for the Celery broker