How gtech-mulearn/mulearnbackend works
This repository is a Django backend for µLearn, organized as a monolith with many domain apps rather than a set of separate services. The main runtime entrypoint is manage.py, with project configuration in mulearnbackend/ and app code primarily under api/ plus shared persistence models under db/.
The request-handling layer is Django URL routing plus DRF-style view/serializer pairs. api/urls.py aggregates feature routers, and each domain area exposes its own urls.py, views.py, and serializer modules. The architecture is heavily modularized by feature: auth, register, common utilities, dashboard subdomains, integrations, notification, leaderboard, launchpad, donate, hackathon, top100 coders, and URL shortener.
A major boundary is the dashboard subsystem under api/dashboard/. It is split into many management domains such as campus, events, users, roles, skills, tasks, projects, organizations, affiliations, coupons, referrals, districts, zonal, colleges, companies/jobs, learning circles, IG, Discord moderation, error logging, achievement, and dynamic management. Many of these have separate “admin/manage/public/scoped/meta” view variants, indicating different permissioned surfaces over the same underlying data.
The data model layer is centralized in db/, not embedded inside each feature app. This folder contains the core entities such as users, organizations, campuses, events, projects, tasks, skills, donations, hackathons, notifications, launchpad, integrations, and URL shortener records. db/managers/user_manager.py suggests custom user lifecycle behavior, and db/settings.py likely holds DB-specific configuration.
There is a clear real-time / websocket boundary. api/routing.py, mulearnbackend/routing.py, api/common/common_consumer.py, and api/dashboard/lc/dash_lc_consumers.py indicate Django Channels support. The learning-circle and common subsystems appear to be the primary websocket consumers, likely used for live updates or collaborative dashboard interactions.
Asynchronous/background processing is handled with Celery. The project includes mulearnbackend/celery.py plus task modules under mu_celery/, including achievement cron/task code. There is also a management command for generating achievements, so award/achievement computation can run both on-demand and scheduled.
External integrations are isolated under api/integrations/, with submodules for KKEM, Qseverse, and Wadhwani. These modules each have dedicated views, serializers, helpers, and URLs, so integration concerns are kept separate from the core dashboard logic. The presence of integration-specific templates in api/templates/mails/KKEM/ shows that some integrations also trigger email workflows.
Messaging and notifications are another cross-cutting subsystem. api/notification/ handles notification views, serializers, and utilities, while api/templates/mails/ contains many transactional email templates for registration, password reset, referrals, donation confirmation, launchpad verification/reset, learning-circle invitations, mentor verification, and integration notifications.
Several subsystems generate downloadable or branded artifacts. excel-templates/ contains spreadsheet templates for organizations, roles, tasks, and vouchers, and api/dashboard/karma_voucher/assets plus fonts indicate PDF/image generation or branded voucher output. This suggests some endpoints are not just CRUD APIs but document-producing workflows.
Shared concerns are factored into utils/. This includes permission helpers, response formatting, exception handling, OpenAPI/spectacular helpers, domain-specific karma and launchpad permission logic, and common type/util functions. These utilities act as the cross-cutting glue between the many feature apps and the shared model layer.
The repository also includes schema and migration-adjacent tooling. schema.sql, alter-scripts/, and the README’s note about applying a migration script indicate nontrivial database evolution and version-specific schema adjustments. That implies the backend has been maintained across multiple schema generations and possibly multiple deployment environments.
Operationally, the project is containerized and CI/CD-driven. Dockerfile, docker-compose.yml, docker-compose.pod.yml, and entrypoint.sh define the runtime packaging, while GitHub Actions workflows handle dev/prod deployment and pod rollouts. Environment configuration is externalized via .env.sample.
Overall, the architecture is a Django/DRF monolith with three strong boundaries: synchronous HTTP APIs by domain, asynchronous background/job processing, and real-time websocket channels. The shared db/ models and utils/ package provide the common substrate that all feature apps build on.
Main entry points: api/urls.py API router · dashboard/urls.py Dashboard router · user.py DB models · settings.py Project core
Components 20
Runtime
Process entrypoints and deployment wiring
- manage.py · Management entrypoint for local and deployment commands
manage.py - Project core · ASGI/WSGI, settings, middleware, and root URL/routing wiring
mulearnbackend/settings.py
HTTP API
Django URL and view surface
- API router · Top-level HTTP router that assembles feature URLconfs
api/urls.py - Auth & signup · Authentication and registration request handling
api/auth/auth_views.py - Common API · Shared public/external views, serializers, and consumer boundary
api/common/common_views.py - Core features · Donate, hackathon, leaderboard, launchpad, top100, url shortener, protected
api/donate/views.py - Integrations · KKEM, Qseverse, and Wadhwani connectors with dedicated views and serializers
api/integrations/urls.py - Notifications · Notification views, serializers, and delivery helpers
api/notification/notification_view.py
Dashboard
Permissioned management domains
- Dashboard router · Aggregates the modular dashboard management domains
api/dashboard/urls.py - Events · Event management surfaces split by admin, manage, public, scoped, and meta views
api/dashboard/events/admin_views.py - Users & roles · User, profile, and role administration surfaces
api/dashboard/user/dash_user_views.py - Org & campus · Organizations, campuses, colleges, locations, districts, zonal, and affiliations
api/dashboard/organisation/organisation_views.py - Workflows · Projects, tasks, task reports, skills, categories, coupons, referrals, and dynamic management
api/dashboard/projects/projects_view.py - Community · Learning circles, channels, IG, Discord moderation, and karma vouchers
api/dashboard/lc/dash_lc_view.py - Ops tools · Achievement automation, error logging, and dashboard utility surfaces
api/dashboard/achievement/achievement_views.py
Data Model
Shared persistence layer
- DB models · Central shared entities for users, organizations, events, projects, tasks, skills, donations, notifications, launchpad, integrations, and URLs
db/user.py - User manager · Custom user lifecycle and account behavior
db/managers/user_manager.py
Async & Realtime
Celery and Channels boundaries
Shared Utils
Cross-cutting helpers and policies
- Shared utils · Permissions, responses, exceptions, OpenAPI helpers, karma, and launchpad policies
utils/response.py
Connections 27
- manage.py → Project core: boots · Starts the Django application using project settings
- Project core → API router: routes HTTP · Root URL configuration exposes API endpoints
- Project core → Channels: routes ws · ASGI routing includes websocket consumers
- Project core → Celery: configures jobs · Project wiring loads Celery application and task modules
- API router → Auth & signup: includes · Top-level router includes auth and registration endpoints
- API router → Common API: includes · Common/public API routes are mounted here
- API router → Core features: includes · Feature APIs for donation, hackathon, leaderboard, launchpad, and others
- API router → Integrations: includes · Integration endpoints are mounted at the API root
- API router → Notifications: includes · Notification endpoints are exposed through the API router
- API router → Dashboard router: includes · Dashboard subsystem is exposed as a major route group
- Dashboard router → Events: dispatches · Routes event management variants
- Dashboard router → Users & roles: dispatches · Routes user, profile, and role management
- Dashboard router → Org & campus: dispatches · Routes organization and geography management
- Dashboard router → Workflows: dispatches · Routes operational and workflow management
- Dashboard router → Community: dispatches · Routes community and live collaboration surfaces
- Dashboard router → Ops tools: dispatches · Routes operational support tools
- Users & roles → DB models: reads/writes · User and profile management persists through shared models
- Org & campus → DB models: reads/writes · Organization and location domains share the central persistence layer
- Workflows → DB models: reads/writes · Projects, tasks, skills, referrals, and related records live in shared models
- Community → DB models: reads/writes · Community and learning-circle data is persisted centrally
- Common API → Shared utils: uses · Common API code relies on shared helpers and response/permission logic
- Core features → Shared utils: uses · Feature APIs share common utilities and domain policies
- Integrations → Shared utils: uses · Integration flows share helper and response utilities
- Notifications → Shared utils: uses · Notification delivery uses shared helpers and formatting utilities
- Celery → DB models: processes · Background tasks compute and update persisted achievement-related data
- Channels → DB models: streams · Realtime consumers likely read and broadcast shared state
- DB models → User manager: customizes · User persistence is extended by a custom manager