How to deploy a Next.js app on OnePloy

You can put a production Next.js app online with automatic HTTPS and push-to-deploy in about ten minutes. Here is the full path.

What you need

  • A free OnePloy account
  • A Next.js app in a GitHub, GitLab or Bitbucket repository
  • A domain whose DNS you can edit (optional for a first test)

1. Create a project

Sign in to OnePloy, create a project and choose where it should run: OnePloy Cloud or a server you have connected.

2. Add your app

Add a new application from your repository. Connect GitHub in a click, or use a deploy key for other Git hosts.

3. Let OnePloy build it

Leave the build settings on automatic. OnePloy detects Next.js, installs dependencies, runs the build and starts the server. If your app needs system packages, switch to a Dockerfile.

Make sure your start script listens on the port OnePloy expects:

{
  "scripts": {
    "build": "next build",
    "start": "next start -p 3000"
  }
}

4. Set environment variables

Add runtime variables such as DATABASE_URL. Mark variables that Next.js needs at build time, such as anything prefixed NEXT_PUBLIC_, as build variables.

5. Add your domain

Point your domain at the address shown in the dashboard, then add it to the application. The HTTPS certificate is issued automatically.

6. Deploy

Click deploy and watch the build logs live. Every later push to your branch deploys automatically and only takes traffic once it is healthy.

Note: Add a health check path such as /api/health so each new version is verified before the old one stops.

Start deploying today.

Free to start. Live in minutes. Upgrade when you are ready.