SSR, SSG & ISR
@fluenti/nuxt supports all Nuxt rendering modes out of the box. For general SSR concepts, see the SSR & Hydration guide.
| Mode | How it works |
|---|---|
| SSR | Server detects locale per-request, injects into payload, client hydrates |
SSG (nuxt generate) | Each locale route is pre-rendered with the correct locale from its URL path |
| ISR | Pre-rendered with configurable TTL, re-validated on demand |
SPA (ssr: false) | Client-side path detection, cookie fallback |
Zero Config
Section titled “Zero Config”With @fluenti/nuxt, SSR/SSG/ISR work automatically:
// nuxt.config.ts — this is all you needexport default defineNuxtConfig({ modules: ['@fluenti/nuxt'], fluenti: { locales: ['en', 'ja', 'zh'], defaultLocale: 'en', },})How Hydration Works
Section titled “How Hydration Works”Server (SSR/SSG) Client───────────────── ──────1. Run detector chain 1. Read locale from Nuxt payload (path → cookie → header) 2. Skip detection — use server value2. Store locale in Nuxt payload 3. Watch route.path for nav changes3. Render HTML with correct locale 4. Sync cookie on locale changeThe plugin stores the detected locale in nuxtApp.payload, which Nuxt serializes into the HTML. The client reads it back on hydration — no mismatch.
Static Site Generation (SSG)
Section titled “Static Site Generation (SSG)”nuxt generate pre-renders all locale routes:
dist/├── index.html ← en (default, no prefix)├── about/index.html ← en├── ja/index.html ← ja├── ja/about/index.html ← ja├── zh/index.html ← zh└── zh/about/index.html ← zhDuring SSG build:
- Path detector extracts locale from each route’s URL (
/ja/about→ja) - Cookie and header detectors silently fail (no HTTP context) — this is by design
- Each page is rendered in the correct locale
Incremental Static Regeneration (ISR)
Section titled “Incremental Static Regeneration (ISR)”Add one config option:
export default defineNuxtConfig({ fluenti: { locales: ['en', 'ja', 'zh'], defaultLocale: 'en', isr: { enabled: true, ttl: 3600, // re-validate every hour }, },})This auto-generates routeRules for all locale patterns:
// Generated automatically:routeRules: { '/**': { isr: 3600 }, // default locale (prefix_except_default) '/ja/**': { isr: 3600 }, '/zh/**': { isr: 3600 },}ISR Options
Section titled “ISR Options”| Property | Type | Default | Description |
|---|---|---|---|
enabled | boolean | — | Enable ISR route rules generation |
ttl | number? | 3600 | Cache TTL in seconds |