Oprec Backend
π Background
Overviewβ
This service is the Backend API for the RISTEK Open Recruitment website. It acts as the core engine handling user registrations via UI SSO, student profiles, available divisions and specific tasks linked to them, and storing candidate submissions securely.
Stakeholdersβ
- Users: PM, WebDev, DSAI, Product Engineering
- Upstream Dependencies: UI SSO CAS (https://sso.ui.ac.id/cas2/)
- Downstream Consumers: Frontend Client (https://join.ristek.cs.ui.ac.id)
Scope & Boundariesβ
- In Scope: User Profiles, Division listing and tasks, Submissions, SSO/LDAP integration, API authentication, Database models, Admin panel logic.
- Out of Scope: Frontend application, email delivery mechanism, complex analytics.
βοΈ Architecture & Design
System Diagramβ
Architecture Decisions (ADRs)β
- Language/Framework: Python 3.11.3 / Django 3.1.7 / Django Rest Framework
- Database: PostgreSQL 15 (Relational Data)
- Communication: Synchronous RESTful API over HTTP, with Token-based Authentication.
- Documentation Engine: drf_yasg (Swagger/OpenAPI UI integration)
- Infrastructure setup: Docker managed by docker-compose.yml (dev) and Amazon Elastic Container Registry (ECR).
π»Technical Specifications
API Documentationβ
The application exposes OpenAPI documentation through drf-yasg at /__docs/.
Core routes under /api/:
/login/: Handles authentication and generates an auth token./login-ldap/: Provides an alternate login endpoint through LDAP./event-deadlines/: Defines registration, selection, and announcement timelines./profile/: Gets and updates applicant profile information./date-time/: Syncs server time with the client./submissions/and/submissions/<id>/: Handles file task submission URLs linked to divisions./divisions/and/divisions/tasks/: Returns available divisions and assignment prompts./remaining-task/: Returns remaining unsubmitted tasks for each applicant.
Data Model/Schemaβ
Core entities live under the openrecruitment app:
UserProfile: Stores student demographics and assigned priority divisions.EventDeadline: Stores timeline points such asREGISTRATION_STARTandANNOUNCEMENT.Division: Stores division names, requirements, descriptions, and deadlines.DivisionInterestandDivisionAchievement: Extends division-specific applicant data.Task: Represents a test assignment tied to a division.Submission: Binds aUserProfileto aTaskwith an external attachment URL.
Project Structureβ
oprec-backend/
βββ .github/ # GitHub Actions (e.g., CI/CD deploy-staging.yml to ECR)
βββ marvel/ # Django project root module; contains settings.py, WSGI/ASGI configurations, root urls.py, CAS handling core logic.
βββ openrecruitment/ # Primary Django App for business logic
β βββ api/ # Submodule for DRF Serializers, API views, and sub-routes
β βββ seeds/ # Database seed information (.json files)
β βββ models.py # Database schema map
β βββ views.py # Core endpoints and business action (login logic)
β βββ admin.py # Django internal admin panel schema maps
β βββ apps.py # Django app definition
βββ tests/ # Test suite configurations (using django-nose)
βββ Dockerfile # Docker setup logic
βββ Makefile # Useful build scripts (`make install`, `make run_dev`)
βββ dev.docker-compose.yml # PostgreSQL & Django container layout for dev
βββ manage.py # Django binary manager
βββ requirements.txt # Python pip dependencies
Componentsβ
-
Django Auth & SSO Module:
marvel/etc/cas.py,openrecruitment/views.py- Hooks into University SSO and LDAP schemas to issue standard tokens after verification.
-
REST Views:
openrecruitment/api/views.py- Orchestrates DRF endpoints and applies
IsAuthenticatedchecks across protected backend routes.
- Orchestrates DRF endpoints and applies
-
Settings Module:
marvel/settings.py- Loads
.envviapython-dotenvand configures trusted frontend origins throughCORS_ORIGIN_WHITELIST.
- Loads
βοΈ Operational Playbook
Infrastructureβ
- Cloud Provider: AWS EC2 Instance (Deployment using manually managed Compose stack).
- Container Registry: Amazon ECR logic driven by GitHub actions .github/workflows/deploy-staging.yml.
- Link: [https://api.join.ristek.cs.ui.ac.id]
Environment Variablesβ
(example)
| Key | Description | Default (Dev) | Sensitive? |
|---|---|---|---|
| PORT | Port mapping | 8000 | No |
| DATABASE_URL | Full connection string to remote DB if used | β | Yes |
| DJANGO_ENV | App environment (local/production) | local | No |
| SECRET_KEY | Secure Django Cryptographic Key | β | Yes |
| POSTGRES_DB | PostgreSQL Name | oprec | No |
| POSTGRES_PORT | Postgres host port | 5432 | No |
| POSTGRES_USER | DB User | β | Yes |
| POSTGRES_PASSWORD | DB Password | β | Yes |
πQuestions
π List of frequently asked questions or question that need to be answered that is related to this initiative ..