Ask your question and get a summary of the document by referencing this page and the AI provider of your choice
Version History
- "Extracted from the Intlayer CMS documentation into its own page"v9.0.008/07/2026
- "Add live sync documentation"v6.0.122/09/2025
- "Replace `hotReload` field with `liveSync`"v6.0.004/09/2025
The content of this page was translated using an AI.
See the last version of the original content in EnglishIf you have an idea for improving this documentation, please feel free to contribute by submitting a pull request on GitHub.
GitHub link to the documentationCopy doc Markdown to clipboard
Live sync
Live Sync allows your app to reflect CMS content changes at runtime. No rebuild or redeploy is required. When enabled, updates are streamed to a Live Sync server that refreshes the dictionaries your application reads.
Table of contents
Enabling Live Sync
Live Sync requires a continuous server connection and is available on the enterprise plan.
Enable Live Sync by updating your Intlayer configuration:
Copy the code to the clipboard
import type { IntlayerConfig } from "intlayer";
const config: IntlayerConfig = {
// ... other configuration settings
editor: {
/**
* Enables hot reloading of locale configurations when changes are detected.
* For example, when a dictionary is added or updated, the application updates
* the content displayed on the page.
*
* Because hot reloading requires a continuous connection to the server, it is
* only available for clients of the `enterprise` plan.
*
* Default: false
*/
liveSync: true,
},
dictionary: {
/**
* Controls how dictionaries are imported:
*
* - "fetch": Dictionaries are fetched dynamically using the Live Sync API.
* Replaces useIntlayer with useDictionaryDynamic.
*
* Note: Live mode uses the Live Sync API to fetch dictionaries. If the API call
* fails, dictionaries are imported dynamically.
* Note: Only dictionaries with remote content and "live" flags use live mode.
* Others use dynamic mode for performance.
*/
importMode: "fetch",
},
};
export default config;Start the Live Sync server to wrap your application:
Example using Next.js:
Copy the code to the clipboard
{ "scripts": { // ... other scripts "build": "next build", "dev": "next dev", "start": "npx intlayer live --with 'next start'", },}Example using Vite:
Copy the code to the clipboard
{ "scripts": { // ... other scripts "build": "vite build", "dev": "vite dev", "start": "npx intlayer live --with 'vite start'", },}The Live Sync server wraps your application and automatically applies updated content as it arrives.
To receive change notifications from the CMS, the Live Sync server maintains an SSE connection to the backend. When content changes in the CMS, the backend forwards the update to the Live Sync server, which writes the new dictionaries. Your application will reflect the update on the next navigation or browser reload, no rebuild required.
Flow chart (CMS/Backend -> Live Sync Server -> Application Server -> Frontend):
How it works:
Development workflow (local)
- In development, all remote dictionaries are fetched when the application starts, so you can test updates quickly.
- To test Live Sync locally with Next.js, wrap your dev server:
Copy the code to the clipboard
{ "scripts": { // ... other scripts "dev": "npx intlayer live --with 'next dev'", // "dev": "npx intlayer live --with 'vite dev'", // For Vite },}Enable optimisation so Intlayer applies the Live import transformations during development:
Copy the code to the clipboard
import type { IntlayerConfig } from "intlayer";
const config: IntlayerConfig = {
editor: {
applicationURL: "http://localhost:5173",
liveSyncURL: "http://localhost:4000",
liveSync: true,
},
dictionary: {
importMode: "fetch",
},
build: {
optimize: true,
},
};
export default config;This setup wraps your dev server with the Live Sync server, fetches remote dictionaries at startup, and streams updates from the CMS via SSE. Refresh the page to see changes.
Notes and constraints
- Add the live sync origin to your site security policy (CSP). Ensure the live sync URL is allowed in
connect-src(andframe-ancestorsif relevant). - Live Sync does not work with static output. For Next.js, the page must be dynamic to receive updates at runtime (e.g., use
generateStaticParams,generateMetadata,getServerSideProps, orgetStaticPropsappropriately to avoid full static-only constraints). - In the CMS, each dictionary has a
liveflag. Only dictionaries withlive=trueare fetched via the live sync API; others are imported dynamically and remain unchanged at runtime. - The
liveflag is evaluated for each dictionary at build time. If remote content was not flaggedlive=trueduring build, you must rebuild to enable Live Sync for that dictionary. - The live sync server must be able to write to
.intlayer. In containers, ensure write access to/.intlayer.