How can we help?

Search our guides and tutorials, or browse the categories below.

How do I deploy my Next.js app?

Apps 97 views Markdown
  1. In the panel, open My servers and click your server.
  2. On the Overview tab, wait for the App row to say "Next.js is ready".
  3. Open the Panel address link and sign in with the Email and Password rows. The server and a first project are ready.

Connect your repository

  1. On the Projects page, open My first project and production, then press New resource.
  2. For a public repository, choose Public Git Repository, enter the address and press Check repository.
  3. For a private repository, first press Generate ED25519 on the Private Keys page under Keys & Tokens and add the public key to the repository's Deploy keys on GitHub. Then choose Private Git Repository (with Deploy Key) and enter [email protected]:user/project.git.
  4. Leave Build pack on Railpack and press Continue. Coolify marks Railpack as beta, so choose your own Dockerfile if it gives you trouble.
  5. Enter your variables on the Environment Variables page and press Deploy. An HTTPS test address is on the Domains page.

Deploying with git push

  1. On the app's Webhooks page, copy the Webhook URL from the GitHub section, enter a random value of at least 16 characters in Webhook secret and save.
  2. On GitHub, open the repository's Settings, go to Webhooks and press Add webhook. Use that address as Payload URL, application/json as Content type, the same value as Secret, and push as the only event.

From then on, every git push to the chosen branch builds and publishes a new version. After changing a variable that starts with NEXT_PUBLIC_, press Redeploy. If a build runs out of memory, scale up from your panel.

Your domain

Point the A record at the server's IP. On the Domains page, use Add domain, choose https, enter the domain, save and press Redeploy. Coolify gets the certificate.

Closing ports 8000, 6001 and 6002

Once the panel opens on its HTTPS address, these ports aren't needed. Docker skips ufw on the ports it publishes, so ufw won't close them. Connect over SSH and follow Coolify's official route:

cd /data/coolify/source

printf 'services:\n coolify:\n ports: !override\n - "127.0.0.1:8000:8080"\n - "127.0.0.1:6001:6001"\n - "127.0.0.1:6002:6002"\n' > docker-compose.custom.yml

curl -fsSL https://cdn.coollabs.io/coolify/install.sh | bash

The last command refreshes the install and moves to a newer version if there is one. To undo this, delete the file and run the same command.

Good to know

Coolify connects over SSH as root with its own key. Disabling root login or removing the coolify line from /root/.ssh/authorized_keys stops deployments.

No server yet? Order a server with Next.js installed: you choose the size and pay for what you choose.

Was this helpful?

Thanks for your feedback!

Still Need Help?

If you can't find what you need, get in touch.