Commands.app

Environment Variables

Configuration

Using environment variables in Next.js

Examples
Common usage examples

Set public env variable

NEXT_PUBLIC_API_URL=https://api.example.com next dev

Build for production

NODE_ENV=production next build
Notes
  • Use NEXT_PUBLIC_ prefix for browser-accessible variables
  • Create .env.local for local development
  • .env.production for production builds
Related Commands
You might also find these useful