Next.js / Setup

Step 12 of 23

Install and initialize Altified

Run one initializer from your Next.js project root to wire automatic server translation and locale routing.

Altified supports Next.js 15 or newer with React 18 or newer. The application must use the App Router. Install the package with the same package manager your project already uses.

pnpm
pnpm add @altified/next
pnpm exec altified init
npm
npm install @altified/next
npx altified init

The initializer detects JavaScript or TypeScript and whether the project uses a src/ directory.

  • Adds missing server-only settings to .env.local.
  • Creates the server client in lib/altified.
  • Creates proxy.js or proxy.ts for locale routing.
  • Wraps the existing Next config with withAltified for automatic JSX translation.

The initializer does not add visible UI or modify your root layout. You place the language switcher yourself in the exact header, navigation, or other component where it belongs.

Read the command output. A Kept line means an existing file or value was preserved. A warning means the initializer could not safely recognize a custom config; follow the manual example in the next step.

Local Altified backend

Use pnpm exec altified init --local to add ALTIFIED_API_URL=http://localhost:8000. Do not use --force unless you intend to replace generated integration files.