Skip to main content
Set the NODE_RUN_ENV variable in the panel to control how the egg builds and starts your Next.js app. The two supported values are production and development.
Set NODE_RUN_ENV to production.In production mode, the egg runs next build before starting the server. This compiles your app into an optimized output — smaller bundles, static generation, and better runtime performance.Startup sequence:
  1. Install dependencies
  2. Run next build (this can take a minute or more depending on your app’s size)
  3. Run next start -p $SERVER_PORT
Requirements:
  • All environment variables needed at build time must be present before the server starts. Use the .env.pterodactyl injection method to supply them.
  • Missing build-time env vars will cause next build to fail.
Best for: live sites, staging environments, and any deployment where performance matters.

Port configuration

Your app must not hardcode a port. The egg passes SERVER_PORT to Next.js at runtime via the -p flag. Do not set a fixed port in next.config.js — it will conflict with the value the egg provides.

Startup detection

The panel marks your server as Started when it sees one of these strings in the console output:
StringEmitted by
ready onNext.js 13 and earlier
started server onNext.js internals
Local: http://Next.js 14+ dev output
Compiled successfullyDev mode compilation
listening onCustom server or adapter output
▲ Next.jsNext.js 13+ startup banner
If your server stays at Starting… indefinitely, confirm that your app is writing one of these strings to stdout. Custom startup wrappers or logging libraries that suppress stdout may prevent detection.