Skip to content
fluenti

SSR, SSG & ISR

@fluenti/nuxt supports all Nuxt rendering modes out of the box. For general SSR concepts, see the SSR & Hydration guide.

ModeHow it works
SSRServer 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
ISRPre-rendered with configurable TTL, re-validated on demand
SPA (ssr: false)Client-side path detection, cookie fallback

With @fluenti/nuxt, SSR/SSG/ISR work automatically:

// nuxt.config.ts — this is all you need
export default defineNuxtConfig({
modules: ['@fluenti/nuxt'],
fluenti: {
locales: ['en', 'ja', 'zh'],
defaultLocale: 'en',
},
})
Server (SSR/SSG) Client
───────────────── ──────
1. Run detector chain 1. Read locale from Nuxt payload
(path → cookie → header) 2. Skip detection — use server value
2. Store locale in Nuxt payload 3. Watch route.path for nav changes
3. Render HTML with correct locale 4. Sync cookie on locale change

The plugin stores the detected locale in nuxtApp.payload, which Nuxt serializes into the HTML. The client reads it back on hydration — no mismatch.

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 ← zh

During SSG build:

  • Path detector extracts locale from each route’s URL (/ja/aboutja)
  • Cookie and header detectors silently fail (no HTTP context) — this is by design
  • Each page is rendered in the correct locale

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 },
}
PropertyTypeDefaultDescription
enabledbooleanEnable ISR route rules generation
ttlnumber?3600Cache TTL in seconds