Skip to main content

ristek-verify-backend - Documentation

Document Status
Document OwnerProduct Engineering 2026Product Engineering 2026
Contributors
Project Linkshttps://github.com/RistekCSUI/ristek-verify-backendhttps://github.com/RistekCSUI/ristek-verify-backend
Project Linkshttps://api.verify.ristek.cs.ui.ac.idhttps://api.verify.ristek.cs.ui.ac.id
Project Links[Monitoring Dashboard][Monitoring Dashboard]
Project Links[API Documentation][API Documentation]
Project Links[Other Related Doc/Link][Other Related Doc/Link]
TeamTheodore Kevin Himawantheodore.kevin@ristek.cs.ui.ac.id
TeamAri Darrell Muljonodarrell@ristek.cs.ui.ac.id
TeamGrace Karinagracekarin@ristek.cs.ui.ac.id
TeamYeshua Marco G. Manurungmarco@ristek.cs.ui.ac.id

πŸ”Ž Background

Overview​

This service is a Django-based backend service that manages verifiable RISTEK certificates and prize tickets. The service stores certificate and ticket metadata in PostgreSQL, generates visual artifacts for those records, serves downloadable files from object storage, and exposes verification endpoints that can be consumed by the public verification frontend and internal admin users.

Stakeholders​

  • Users: End users
  • Upstream Dependencies: PostgreSQL database, S3-compatible object storage bucket for certificate/ticket files, mailer service for outbound emails
  • Downstream Consumers: Frontend

Scope & Boundaries​

  • In Scope: Django backend in this repository, verify app models, signals, views, templates, and admin, postgreSQL schema for certificate and ticket metadata, file generation and retrieval flow for certificate/ticket assets
  • Out of Scope: Frontend implementation details outside this repository, historical data migration strategy, monitoring/dashboard implementation, external systems beyond the listed storage, database, and mailer dependencies

βš™οΈ Architecture & Design

System Diagram​

Architecture Decisions (ADRs)​

  • Language/Framework: Python 3.11, Django 4.2.4
  • Database: PostgreSQL and S3
  • Communication: Synchronous HTTP for verificatio

πŸ’»Technical Specifications

API Documentation​

GET /verify/​

Response 200

{
"isCert":true,
"data":{
"id":"R2026-1234-5678",
"recipient":"Jane Doe",
"eventName":"RISTEK Townhall",
"asWhat":"Speaker",
"issuedDate":"31/03/2026"
}
}

Response 200

{
"isCert":false,
"data":{
"id":"R2026-1234-5678",
"recipient":"Jane Doe",
"issuedDate":"03.31.2026",
"expiredDate":"04.30.2026",
"eventName":"RISTEK Giveaway"
}
}
GET /verify/certification/json/​

Response 200

{
"name":"Jane Doe",
"eventName":"RISTEK Townhall",
"asWhat":"Speaker",
"issuedDate":"31/03/2026"
}
GET /verify/certification/pdf/​

Response 200

application/pdf
GET /verify/certification/image/​

Response 200

image/png
GET /verify/certification/html​

Request

cert_id,name,as_what,event,place,issued_date

Response 200

<html>Rendered certificate template</html>
GET /verify/ticket/pdf/​

Response 200

application/pdf
GET /verify/ticket/image/​

Response 200

image/png
GET /verify/ticket/html///&lt;for_what_occasion&gt;/&lt;due_to&gt;/&lt;event_name&gt;//&lt;issued_date&gt;/&lt;expired_date&gt;​

Response 200

<html>Rendered ticket template</html>
GET /send-email​

Response 200

success
GET /admin/​

Response 200

<html>Django admin login or dashboard</html>

Data Model/Schema​

Project Structure​

ristek-verify-backend/
β”œβ”€β”€ manage.py # Django management entrypoint
β”œβ”€β”€ requirements.txt # Python dependencies
β”œβ”€β”€ Dockerfile # Container image definition
β”œβ”€β”€ build_files.sh # Build helper for static asset collection
β”œβ”€β”€ scripts/
β”‚ └── docker-entrypoint.sh # collectstatic + migrate + gunicorn
β”œβ”€β”€ ristek_verify_be/
β”‚ β”œβ”€β”€ settings.py # Django settings and infrastructure config
β”‚ β”œβ”€β”€ urls.py # Root URL routing
β”‚ β”œβ”€β”€ asgi.py
β”‚ └── wsgi.py
β”œβ”€β”€ verify/
β”‚ β”œβ”€β”€ admin.py # Django admin configuration
β”‚ β”œβ”€β”€ apps.py # App registration and signal bootstrapping
β”‚ β”œβ”€β”€ models.py # Certification and Ticket models
β”‚ β”œβ”€β”€ signals.py # File generation, upload, cleanup, email flow
β”‚ β”œβ”€β”€ storage.py # Custom S3 storage URL rewriting
β”‚ β”œβ”€β”€ urls.py # App endpoints
β”‚ β”œβ”€β”€ views.py # Verification and file-serving handlers
β”‚ β”œβ”€β”€ templates/ # Certificate and ticket HTML templates
β”‚ β”œβ”€β”€ static/ # Images, CSS, and PDF template assets
β”‚ └── migrations/ # Django schema migrations
└── vercel.json # Optional Vercel deployment config

