Back to articles
Security & Anti-DDoS

Bergamot: Mozilla's Open-Source Self-Hosted Offline Translation API Solution for Enterprises

Bergamot is an open-source project developed by Mozilla that provides a self-hosted offline translation API, enabling enterprises to maintain full control over their data, achieve...

DPTCloud Engineering6 min read
Bergamot: Mozilla's Open-Source Self-Hosted Offline Translation API Solution for Enterprises

Image credit: genephoto365 · Pixabay Content License

Bergamot is an open-source project developed by Mozilla that provides a self-hosted offline translation API, enabling enterprises to maintain full control over their data, achieve absolute security, and eliminate reliance on third-party cloud services. With a self-hosted architecture, Bergamot allows organizations to deploy internal translation systems on their own infrastructure, ensuring strict compliance with security standards and privacy regulations. The project supports multiple languages, integrates easily with internal applications, and offers a standard API interface, making it ideal for businesses handling sensitive data that cannot be sent over the internet.

Introduction to Bergamot and Security Objectives

Bergamot was built to deliver a self-hosted translation system that operates without internet connectivity, helping businesses avoid data leakage risks when using cloud-based translation services like Google Translate or DeepL. The project uses machine learning-based translation models trained on public data and can be further trained with internal data to ensure translation quality aligns with enterprise context. Bergamot is deployed as an API, enabling integration into internal systems such as chatbots, customer support platforms, or enterprise applications.

A key feature of Bergamot is its ability to function entirely offline, meaning all translation processes occur within the self-hosted environment, with no data transmitted to external servers. This ensures that input and output data are not stored or transmitted through insecure channels. Additionally, Bergamot supports HTTPS encryption, API authentication, and can be deployed on VPS servers with DDoS protection, as outlined in the guide on basic VPS DDoS protection with Fail2Ban, Cloudflare, and iptables [en/blog/huong-dan-cau-hinh-vps-chong-ddos-co-ban-voi-fail2ban-cloudflare-va-iptables](/en/blog/huong-dan-cau-hinh-vps-chong-ddos-co-ban-voi-fail2ban-cloudflare-va-iptables).

Deploying Bergamot on Self-Hosted Infrastructure

To deploy Bergamot, enterprises require a self-hosted server with a minimum configuration of 4GB RAM, as recommended in the guide on self-hosting high-security Federated Identity SSO solutions using Zitadel or Authentik [en/blog/tu-host-giai-phap-federated-identity-single-sign-on-sso-bao-mat-cao-tren-vps-4gb-ram-voi-zitadel-hoac-authentik](/en/blog/tu-host-giai-phap-federated-identity-single-sign-on-sso-bao-mat-cao-tren-vps-4gb-ram-voi-zitadel-hoac-authentik). Bergamot can be deployed on platforms such as Docker or Unikernel, similar to the configuration guide for Unikraft-based Rust applications on hypervisors [en/blog/toi-uu-hoa-hieu-suat-va-bao-mat-huong-dan-cau-hinh-unikernel-voi-unikraft-cho-ung-dung-rust-tren-hypervisor](/en/blog/toi-uu-hoa-hieu-suat-va-bao-mat-huong-dan-cau-hinh-unikernel-voi-unikraft-cho-ung-dung-rust-tren-hypervisor). Deployment steps include installing required libraries, downloading translation models, and setting up the API server.

A simple API configuration example is shown below:

docker run -d --name bergamot \\\n  -p 8080:8080 \\\n  -e API_KEY=your_secret_key \\\n  -e MODEL=ende \\\n  bergamot/bergamot-server

Here, API_KEY is the authentication key for accessing the API, and MODEL specifies the translation model (e.g., ende for English-German). Once started, the API listens on port 8080 and can be accessed from internal applications.

Optimizing Performance and Security

To optimize performance and security, enterprises should deploy Bergamot on VPS infrastructure with L3/L4/L7 Anycast Anti-DDoS capabilities, as offered by the Cloud VPS service at DPTCloud [en/vps](/en/vps). Additionally, leveraging the network security and 99.98% SLA infrastructure at DPTCloud [en/infrastructure](/en/infrastructure) ensures system availability and stability.

Additional security measures include:

  • Configuring firewalls and using iptables to restrict access to the API port.
  • Applying API authentication using keys or JWT tokens.
  • Not storing translated data in databases—processing and returning results only.
  • Setting up API access logs and monitoring for suspicious activity.

Use Cases and Benefits

Bergamot is suitable for various enterprise applications, including:

  • Translating internal content (e.g., documents, emails, reports) between languages.
  • Integrating with customer support systems to provide multilingual services.
  • Translating content on internal platforms such as Moodle or content management systems.

Compared to cloud-based translation solutions, Bergamot offers complete data control, reduces security risks, and ensures compliance with privacy regulations such as GDPR or CCPA. Additionally, as open-source software, enterprises can customize and extend the system to meet specific needs.

Alternative Solutions and Comparison

Alternative solutions to Bergamot include cloud translation APIs such as Google Translate, DeepL, or Microsoft Translator. However, these solutions require sending data over the internet, creating risks of information leakage and dependency on third-party providers. In contrast, Bergamot operates entirely offline, allowing businesses to keep internal data fully within their own systems.

Compared to other self-hosted translation models, Bergamot has the advantage of being easy to deploy, supporting multiple languages, and being developed by Mozilla—a trusted organization known for security and privacy.

Testing and Troubleshooting

To verify Bergamot functionality, enterprises can run the following command:

curl -X POST http://localhost:8080/translate \\\n  -H "Content-Type: application/json" \\\n  -d '{"text": "Hello, world!", "source": "en", "target": "vi"}'

If the API works correctly, the system returns the translated result in Vietnamese.

If issues occur, check the following:

  • Ensure the translation model is correctly loaded.
  • Verify that the API key is correct and provided.
  • Run `docker logs bergamot` to check error logs.
  • Confirm that port 8080 is not blocked by the firewall.

Conclusion

Bergamot is an ideal solution for enterprises requiring offline translation with absolute security. With a self-hosted architecture, easy integration, and open-source flexibility, Bergamot enables businesses to maintain data control, reduce security risks, and comply with privacy regulations. Deploying on self-hosted VPS infrastructure, combined with firewall rules, API authentication, and monitoring, ensures the system operates stably and securely.

Related infrastructure & engineering guides: Cloud VPS with L3/L4/L7 Anycast Anti-DDoS · Self-Hosting Federated Identity SSO with High Security on 4GB RAM VPS using Zitadel or Authentik

DPTCloud Tier III Infrastructure

Recommended NVMe Cloud VPS Plans to Deploy This Setup

Enterprise RAID 10 NVMe SSDs, CMC & FPT District 9 uplinks with Anycast Anti-DDoS and 99.99% SLA.

View 22 VPS Plans
ECO · vn-02

VPS-2E

94.600 ₫ / mo

10% VAT included

  • CPU: 2 vCPU
  • RAM: 2 GB
  • SSD: 30 GB NVMe
ECO · vn-02Recommended

VPS-3E

170.500 ₫ / mo

10% VAT included

  • CPU: 2 vCPU
  • RAM: 4 GB
  • SSD: 50 GB NVMe
BASIC · vn-01Recommended

VPS-05

457.600 ₫ / mo

10% VAT included

  • CPU: 4 vCPU
  • RAM: 8 GB
  • SSD: 50 GB NVMe

Related Articles

View all
ZaloZalo SupportDiscord0384 753 478