How mozilla/pontoon works
Project Type and Purpose
• Pontoon is a full-stack, community-driven localization platform:
• Django-based monolithic backend (“pontoon” Python package)
• React/TypeScript single-page frontend (“translate” directory)
• Celery workers for asynchronous jobs (sync, checks, messaging, insights)
• Uses version-control repositories to pull/push translations
Top-Level Components
a. Client Layer
– Browser running the React SPA (translate/src)
– Static assets (HTML, JS, CSS) served via Django’s staticfiles or CDN
b. Web & API Layer
– Nginx (or equivalent) as reverse proxy / static-file server (optional)
– Gunicorn (WSGI) serving Django application (wsgi.py)
– Django apps grouped by domain (authentication, api, base, sync, messaging, insights, machinery, etc.)
– Django REST Framework (pontoon/api) exposing JSON endpoints consumed by the SPA
c. Data Layer
– PostgreSQL (or other RDBMS) for models and migrations (pontoon/*/models.py)
– Redis (or RabbitMQ) as Celery broker & cache backend
d. Background Processing
– Celery workers running tasks from modules:
· pontoon/sync/tasks.py (repo sync)
· pontoon/checks/tasks.py (quality checks)
· pontoon/messaging/management commands (email notifications)
· pontoon/insights/tasks.py (analytics snapshots)
· pontoon/pretranslation/tasks.py
– Scheduled jobs via cron or Heroku Scheduler invoking Django manage.py commands
e. External Services
– VCS servers (GitHub, Mercurial) as translation source/sink
– Third-party MT and terminology APIs (Google, Microsoft, Systran, OpenAI)
– OAuth providers via allauth (GitHub, Google, etc.)
Relationships and Data Flows
• Browser → HTTP(S) → Nginx → Gunicorn → Django views / DRF API
• Django ORM ↔ PostgreSQL
• Django cache layer / sessions ↔ Redis
• Django Celery tasks ↔ Redis broker → Celery workers → update DB / send emails / sync repos
• Celery beat / scheduled tasks → sync command → VCS checkout & commit → push back
• API calls from frontend to DRF endpoints for translation actions, comments, filters, etc.
• External MT APIs invoked by machinery services in backend, results cached in DB
Architectural Patterns & Principles
• Monolithic modular architecture: domain-specific Django apps
• Client-server separation: React SPA decoupled from backend
• API-first design: REST endpoints in pontoon/api consumed by frontend
• Asynchronous processing: Celery for long-running jobs
• 12-factor app: environment variables, separate build/runtime config, stateless web processes
• Dockerized deployment: Dockerfiles, docker-compose for local dev, Procfile for Heroku
Final Checklist
[ ] Callouts for major Django subsystems: API, sync, checks, messaging, insights, base
[ ] Notes on deployment artifacts: Docker images, Procfile, manage.py commands