# mozilla/pontoon architecture

> Architecture diagram of the GitHub repository mozilla/pontoon, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-02-03). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/mozilla/pontoon
- Repository: https://github.com/mozilla/pontoon

## Overview

##### 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

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Client Layer
    subgraph "Client Layer"
        direction TB
        Browser["Browser (React SPA)"]:::internal
        StaticAssets["Static Assets (HTML, JS, CSS)"]:::internal
        SPA["React SPA"]:::internal
    end

    %% Web/API Layer
    subgraph "Web/API Layer"
        direction TB
        NGINX["Nginx (Reverse Proxy / Static Server)"]:::proxy
        Gunicorn["Gunicorn (WSGI)"]:::internal
        Django["Django Monolith"]:::internal
        API["DRF API Endpoints"]:::internal
        Allauth["Auth & Allauth"]:::internal
        BaseApp["Base / Common"]:::internal
        SyncApp["Repository Sync"]:::internal
        ChecksApp["Quality Checks"]:::internal
        MessagingApp["Messaging & Notifications"]:::internal
        InsightsApp["Insights & Analytics"]:::internal
        PretranslationApp["Pretranslation Pipeline"]:::internal
        MachineryApp["Machine Translation Adapters"]:::internal
    end

    %% Data Layer
    subgraph "Data Layer"
        direction TB
        Postgres["PostgreSQL"]:::db
        Redis["Redis (Broker & Cache)"]:::db
    end

    %% Background Processing
    subgraph "Background Processing"
        direction TB
        CeleryWorkers["Celery Workers"]:::internal
        Scheduler["Scheduler / Cron"]:::internal
        ManagementCmds["Django Management Commands"]:::internal
    end

    %% External Services
    subgraph "External Services"
        direction TB
        VCS["VCS Servers (GitHub, Mercurial)"]:::external
        MTAPIs["MT & Terminology APIs"]:::external
        OAuthProviders["OAuth Providers"]:::external
    end

    %% Connections
    Browser -->|"HTTPS"| NGINX
    StaticAssets -->|"Served by"| NGINX
    NGINX -->|"WSGI"| Gunicorn
    Gunicorn -->|"Calls"| Django
    SPA -->|"JSON API (HTTPS)"| API
    Django -->|"ORM"| Postgres
    Django -->|"Cache/Session"| Redis
    Django -->|"AMQP"| Redis
    Django -->|"Enqueues Tasks"| CeleryWorkers
    Scheduler -->|"Invokes"| ManagementCmds
    ManagementCmds -->|"Schedules Tasks"| CeleryWorkers
    CeleryWorkers -->|"DB Updates / Emails"| Postgres
    CeleryWorkers -->|"Sync Repos"| VCS
    MachineryApp -->|"Calls APIs"| MTAPIs
    Allauth -->|"OAuth Flow"| OAuthProviders

    %% Click Events
    click SPA "https://github.com/mozilla/pontoon/blob/main/translate/src/index.tsx"
    click StaticAssets "https://github.com/mozilla/pontoon/tree/main/translate/public"
    click StaticAssets "https://github.com/mozilla/pontoon/tree/main/pontoon/static"
    click NGINX "https://github.com/mozilla/pontoon/blob/main/docker/config/server.env.template"
    click Gunicorn "https://github.com/mozilla/pontoon/blob/main/pontoon/wsgi.py"
    click Django "https://github.com/mozilla/pontoon/blob/main/manage.py"
    click BaseApp "https://github.com/mozilla/pontoon/blob/main/pontoon/settings/base.py"
    click BaseApp "https://github.com/mozilla/pontoon/blob/main/pontoon/settings/dev.py"
    click API "https://github.com/mozilla/pontoon/blob/main/pontoon/api/serializers.py"
    click API "https://github.com/mozilla/pontoon/blob/main/pontoon/api/views.py"
    click API "https://github.com/mozilla/pontoon/blob/main/pontoon/api/urls.py"
    click API "https://github.com/mozilla/pontoon/blob/main/pontoon/api/authentication.py"
    click Allauth "https://github.com/mozilla/pontoon/blob/main/pontoon/allauth_urls.py"
    click Allauth "https://github.com/mozilla/pontoon/blob/main/pontoon/base/context_processors.py"
    click BaseApp "https://github.com/mozilla/pontoon/tree/main/pontoon/base"
    click SyncApp "https://github.com/mozilla/pontoon/tree/main/pontoon/sync"
    click ChecksApp "https://github.com/mozilla/pontoon/tree/main/pontoon/checks"
    click MessagingApp "https://github.com/mozilla/pontoon/tree/main/pontoon/messaging"
    click InsightsApp "https://github.com/mozilla/pontoon/tree/main/pontoon/insights"
    click PretranslationApp "https://github.com/mozilla/pontoon/tree/main/pontoon/pretranslation"
    click MachineryApp "https://github.com/mozilla/pontoon/tree/main/pontoon/machinery"
    click CeleryWorkers "https://github.com/mozilla/pontoon/blob/main/pontoon/base/celeryapp.py"
    click CeleryWorkers "https://github.com/mozilla/pontoon/blob/main/pontoon/sync/tasks.py"
    click CeleryWorkers "https://github.com/mozilla/pontoon/blob/main/pontoon/checks/tasks.py"
    click CeleryWorkers "https://github.com/mozilla/pontoon/blob/main/pontoon/insights/tasks.py"
    click CeleryWorkers "https://github.com/mozilla/pontoon/blob/main/pontoon/pretranslation/tasks.py"
    click ManagementCmds "https://github.com/mozilla/pontoon/tree/main/pontoon/base/management/commands/"
    click ManagementCmds "https://github.com/mozilla/pontoon/blob/main/pontoon/sync/management/commands/sync_projects.py"
    click ManagementCmds "https://github.com/mozilla/pontoon/blob/main/pontoon/checks/management/commands/run_checks.py"
    click ManagementCmds "https://github.com/mozilla/pontoon/blob/main/pontoon/insights/management/commands/collect_insights.py"
    click ManagementCmds "https://github.com/mozilla/pontoon/tree/main/pontoon/messaging/management/commands/"
    click ManagementCmds "https://github.com/mozilla/pontoon/tree/main/pontoon/machinery/management/commands/"

    %% Styles
    classDef internal fill:#D0E6FF,stroke:#0066CC,color:#003366
    classDef db fill:#DFF2D8,stroke:#2E8B57,color:#2E8B57
    classDef external fill:#FFE5CC,stroke:#FF8C00,color:#8B4513
    classDef proxy stroke-dasharray: 5 5,fill:#F5F5F5,stroke:#999999;color:#666666
```
