Real-Time Image Processing with Redpanda, Django, Celery & PostgreSQL
This project demonstrates a robust end-to-end system for processing images in real-time. It supports batch processing, optional ML/LLM inference, and stores processed images in PostgreSQL with media files served via Django REST API.
- Real-time message queue integration using Redpanda
- Asynchronous batch processing with Celery for scalability
- Persistent storage of processed images in PostgreSQL
- Optional ML / LLM inference per image
- Clean, maintainable, and extendable architecture
- Exposes API endpoint
/api/images/for processed images
- Producer reads local images and publishes them to a Redpanda topic.
- Django Consumer listens to the topic and batches image paths.
- Celery Workers process images (resize, optional ML/LLM inference).
- Processed images are saved to PostgreSQL (via Django model) and media folder.
- Frontend / API clients fetch processed images via Django REST API.
distributed-image-processing-pipeline/
│
├── producer_service/ # Python scripts to send images to Redpanda
├── process_service/ # Django app consuming from Redpanda
├── process_service/ # Django + Celery project
│ ├── settings.py
│ ├── urls.py
│ └── celery_app.py
├── process_images/ # Django app for processing images
│ ├── models.py
│ ├── tasks.py
│ └── admin.py
├── media/ # Processed images stored here
├── docs/ # Flow diagrams & architecture images
└── docker/ # Optional Docker setup for services
# Create virtual environment
python -m venv venv
# Activate
# Windows
venv\Scripts\activate
# Install dependencies
pip install -r producer_service/requirements.txt
pip install -r process_service/requirements.txtdocker-compose -f docker/docker-compose.yml up -dStop services:
docker-compose -f docker/docker-compose.yml downcd producer_service
python producer.pycd process_service
# Activate venv
venv\Scripts\activate
python manage.py consume_imagescd process_service
# Activate venv
venv\Scripts\activate
# Worker 1
celery -A process_service.celery_app worker --loglevel=info -P solo -n worker1@%h
# Worker 2
celery -A process_service.celery_app worker --loglevel=info -P solo -n worker2@%hdocker exec -it process_service_db_v2 psql -U postgresInside psql:
\l
\c <database>
\dt
SELECT * FROM process_images_processedimage;
\qEndpoint:
http://127.0.0.1:8000/api/images/
curl http://127.0.0.1:8000/api/images/- Automated Image Scraper
- Video Frame Extraction & Processing
- AI Image Classifier
- Face Recognition / Object Detection
- Automated Image Captioning (LLM)
- Content Moderation System
- Social Media Monitoring Tool
- Video Thumbnail Generator
- E-commerce Product Image Processor
- End-to-End Multimedia Data Pipeline
# Clone project
git clone <repo-url>
cd distributed-image-processing-pipeline
# Feature branch
git checkout -b feature/your-feature-name
# Commit changes
git add .
git commit -m "Describe your changes"
git push origin feature/your-feature-name