# Deploy Next.js, Nuxt, SvelteKit or Astro on your own VPS with zero downtime

> Host a Node front end next to your PHP apps — a Vite SPA, a static Astro or Nuxt site, or a Next.js, Nuxt, SvelteKit, Astro or Remix server — built on every push, switched blue/green with a health check, with HTTPS, its .env, logs and previews of any branch.

URL: https://cipi.sh/guides/deploy-nextjs-nuxt-astro · Last updated: 2026-12-03 · By Andrea Pollastri · 5 min read · Category: Get started

A Node front end doesn't need a platform of its own. On a Cipi server it is one more app, next to your Laravel and WordPress sites: built from Git on every push, served by Nginx with HTTPS, and — for a Node server — switched **blue/green**, so a release only gets traffic once it answers.

| What you deploy | Mode | Served by |
| --- | --- | --- |
| A Vite SPA (React, Vue, Svelte) | `spa` | Nginx, from the build; unknown paths fall back to `/index.html` |
| A pre-rendered site (Astro, Nuxt generate, Next export) | `static` | Nginx, from the build; real 404s from `/404.html` |
| A Node server (Next.js, Nuxt, SvelteKit, Astro SSR, Remix) | `ssr` | Your Node process on localhost, behind Nginx, blue/green |

1. **Create** — one command
2. **Environment** — .env at build and runtime
3. **Deploy** — build, health, switch
4. **Push** — deploys by itself
5. **Run** — logs, restarts, versions
6. **Preview** — any branch, live

## Before you start

