How abhisheksrikanth/saturchat-backend works
Project type and purpose
• This is a real-time group chat backend built with Django (REST + Channels)
• It provides WebSocket chat, JWT auth, async AI-powered assistants, profile management, and uses Docker for containerization.
File structure for architectural clues
• Top-level Django project: saturchat/ (ASGI app, Celery config, settings, URL routing)
• Two main Django apps:
– accounts/ handles user model, auth (JWT), middleware, management commands
– chat/ handles chat models, serializers, views, WebSocket consumers, async tasks, AI provider integrations
• Async infrastructure:
– Celery tasks in chat/tasks/
– Redis for broker + channel layer (via Channels)
• Real-time layer:
– chat/consumers/ with chat_consumer.py, user_consumer.py
– Django Channels routing in chat/routing.py
• Deployment/config:
– Dockerfile, docker-compose.yml, start.sh
– CI workflow in .github/workflows/build.yml
Extract key elements from README
• Web server: Daphne (ASGI) managed by Docker Compose behind NGINX proxy
• Persistent store: PostgreSQL
• Cache & broker: Redis
• Task queue & scheduler: Celery + Celery beat
• External AI services: OpenAI, Anthropic (Claude), Gemini
• Auth: JWT (access & refresh tokens)
• Containerized, CI/CD ready
Main components
1. Clients (Web/Mobile)
2. NGINX Reverse Proxy
3. ASGI Server (Daphne)
4. Django Application
• REST API (accounts, chat views)
• WebSocket handlers (ChatConsumer, UserConsumer)
5. Redis
• Channels layer (Pub/Sub for WebSockets)
• Celery broker + result backend
6. Celery Worker & Beat Scheduler
7. PostgreSQL Database
8. External Services (OpenAI, Anthropic, Gemini)
Relationships & data flows
• HTTP clients → NGINX → Daphne → Django REST Views → PostgreSQL
• WebSocket clients → NGINX → Daphne → Django Channels → Redis → ChatConsumer ↔ Database/Celery
• Django code enqueues tasks → Celery Worker (via Redis) → tasks call external AI APIs → results persisted in DB or pushed to clients
• Celery Beat triggers periodic cleanup tasks → Redis → Celery Worker
Architectural patterns & principles
• Monolithic Django app split into apps (accounts, chat)
• Event-driven & pub/sub for real-time via Channels + Redis
• Async task queue pattern with Celery for heavy/IO tasks (AI calls, cleanup)
• 12-factor (env vars, logs to stdout, backing services as attached resources)
• Containerized micro-services style within a single Compose network
Final checklist
[ ] All eight main components are shown
– Blue for internal Django services
– Green for data stores
– Orange for external AI services