How do I set up CDN delivery?

4 min de lecturaPrincipiante

CDN delivery is how your app fetches translations at runtime. Instead of bundling translations in your build, your app loads them from Better i18n's global CDN — meaning you can update translations without rebuilding or redeploying.

How it works

Your app loads → SDK fetches translations from CDN → renders UIMulti-layer cache: memory → CDN → storage → fallback

Translations are served from edge locations worldwide with sub-100ms latency.

Enabling CDN

  1. Go to your project → Integrations tab
  2. Find the Content Delivery Network (CDN) card
  3. Click Manage
  4. Click Enable to activate CDN delivery

Once enabled, your translations are uploaded to the CDN every time you publish.

CDN URLs

Published translations are available at:

https://cdn.better-i18n.com/{org}/{project}/manifest.json
https://cdn.better-i18n.com/{org}/{project}/{locale}/translations.json

You don't need to use these URLs directly — the SDK handles fetching automatically.

SDK configuration

Configure your SDK with your project identifier:

import { createI18n } from '@better-i18n/next';

const i18n = createI18n({
  project: 'acme/dashboard',
  defaultLocale: 'en',
});

The SDK will:

  1. Check in-memory cache (60s TTL)
  2. Fetch from CDN if cache is stale
  3. Fall back to persistent storage (mobile/offline)
  4. Use static fallback data if everything else fails

Cache behavior

Layer TTL Purpose
In-memory (SDK) 60 seconds Fastest access
CDN edge Purged on publish Global distribution
Persistent storage Indefinite Offline/mobile support
Static fallback Build-time Last resort

After publishing, users see updated translations within ~60 seconds.

CDN without GitHub

CDN delivery works independently of GitHub. You can:

  • Upload JSON files directly
  • Edit translations in the dashboard
  • Use AI to translate
  • Publish to CDN

No repository connection required.

Next steps