> ## Documentation Index
> Fetch the complete documentation index at: https://nextjs-egg.nyxel.my.id/llms.txt
> Use this file to discover all available pages before exploring further.

# Installation

> How to import the Next.js egg into your Pterodactyl or Pelican panel and create your first server.

## Import the egg

<Steps>
  <Step title="Download the egg JSON">
    Download `next-js-egg.json` from the [Synxx12/nextjs-egg](https://github.com/Synxx12/nextjs-egg) GitHub repository.

    You can download it directly from the repository's file list, or with curl:

    ```bash theme={null}
    curl -LO https://raw.githubusercontent.com/Synxx12/nextjs-egg/main/next-js-egg.json
    ```
  </Step>

  <Step title="Import the egg into your panel">
    In your Pterodactyl Admin Panel, navigate to **Nests** in the left sidebar, then click **Import Egg** in the top right corner.

    Upload the `next-js-egg.json` file you downloaded in the previous step.

    <Note>
      The egg is compatible with both **Pterodactyl Panel v1.x** and **Pelican Panel**. The import process is identical on both panels.
    </Note>
  </Step>

  <Step title="Assign the egg to a nest">
    After importing, you will be prompted to select which nest the egg belongs to. Choose an existing nest (for example, "Applications" or "Node.js") or create a new one.

    The nest is just an organisational grouping — it does not affect how the egg behaves.
  </Step>

  <Step title="Create a server using the egg">
    Go to **Servers** → **Create New** (or use the client area if your panel exposes it there). Under **Nest Configuration**, select the nest you assigned the egg to, then select the **Next.js** egg from the egg dropdown.

    Fill in the server's resource limits (RAM, disk, CPU) and the egg variables. The only required variable is `GIT_URL` — see the table below for the full list.

    Click **Create Server** to finish.
  </Step>
</Steps>

## Egg variables reference

These variables appear on the server's **Startup** tab after creation. You can edit them at any time and they take effect on the next server start.

| Variable                | Env key            | Default      | Description                                                                                                              |
| ----------------------- | ------------------ | ------------ | ------------------------------------------------------------------------------------------------------------------------ |
| Git Repository URL      | `GIT_URL`          | *(empty)*    | Full HTTPS URL of your repo, e.g. `https://github.com/user/repo`. Leave empty to skip cloning and upload files manually. |
| Git Branch              | `GIT_BRANCH`       | `main`       | Branch to clone and run. Leave empty to use the repository's default branch.                                             |
| Auto Update             | `AUTO_UPDATE`      | `1`          | Set to `1` to pull the latest commits on every startup, `0` to disable.                                                  |
| Git Username            | `USERNAME`         | *(empty)*    | Your GitHub/GitLab username. Required only for private repositories.                                                     |
| Git Access Token        | `ACCESS_TOKEN`     | *(empty)*    | Personal access token with `repo` scope. Required only for private repositories.                                         |
| Run Environment         | `NODE_RUN_ENV`     | `production` | `production` runs `next build` + `next start`. `development` runs `next dev` with hot-reload.                            |
| Package Manager         | `PACKAGE_MANAGER`  | `auto`       | `auto` detects from your lockfile. Or explicitly set `npm`, `pnpm`, or `yarn`.                                           |
| Cloudflare Tunnel Token | `CLOUDFLARE_TOKEN` | *(empty)*    | Optional. Token from your Cloudflare Zero Trust dashboard. Leave empty to disable.                                       |

<Warning>
  Never embed credentials directly in `GIT_URL`. For private repositories, leave `GIT_URL` as a plain HTTPS URL and set `USERNAME` and `ACCESS_TOKEN` separately. The egg injects them into the URL automatically.
</Warning>

## What happens during installation

When a server is first created, the panel runs an installation script inside a temporary container. That script:

1. Installs system dependencies (`git`, `curl`, `jq`, and build tools).
2. Downloads `entrypoint.sh` from the egg repository into `.pterodactyl/` inside the server's volume.
3. If `GIT_URL` is set, clones your repository and runs `npm ci` or `npm install` to pre-install dependencies.

The entrypoint script is re-downloaded on each server start if it is not already present, so you always run the latest version.

## Next steps

With the egg installed and your server created, follow the [Quick Start](/quickstart) guide to configure your variables and get your Next.js app running.
