# Deploy a Next.js, Nuxt or Node.js app

Put a Next.js, Nuxt, Express or other Node.js app online from your repository, choose its Node.js version and start command, and run several copies of it.

This guide puts a JavaScript app that keeps running (Next.js, Nuxt, Express or any Node.js server) online from your repository. Fuzops builds it on every update, keeps it running, restarts it if it stops, and starts the new version beside the old one so visitors do not notice the switch.

## What you need

- A **JavaScript app server** or **Website server** that is **Online**.
- Your project at GitHub, GitLab or Bitbucket, connected under **Team and settings** › **Code hosting**.
- Your app must read the port to listen on from the `PORT` setting (Next.js, Nuxt and most frameworks do this by themselves).

## Steps

1. **Add the site.** Choose **Add a site**, then pick your framework in the list under **Or pick the exact kind of site**: **Next.js**, **Nuxt 4** (or 3, 2), **Express** or **Node.js app** for anything else, such as Fastify or NestJS. For a site built into static files (Vite, Astro, a Nuxt static site), pick **JavaScript site (static files)** or **Nuxt (static files)** instead: it needs no running app.

2. **Address.** Choose the server and type the address.

3. **Code and settings.** Pick the repository and **Branch** and the **Node.js version** (the versions your framework can run on are listed). Under **More options** you can change the **Start command** (empty uses the framework's usual one, such as `npm run start`) and **Prepare the new version** (the build). Choose **Add site**.

4. **Add your settings.** Until you publish, your address shows a short "waiting for its first version" page instead of an error. Open **Updates** › **Environment** and add what your app reads, for example API keys or `DATABASE_URL`. Tick **Restart the app** under **After saving** if the app is already running, or choose **Save and publish update**.

5. **Watch the first update.** Install packages, build, switch, restart the app. **Restart the app** starts the new version beside the running one and moves visitors over only when it answers.

   ![The page of a published update of a Node.js site, step by step](https://internal.fuzops.com/docs-img/update-published.webp)

6. **Optional: change how the app runs.** Open **Update settings** › **How the app runs**: the **Start command**, the number of **Copies of the app** for a busy app (store sessions outside the app's memory first) and **Restart the app if it uses more than** a number of MB for each copy. Choose **Save and apply**: the app starts again beside the running copy, so visitors see no break.

   ![Copies of the app in Update settings](https://internal.fuzops.com/docs-img/site-copies-of-the-app.webp)

7. **Point your domain and turn on HTTPS.** See [Point your domain and turn on HTTPS](https://internal.fuzops.com/docs/guides/point-your-domain-and-turn-on-https).

## Coming from PM2

You do not need PM2: Fuzops keeps the app running, starts it again if it stops and starts it when the server boots. What an ecosystem file sets lives here:

| In PM2 | In Fuzops |
|---|---|
| `script`, `args`, `interpreter` | **Start command**, for example `node dist/server.js --flag` or `bash start.sh` |
| `env` | The site's **Environment** page: every line is given to the app when it starts |
| `instances`, `exec_mode: cluster` | **Copies of the app** |
| `max_memory_restart` | **Restart the app if it uses more than** |
| `pm2 logs` | **The app's own log**, on the site's **Logs** and on each update's page |
| `pm2 reload` | Every update starts the new version beside the running one, then moves visitors over |

A website that already runs under PM2 on a server you brought in moves with **Run this app with Fuzops** on its site page, without a break: Fuzops reads these settings from PM2 for you. See [Run a website's app with Fuzops](https://internal.fuzops.com/docs/bring-in-a-server#run-a-websites-app-with-fuzops).

Background jobs that are not the website itself can be brought over from their ecosystem file on the server's **Background processes**: see [Coming from PM2 or Supervisor](https://internal.fuzops.com/docs/background-processes-and-scheduled-jobs#coming-from-pm2-or-supervisor).

## What you should see

The site page says it is live. **Background workers** is empty unless you add one; the app itself is kept running by Fuzops. Each push to the branch publishes a new update when automatic updates are on.

## If it goes wrong

- **Stopped at "Restart the app": the new version did not start.** The new version stopped or never answered, so visitors stayed on the version that worked. Read the lines shown under **See what went wrong** for the error your app printed, fix it and publish again. A common cause is an app that always listens on a fixed port instead of `PORT`.
- **Stopped at "Build"**: the build failed in your code or ran out of memory. A **JavaScript app server** has extra memory for builds; you can also [build in your CI](https://internal.fuzops.com/docs/guides/publish-builds-from-github-actions).
- **502 Bad Gateway**: see [Fix "502 Bad Gateway" after an update](https://internal.fuzops.com/docs/guides/fix-502-bad-gateway).
