What is the Next.js Egg?
The Next.js Egg is a production-ready Pterodactyl/Pelican egg that lets you host any Next.js application directly from a Git repository. Instead of manually uploading build artifacts or SSHing into a server, you point the egg at your repo, set a handful of variables in the panel, and it handles the rest: cloning, dependency installation, building, and starting your app. It is designed for Pterodactyl Panel v1.x and Pelican Panel users who want a repeatable, panel-managed workflow for Next.js hosting.Key capabilities
Git-based deployment
The egg clones your repository on first start and optionally pulls the latest commits on every subsequent start with
AUTO_UPDATE=1.Production & development modes
Set
NODE_RUN_ENV to production to run next build + next start, or development to run next dev with hot-reload.Private repository support
Authenticate with a GitHub or GitLab personal access token. The egg injects credentials into the clone URL automatically — you never embed secrets in the URL itself.
.env injection
Upload a
.env.pterodactyl file via the panel File Manager and the egg copies it to .env before your app starts. No secrets in panel variables.Package manager auto-detection
Set
PACKAGE_MANAGER to auto and the egg inspects your lockfile: pnpm-lock.yaml → pnpm, yarn.lock → yarn, otherwise npm. You can also pin a specific manager.Cloudflare Tunnel
Optionally provide a
CLOUDFLARE_TOKEN and the egg starts a Cloudflare Tunnel alongside your app, exposing it through your Zero Trust dashboard without opening a port.Requirements
Before you create a server with this egg, make sure the following are true:- You are running Pterodactyl Panel v1.x or Pelican Panel.
- Your project has a valid
package.jsonwithnextlisted as a dependency. - Your
next.config.js(ornext.config.ts) does not hardcode a port number. The egg injectsSERVER_PORTat runtime and passes it tonext start/next devvia the-pflag.
The egg sets the
SERVER_PORT environment variable to the port allocated by the panel. Your Next.js config should read the port dynamically (or omit it entirely, since the egg passes -p on the command line).Supported Docker images
The egg ships with Node.js images ranging from 18 LTS to 25 (latest). Node.js 24 LTS is the recommended choice for production workloads.Next steps
Installation
Import the egg JSON into your panel and create your first server.
Quick Start
Get your Next.js app running in minutes with the minimum required configuration.