How pankajshindecodes-stack/cstep-django works
Purpose and Runtime
CSTEP is a Django 5 / Django REST Framework backend for event management: identity and roles, event scheduling and livestream access, attendee registrations, and operational analytics. PostgreSQL is the system of record; Redis backs OTP cache storage. HTTP runs through Django WSGI/ASGI, while ASGI also exposes WebSocket routing. Core entry points are cstep_backend/manage.py, cstep_backend/cstep_backend/urls.py, cstep_backend/cstep_backend/asgi.py, and cstep_backend/cstep_backend/settings.py.
HTTP and Authorization Boundary
Project URL dispatch delegates API domains to app URL modules; views serialize requests/responses around Django models and enforce role-aware permissions. JWT access/refresh tokens authenticate protected endpoints, and account/event/registration permissions encode the BASE_USER → MODERATOR → EVENT_ADMIN → SUPER_ADMIN hierarchy.
Paths: cstep_backend/cstep_backend/urls.py, cstep_backend/accounts/urls.py, cstep_backend/accounts/permissions.py.
Accounts and Identity Lifecycle
The accounts app owns the custom user profile, role management, OTP-driven verification, login, and current-user APIs. Registration creates an identity and triggers verification; OTP values are stored through the cache boundary (Redis); verified users log in to receive SimpleJWT tokens. Admin-level users can inspect, change roles, and deactivate accounts.
Paths: cstep_backend/accounts/models.py, cstep_backend/accounts/views.py, cstep_backend/accounts/serializers.py.
Event and Broadcast Domain
The events app defines events, event days/schedule concepts, joins, feedback, and broadcast/viewer-session records. Event administrators create or modify event resources; authenticated users join events, recording attendance/session data and obtaining a stream link. Event signals, webhooks, media handling, and WebSocket consumers separate lifecycle integrations and real-time behavior from REST views.
Paths: cstep_backend/events/models.py, cstep_backend/events/views.py, cstep_backend/events/consumers.py.
Registration and Lobby Workflow
Registrations are a separate workflow layer linking users to events and capturing participation days, attendance choices, travel/translation assistance, and status. Users submit and retrieve their own registrations; moderators operate cross-event lists, lobby views, and acceptance/rejection decisions. This is the main approval boundary between self-service attendee input and staff operations.
Paths: cstep_backend/registrations/models.py, cstep_backend/registrations/views.py, cstep_backend/registrations/permissions.py.
Analytics and Background/Realtime Processing
Analytics aggregates user, participant, and event participation data for moderator-facing endpoints. Its service layer and Celery tasks indicate asynchronous computation/work, while consumers/routing provide live channels. Celery is configured at project scope; deployment must run compatible worker infrastructure when tasks are enabled.
Paths: cstep_backend/analytics/views.py, cstep_backend/analytics/services.py, cstep_backend/analytics/tasks.py, cstep_backend/cstep_backend/celery.py.
Streaming and Deployment Infrastructure
The repository packages Docker deployment and a MediaMTX service configuration for live streaming. MediaMTX is an external media-plane boundary: Django manages event/broadcast metadata and access while the streaming server handles media protocols. Docker Compose coordinates local services; Dockerfile packages the Django service. GitHub Actions provides Django CI.
Paths: cstep_backend/docker-compose.yml, cstep_backend/docker/mediamtx/mediamtx.yml, cstep_backend/Dockerfile, .github/workflows/django.yml.
Main entry points: urls.py Project URL dispatch · accounts/views.py Accounts API · events/views.py Events API · models.py Participation records
Components 20
Django runtime
- Project URL dispatch · Delegates API domains to app routes.
cstep_backend/cstep_backend/urls.py - WSGI / ASGI runtime · ASGI also serves WebSocket connections.
cstep_backend/cstep_backend/asgi.py - Project settings
cstep_backend/cstep_backend/settings.py
Business domains
- Accounts API · Registration, verification, login, profile, and account administration.
cstep_backend/accounts/views.py - JWT and role permissions · Enforces the user-to-super-admin role hierarchy.
cstep_backend/accounts/permissions.py - Identity and roles · Custom user profile and role state.
cstep_backend/accounts/models.py - Events API · Manages events, joins, attendance, and stream access.
cstep_backend/events/views.py - Event and broadcast data · Events, schedules, feedback, broadcasts, and viewer sessions.
cstep_backend/events/models.py - Registration workflow · Self-service submissions and moderator lobby decisions.
cstep_backend/registrations/views.py - Registration permissions · Separates own-registration access from staff operations.
cstep_backend/registrations/permissions.py - Participation records · Links users and events with attendance, assistance, and status.
cstep_backend/registrations/models.py
Async and realtime
- Analytics endpoints · Moderator-facing participation reporting.
cstep_backend/analytics/views.py - Analytics aggregation · Aggregates user, participant, and event data.
cstep_backend/analytics/services.py - Analytics tasks · Runs asynchronous analytics work.
cstep_backend/analytics/tasks.py - Celery worker setup
cstep_backend/cstep_backend/celery.py - Event WebSocket consumers · Handles real-time event behavior.
cstep_backend/events/consumers.py
Deployment services
- OTP cache · Stores verification OTP values.
- PostgreSQL
- MediaMTX · Handles live-stream media protocols.
cstep_backend/docker/mediamtx/mediamtx.yml - Docker Compose deployment · Coordinates local Django and media services.
cstep_backend/docker-compose.yml
Connections 27
- WSGI / ASGI runtime → Project URL dispatch: serves HTTP
- WSGI / ASGI runtime → Event WebSocket consumers: serves WebSockets
- Project settings → WSGI / ASGI runtime: configures
- Project URL dispatch → Accounts API: routes
- Project URL dispatch → Events API: routes
- Project URL dispatch → Registration workflow: routes
- Project URL dispatch → Analytics endpoints: routes
- Accounts API → JWT and role permissions: authorizes with JWT
- Accounts API → Identity and roles: manages
- Accounts API → OTP cache: stores OTPs
- Events API → JWT and role permissions: requires roles
- Events API → Event and broadcast data: manages
- Registration workflow → Registration permissions: enforces workflow
- Registration workflow → Participation records: creates and reviews
- Participation records → Identity and roles: links user
- Participation records → Event and broadcast data: links event
- Identity and roles → PostgreSQL: persists
- Event and broadcast data → PostgreSQL: persists
- Participation records → PostgreSQL: persists
- Analytics endpoints → Analytics aggregation: queries
- Analytics aggregation → PostgreSQL: aggregates records
- Analytics tasks → Analytics aggregation: runs aggregation
- Celery worker setup → Analytics tasks: executes
- Events API → MediaMTX: manages stream access
- Event WebSocket consumers → Event and broadcast data: uses event state
- Docker Compose deployment → WSGI / ASGI runtime: deploys Django
- Docker Compose deployment → MediaMTX: coordinates