| You need | Why |
| --- | --- |
| A server with Cipi ([install](https://cipi.sh/docs/installation)) | Ubuntu 24.04 or 26.04. Builds want memory: 2 GB of RAM for a Next.js app, more with several |
| The repository on GitHub, GitLab, Bitbucket, Gitea or Azure DevOps | Every deploy is a build of it |
| A lockfile in the repository | `package-lock.json`, `pnpm-lock.yaml`, `yarn.lock` or `bun.lockb`: the install is frozen to it |
| A domain | An `A` record to the server |
| *For SSR:* the framework's Node server | Next.js as is; Nuxt as is (Nitro's node preset); SvelteKit with `@sveltejs/adapter-node`; Astro with `@astrojs/node` in `standalone` mode |

## 1. Create the app

The `--framework` preset fills the mode, the build and the start command:

```bash
# Next.js, on Node 24
$ sudo cipi app create --user=shop --domain=shop.example.com \
    --repository=git@github.com:acme/shop.git --node=ssr --framework=next --node-version=24

# Nuxt (server), SvelteKit, Astro SSR, Remix: the same with --framework=nuxt|sveltekit|astro|remix

# A Vite SPA
$ sudo cipi app create --user=web --domain=app.example.com \
    --repository=git@github.com:acme/web.git --node=spa --framework=vite

# A static Astro or Nuxt-generate site
$ sudo cipi app create --user=docs --domain=docs.example.com \
    --repository=git@github.com:acme/docs.git --node=static --output=dist
```

| Preset | Build | Start |
| --- | --- | --- |
| `next` | `npm run build` | `npx next start -H 127.0.0.1` |
| `nuxt` | `npm run build` | `node .output/server/index.mjs` |
| `sveltekit` | `npm run build` | `node build` |
| `astro` | `npm run build` | `node ./dist/server/entry.mjs` |
| `remix` | `npm run build` | `npm run start` |
| `vite` | `npm run build` | — (Nginx serves `dist/`) |

Anything else is a flag away: `--build=`, `--start=`, `--output=`, `--health-path=` (the path that must answer below 500 before a release takes traffic, `/` by default), `--db=` for a database of the app's own. In the [web panel](https://cipi.sh/docs/gui-overview): **Apps → New app → Node**, with the same presets.

With a provider token saved ([Git providers](https://cipi.sh/docs/git)), the deploy key and the webhook are already on the repository. Otherwise add the deploy key — `sudo cipi deploy shop --key` — as a read-only key.

## 2. The environment

```bash
$ sudo cipi app env shop
```

`~/shared/.env` is read **at build time** — so `NEXT_PUBLIC_*`, `NUXT_PUBLIC_*` and `VITE_*` end up in the bundle — and **by the server at runtime**. Put your API's address, keys and feature flags there:

```bash
$ sudo cipi app env shop --set=NEXT_PUBLIC_API_URL=https://api.example.com
$ sudo cipi app env shop --set=SESSION_SECRET=…
```

`PORT` and `HOST` are Cipi's: each slot gets its own port on `127.0.0.1` (`NITRO_PORT` and `NITRO_HOST` for Nuxt), and a value in the `.env` can't move the server off localhost. A change to a runtime variable takes effect with a restart; one that ends up in the bundle needs a deploy.

## 3. Deploy

```bash
$ sudo cipi deploy shop
```

1. **Clone** — a new release
   The branch's commit, in a folder of its own.
2. **Install** — frozen to the lockfile
   `npm ci`, `pnpm install --frozen-lockfile`, `yarn install --immutable` or `bun install --frozen-lockfile`, with `NODE_ENV=production`.
3. **Build** — your build command
   With the `.env` in place. Up to 30 minutes, raised per app.
4. **Start** — on the idle slot
   SSR: the new release starts beside the one that is serving.
5. **Health** — below 500 within 60 seconds
   It must answer its health path. If it never does, it is stopped and visitors never see it.
6. **Switch** — Nginx, then drain
   Nginx moves to the new slot; the old one finishes its open requests and stops.

For a SPA or a static site the last three steps are one: the build folder must have an `index.html`, then `current` moves. A rollback is the same switch backwards:

```bash
$ sudo cipi deploy shop --rollback
```

Then HTTPS, once the domain points at the server:

```bash
$ sudo cipi ssl install shop
```

Hashed assets (`_next/static`, `_nuxt`, `_astro`, `assets`, `_app/immutable`) are served as immutable; HTML never is.

## 4. Push to deploy

A push to the app's branch deploys it. Nothing is added to the project: Cipi's own receiver checks the provider's signature.

| Server | The webhook |
| --- | --- |
| With [its own domain](https://cipi.sh/docs/server-domain) | `https://webhooks.example.com/shop` |
| Without | `https://shop.example.com/cipi/webhook`, once the app has HTTPS |

```bash
$ sudo cipi app webhook show shop          # the URL, the secret, whether a push deploys
$ sudo cipi app webhook auto shop off      # deploy from CI instead
```

Full details: [push-to-deploy](https://cipi.sh/guides/cipi-agent-webhook-deploy).

## 5. Logs, restarts, Node versions

```bash
$ sudo cipi node status shop               # mode, commands, which slot serves
$ sudo cipi node logs shop --lines=100     # the serving slot's output
$ sudo cipi app logs shop --type=node      # both slots, followed
$ sudo cipi node restart shop              # zero downtime: the idle slot first
$ sudo cipi app run shop npm ls --depth=0  # a command in the live release, as the app
```

| Node | Command |
| --- | --- |
| Install another major | `sudo cipi node install 24` |
| Move one app | `sudo cipi app edit shop --node-version=24`, then deploy |
| Latest patch, SSR restarted without downtime | `sudo cipi node upgrade 24 --restart` |
| What runs where | `sudo cipi node list` |

Builds come from the official Node releases, checked against their published checksums. The settings can also live in the repository, in the `node:` section of [cipi.yml](https://cipi.sh/docs/yml#cli-yml-node).

## 6. A preview of any branch

With [the server's own domain](https://cipi.sh/docs/server-domain) set:

```bash
$ sudo cipi preview create shop feature/checkout-v2
```

The branch is built and served on `https://shop-feature-checkout-v2-k3m9q.example.com`, with its own `.env` (copied from the app's), its own slots and its own certificate. Every push to the branch deploys it; deleting the branch removes it. [Preview branches](https://cipi.sh/guides/preview-branches) has the rest — including the panel and opening one per pull request from CI.

## 7. Next to a Laravel API

The usual pair — a Laravel API and a Next.js or Nuxt front end — is two apps on the same server: `api.example.com` and `example.com`, or one domain with the API behind a [proxy route](https://cipi.sh/docs/redirects-proxies). Server-side calls from the Node app to the API stay on the machine. Step by step: [Laravel API + Next.js or Nuxt on one server](https://cipi.sh/guides/laravel-api-nextjs-nuxt).

## Troubleshooting

| Problem | Fix |
| --- | --- |
| *no index.html* after the build | `--output` points at the wrong folder: `sudo cipi app edit web --output=build` |
| An SSR release never goes live | It must answer the health path within 60 seconds: check `--start` (`sudo cipi node status shop`) and `sudo cipi node logs shop`. A server that listens on a fixed port, not `PORT`, never answers |
| Astro or SvelteKit starts but answers nothing | The Node adapter is missing: `@astrojs/node` in standalone mode, `@sveltejs/adapter-node` |
| `NEXT_PUBLIC_…` is empty in the browser | It was set after the build: deploy again |
| The build is killed, or slow on some days | Memory: add swap or RAM, or give the build more time — `sudo cipi app deploy-config shop --build-timeout=2700` ([slow builds](https://cipi.sh/guides/deploy-timeouts-slow-builds)) |
| The install fails on the lockfile | The lockfile and `package.json` disagree: run the install locally, commit the lockfile |
| A push doesn't deploy | `sudo cipi app webhook show shop` says what the provider must call and what is missing |

The reference page, with every option: [Node apps](https://cipi.sh/docs/node-apps).

## Reference docs

- [Node apps](https://cipi.sh/docs/node-apps)
- [Node.js](https://cipi.sh/docs/nodejs)
- [Environment variables](https://cipi.sh/docs/environment)
- [Auto-deploy on push](https://cipi.sh/docs/auto-deploy)
- [Preview environments](https://cipi.sh/docs/preview-environments)

## Questions

### Is this a Vercel or Netlify alternative?

For apps that run on one Node server, yes: build on push, HTTPS, previews of any branch, rollback — on a VPS with a fixed price, next to your PHP apps. What it doesn't have is an edge network: put Cloudflare in front for that.

### Which frameworks?

Vite SPAs (React, Vue, Svelte), static builds (Astro, Nuxt generate, Next export, Eleventy), and Node servers: Next.js, Nuxt, SvelteKit (adapter-node), Astro (the Node adapter, standalone) and Remix. Anything with a build command and a start command works with `--build` and `--start`.

### Is it really zero downtime for a Node server?

Yes. Each app has two slots. A deploy starts the new release on the idle one, waits until it answers its health path, switches Nginx, then lets the old one finish its requests. A release that never answers never gets traffic.

### Which package manager?

npm, pnpm, Yarn or Bun — whichever lockfile the repository has; the install is frozen to it.

### Where do environment variables go?

In `~/shared/.env`, edited with `sudo cipi app env shop`. It is read at build time (for `NEXT_PUBLIC_*`, `VITE_*`) and by the server at runtime. `PORT` and `HOST` are set by Cipi.

### Does it need a database?

No. Add one with `--db` when the server reads it directly (Prisma, Drizzle); a front end that calls a Laravel API needs none.

### Can it share a domain with a Laravel API?

Yes: one app per domain and a proxy, or two domains. [Laravel API + Next.js or Nuxt](https://cipi.sh/guides/laravel-api-nextjs-nuxt) walks through both.

---

Index of every page: https://cipi.sh/llms.txt · Everything in one file: https://cipi.sh/llms-full.txt · Source: https://github.com/cipi-sh/cipi (MIT)
