Deploy a Next.js app to Miget in a few minutes. Miget auto-detects Node.js from your package.json, installs dependencies, builds, and serves your app on a public URL.

Prerequisites

Before you start, make sure you have:
  • A Miget account.
  • Git installed locally and your app in a Git repository.
  • A Next.js app with a package.json.
Your package.json scripts must include a build and start command so the buildpack can detect and run your app:
package.json
{
  "scripts": {
    "build": "next build",
    "start": "next start"
  }
}
Every app on Miget must listen on 0.0.0.0:5000. Miget sets an immutable PORT=5000 environment variable, and public ingress only reaches port 5000. next start respects the PORT env var, so it binds to 5000 automatically - you don’t need to configure anything. See Ports for details.

Deploy

1

Create an application

Go to app.miget.com, select New, then Application. Give your app a name, select the resource it should run in, and select Next.
2

Choose the builder

Select Auto detection (Miget Buildpacks) as the builder, pick a size, then select Next. Miget will detect Node.js from your package.json.
3

Select the deployment method

Select git push, then Create. Copy the git token shown - you’ll need it to authenticate your push.
4

Push your code

Add the Miget remote and push. Replace <region>, <your-miget-name>, and <app-name> with your own values:
git remote add miget https://git.<region>.miget.io/<your-miget-name>/<app-name>
git push miget
Miget detects Node from your package.json, installs dependencies, runs next build, starts your app with next start, and deploys it to a public URL.
This guide uses git push, but it’s one of several ways to deploy. You can also connect a GitHub repository for auto-deploys and pull request previews, deploy from a public Git repository, or push a prebuilt container image. See all deployment methods.

Add a database (optional)

Need persistent storage? Add a PostgreSQL database to your app:
  1. Open your app’s Addons tab.
  2. Add a PostgreSQL addon.
Miget automatically injects a DATABASE_URL environment variable (a postgres://... connection string) into your app. Read it in your code:
const connectionString = process.env.DATABASE_URL;
See PostgreSQL for connection details and Using secrets for managing your own environment variables.

Next steps

Git push to builder

Learn how the git push deployment flow works end to end.

GitHub integration

Connect a repository for auto-deploys and PR previews.

Custom domains

Point your own domain at your Next.js app.

Fair Scheduler

Understand how Miget shares compute across your apps.