Before you begin
Make sure you have already imported the egg and created a server. If not, complete the Installation guide first. Your Next.js project must meet these requirements:- A valid
package.jsonwithnextlisted as a dependency. - Your
next.config.jsmust not hardcode a port. The egg passes the panel-allocated port via the-pflag at runtime.
Configure and start your server
Import the egg and create a server
If you have not done so yet, follow the Installation guide to import
next-js-egg.json and create a server. Return here once your server exists in the panel.Set your Git repository URL
On the server’s Startup tab, set The egg clones this URL on first start. On subsequent starts it either pulls new commits (if
GIT_URL to the full HTTPS URL of your repository:AUTO_UPDATE=1) or skips the pull.If you prefer to upload your project files manually instead of using Git, leave
GIT_URL empty and upload your files via the panel File Manager. The egg will skip cloning and use whatever files are already in the server volume, as long as a package.json is present.Set the branch
Set
GIT_BRANCH to the branch you want to deploy. The default is main. Leave it empty to let Git use the repository’s default branch.Choose a run environment
Set In
NODE_RUN_ENV to control how Next.js starts:production mode the egg runs next build followed by next start. This produces an optimised build suitable for real traffic.In development mode the egg skips the build step and runs next dev, giving you hot-reload. Use this only for active development — it is slower and not optimised for production traffic.Choose a package manager
Set
PACKAGE_MANAGER to control how dependencies are installed:| Value | Behaviour |
|---|---|
auto (recommended) | Detects from lockfile: pnpm-lock.yaml → pnpm, yarn.lock → yarn, otherwise npm. |
npm | Always uses npm. Uses npm ci if package-lock.json exists, otherwise npm install. |
pnpm | Always uses pnpm. Installs pnpm globally if not present. |
yarn | Always uses Yarn. Installs Yarn globally if not present. |
auto is the safest choice — it uses whichever lockfile you committed to your repo.Start the server
Click Start in the panel. The egg will:
- Clone your repository (first start) or pull latest changes (if
AUTO_UPDATE=1). - Copy
.env.pterodactylto.envif the file exists in the server volume. - Install dependencies using your chosen package manager.
- Run
next build(production mode only). - Start Next.js on the panel-allocated port.
Working with private repositories
If your repository is private, set two additional variables on the Startup tab before starting the server:| Variable | Value |
|---|---|
USERNAME | Your GitHub or GitLab username |
ACCESS_TOKEN | A personal access token with repo scope |
GIT_URL itself.
To create a GitHub personal access token, go to Settings → Developer settings → Personal access tokens → Tokens (classic) and generate a token with the
repo scope.Injecting environment variables
If your app requires a.env file (API keys, database URLs, etc.), do not put secrets directly into panel variables. Instead:
- Create your
.envfile locally with all required keys and values. - Rename it to
.env.pterodactyl. - Upload it to the server’s root directory (
/home/container/) via the panel File Manager. - Start (or restart) the server — the egg copies it to
.envbefore your app starts.
Auto-update behaviour
TheAUTO_UPDATE variable controls what happens on every server start after the first clone:
AUTO_UPDATE | Behaviour |
|---|---|
1 (default) | Runs git reset --hard then git pull to bring the repo up to date before installing and building. |
0 | Skips the pull. The egg installs dependencies and builds from whatever files are currently in the volume. |
AUTO_UPDATE=0 if you want full control over which commit is deployed — for example, if you pin a specific commit or tag manually.