oprec-backend - Documentation
| Document Status | ||
|---|---|---|
| Document Owner | Product Engineering 2026 | Product Engineering 2026 |
| Contributors | ||
| Project Links | https://github.com/RistekCSUI/oprec-backend | https://github.com/RistekCSUI/oprec-backend |
| Project Links | https://api.join.ristek.cs.ui.ac.id | https://api.join.ristek.cs.ui.ac.id |
| Project Links | https://api.join.ristek.cs.ui.ac.id/__docs/ | https://api.join.ristek.cs.ui.ac.id/__docs/ |
| Team | Theodore Kevin Himawan | theodore.kevin@ristek.cs.ui.ac.id |
| Team | Ari Darrell Muljono | darrell@ristek.cs.ui.ac.id |
| Team | Grace Karina | gracekarin@ristek.cs.ui.ac.id |
| Team | Yeshua Marco G. Manurung | marco@ristek.cs.ui.ac.id |
π 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 automatically generates OpenAPI specs via drf-yasg located at /__docs/. Sub-routes under /api/: login/: Handles authentication (generates Auth Token) login-ldap/: Alternate login endpoint via LDAP event-deadlines/: Defines timeline for registration, selection, announcements. profile/: Gets/Sets user information. date-time/: Syncs server time with client. submissions/ & submissions/<id>/: Handles file task submission URLs linked to divisions. divisions/ & divisions/tasks/: Renders available divisions and their respective assignment prompts. remaining-task/: Gets remaining unsubmitted tasks per applicant.
Data Model/Schemaβ
Core entities residing under the openrecruitment app: UserProfile: Contains student demographics, assigned priority divisions. EventDeadline: Stores timeline points like REGISTRATION_START, ANNOUNCEMENT. Division: Contains names, requirements (min/max applicants), descriptions, and deadlines. DivisionInterest & DivisionAchievement: Extends Division details. Task: A specific test assignment tied to a Division. Submission: Binds a UserProfile to a Task providing 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β
| Layer | Paths | Responsibility |
|---|---|---|
| Django Auth & SSO Module | marvel/etc/cas.py, openrecruitment/views.py | Hooks into University SSO and LDAP schemas providing standard tokens upon verification. |
| REST Views | openrecruitment/api/views.py | Orchestrates endpoints utilizing rest_framework.generics. Features IsAuthenticated checking mapped universally across the backend. |
| Settings Module | marvel/settings.py | Utilizes .env with python-dotenv, configuring CORS_ORIGIN_WHITELIST to explicitly list trusted frontends like join.ristek.cs.ui.ac.id. |
βοΈ 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 ..