Components​

LayerPathsResponsibility
Core Configuration Layerristek_verify_be/settings.py, ristek_verify_be/urls.py, ristek_verify_be/asgi.py, ristek_verify_be/wsgi.pyInitializes the Django application shell, including global settings, middleware, database wiring, static file handling, installed apps, root URL routing, and deployment entrypoints for ASGI and WSGI servers.
Verification API Layerverify/urls.py, verify/views.pyHandles the public verification flow, including ID lookup across certifications and tickets, certificate metadata retrieval, file download endpoints for certificate and ticket assets, HTML rendering endpoints for certificate and ticket templates, and the debug email endpoint.
Admin Management Layerverify/admin.pyHandles the internal Django admin workflow for Certification and Ticket, including object registration, search configuration, and read-only display of generated IDs and generated file fields after creation.
Domain Model Layerverify/models.py, verify/utils.pyStores and organizes the core business entities Certification and Ticket, including globally unique ID generation, metadata persistence in PostgreSQL, and generated file path assignment for images and PDFs.
Document Generation and Lifecycle Layerverify/signals.pyHandles model lifecycle side effects, including certificate screenshot generation with headless Chrome, PNG-to-PDF conversion, upload to object storage, deletion of stored assets on record removal, and outbound email sending through the configured mailer service.
Storage Integration Layerverify/storage.pyProvides the custom storage abstraction on top of S3-compatible storage, including backend URL rewriting so generated asset links resolve to this service’s verification routes instead of direct bucket objects.
Presentation Template Layerverify/templates/cert.html, verify/templates/ticket.html, verify/static/Provides the HTML, CSS, fonts, and image assets used to render the certificate and ticket layouts that are served directly to clients and reused as visual sources in the document generation pipeline.
Runtime Bootstrap Layermanage.py, scripts/docker-entrypoint.sh, Dockerfile, build_files.sh, requirements.txt, vercel.jsonProvides the executable and operational foundation for the backend service, including local Django management commands, dependency installation, static collection, database migration, Gunicorn startup, container image build, and optional Vercel deployment configuration.

☁️ Operational Playbook

Infrastructure​

Environment Variables​

KeyDescriptionDefault (Dev)Sensitive?
APP_HOSTHost allowed to access the application*No
AWS_ACCESS_KEY_IDAWS access key used to access S3 servicesβ€”Yes
AWS_SECRET_ACCESS_KEYAWS secret key used for S3 authenticationβ€”Yes
AWS_S3_REGION_NAMEAWS region where the S3 bucket is hostedap-southeast-1No
AWS_STORAGE_BUCKET_NAMEName of the S3 bucket used for file storageristek-verifyNo
DB_HOSTHostname or IP address of the database server10.119.107.142No
DB_PORTPort used to connect to the database5432No
DB_NAMEName of the database used by the applicationristek_verifyNo
DB_USERUsername used to connect to the databasepostgresNo
DB_PASSPassword used for database authenticationβ€”Yes
DEBUGFlag to enable or disable debug mode0No
DJANGO_SECRET_KEYSecret key used by Django for cryptographic signingβ€”Yes
EMAIL_HOSTSMTP server used to send emailssmtp.gmail.comNo
EMAIL_HOST_USEREmail address used for sending emailsrewards@ristek.cs.ui.ac.idNo
EMAIL_HOST_PASSWORDPassword used for the email accountβ€”Yes
FRONT_END_URLBase URL of the frontend applicationhttps://verify.ristek.cs.ui.ac.idNo
MAILER_SERVICE_URLURL of the external mailer servicehttps://mailer.ristek.cs.ui.ac.idNo
MAILER_TOKENAuthentication token for mailer serviceβ€”Yes

πŸ™‹Questions

πŸ—’ List of frequently asked questions or question that need to be answered that is related to this initiative ..