Skip to main content

Developer Documentation

Technical documentation for developers working with Caliper β€” an AI-powered educational assessment platform.

Overview​

Caliper is built with:

  • Backend: Django 5.2 + Django REST Framework
  • Frontend: React 18 + TypeScript + Material UI (MUI)
  • Database: PostgreSQL 15
  • Task Queue: Celery + Redis
  • AI: Anthropic Claude, DeepSeek, and OpenAI-compatible APIs (environment-switched)
  • Storage: GitHub integration + local storage
  • Deployment: Docker Compose + Nginx

Note on FastAPI: an earlier FastAPI migration was archived and is not part of the current production stack. The live backend is Django. See the archived _api_archived_fastapi/ directory in the repo for history.

Architecture​

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”         β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”         β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ React β”‚ ◄─────► β”‚ Nginx β”‚ ◄─────► β”‚ Django β”‚
β”‚ Frontend β”‚ β”‚ Reverse Proxyβ”‚ β”‚ Backend β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
β”‚
β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ Redis β”‚ ◄─────► β”‚ PostgreSQL β”‚
β”‚ (Celery) β”‚ β”‚ Database β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
β”‚
β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ Celery β”‚ ◄─────► β”‚ GitHub β”‚
β”‚ Workers β”‚ β”‚ Storage β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
β”‚
β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ AI Provider β”‚
β”‚ (Claude/etc) β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Key models​

Organisation & licensing:

  • Organisation, UserProfile, License, Policy

Educational structure:

  • School, Teacher, Learner, SchoolClass, Subject, Cluster

Assessment:

  • Assessment, Assignment, Submission, Grade, Rubric

PAT system:

  • PATAssessment, PATPhase, PATConsolidatedReport, Portfolio

Reporting:

  • LaTeXReportTemplate, GeneratedReport, CommentTemplate, CommentGeneration, GeneratedComment

AI assistant:

  • ChatSession, ChatMessage, ChatJob, AssistantSession, Artifact, MemoryTopic

Curriculum & paper generation:

  • CurriculumPage, PastPaperQuestion, PaperTemplate, PaperNode, Workspace, StyleProfile

Release & privacy:

  • ResultRelease, TeacherDataExport, TeacherDataCleanup, ImpersonationSession

Roles​

UserProfile.role is one of: student, teacher, admin, school_admin, organisation_admin.

AI provider configuration​

The marking engine reads the provider from environment variables:

VariablePurpose
AI_API_KEYAPI key for the AI service
AI_MARKING_SERVICE_URLEndpoint URL (e.g. https://api.deepseek.com/v1/chat/completions)
MODEL_NAMEModel name (e.g. deepseek-chat, claude-3-5-sonnet)

The system auto-detects the provider from the URL β€” Anthropic uses the x-api-key header and its message format; other providers use Authorization: Bearer and the OpenAI-compatible format. The in-app AI assistant defaults to deepseek-v4-pro.

GitHub storage modes​

FILE_STORAGE_MODE selects the storage backend:

  1. LOCAL_ONLY β€” local storage only (default)
  2. GITHUB_ONLY β€” GitHub only, no local storage
  3. GITHUB_PRIMARY β€” GitHub first, local as cache
  4. LOCAL_PRIMARY β€” local first, backup to GitHub

Deployment​

Docker services​

services:
caliper-db: # PostgreSQL 15
caliper-redis: # Redis 7 for Celery
caliper-django: # Django (Gunicorn)
nginx: # Reverse proxy + SSL

Environment variables​

# Database
DB_NAME, DB_USER, DB_PASSWORD, DB_HOST, DB_PORT

# AI provider
AI_API_KEY
AI_MARKING_SERVICE_URL
MODEL_NAME

# GitHub storage
FILE_STORAGE_MODE

# Django
SECRET_KEY, DEBUG, ALLOWED_HOSTS
CORS_ALLOWED_ORIGINS

Local development​

# Backend
cd backend/django_app
python manage.py runserver

# Frontend
cd frontend
npm start

# Celery worker
celery -A config worker -l info

# Redis
redis-server

Compliance​

Support​