---
title: "Deploy a Nuxt 4 SaaS with Docker or Node.js"
description: "Build the standalone Nuxt server and deploy it anywhere with Node.js and PostgreSQL, or use the included Dockerfile and its GitHub Actions smoke test."
canonical_url: "https://nuxtstarterkit.com/docs/getting-started/deployment"
---

> Index of every page on this site: [llms.txt](https://nuxtstarterkit.com/llms.txt)

This starter kit is **vendor-free** and can be deployed to any platform that supports Node.js and PostgreSQL.

<warning>

Follow the [Going to production](https://nuxtstarterkit.com/docs/getting-started/going-to-production) guide before deploying your application to production.

</warning>

## Build

Run the build from the repository root:

```bash
pnpm build
```

The output is a standalone Nuxt server in `apps/web/.output`. Start it with `node apps/web/.output/server/index.mjs`.

<note>

Some pages are prerendered at build time and read private config while doing so: `/pricing` loads the Polar products and `/testimonials` reads the database. Production builds therefore need the secrets as well. Without them, those pages prerender empty.

</note>

If the build runs out of memory, see [Troubleshooting](https://nuxtstarterkit.com/docs/support/troubleshooting).

## Docker

The repository ships a `Dockerfile` with a `runtime` target. It builds with Node 26 and pnpm 12 and runs the standalone server as the non-root `node` user on port `9009`. `/app/.data` is writable for content and image caches.

The build reads its secrets as BuildKit secret mounts, not as `ARG` or `ENV`. When you add a new value that the build needs, add a matching secret mount to the `Dockerfile`.

A GitHub Actions workflow (`docker-image.yml`) builds the image and smoke-tests it with the dummy values from `apps/web/.env.test`.

### Coolify

I deploy the demo with [Coolify](https://coolify.io/):

1. Use the Dockerfile build pack with `/Dockerfile`, target `runtime` and port `9009`
2. Enable build secrets and let the Dockerfile manage build arguments
3. Add the environment variables both as runtime variables and as build secrets

`deployment/docker.md` in the repository has the details.

## Other Platforms

The starter kit works with any Node.js hosting platform, for example [Railway](https://railway.com/) or a VPS (DigitalOcean, Hetzner, Linode, …):

1. Install Node.js 26 and pnpm 12
2. Clone your repository
3. Install dependencies with `pnpm install`
4. Set the environment variables
5. Build the application with `pnpm build`
6. Run migrations with `pnpm db:migrate`
7. Start the server with `node apps/web/.output/server/index.mjs`

## Environment Variables

Ensure all required environment variables are set in your deployment platform. The server refuses to start when one is missing (error `NUXT_E8014`):

- `NUXT_BETTER_AUTH_SECRET` - Secret for better-auth
- `NUXT_PRIVATE_DATABASE_URL` - PostgreSQL connection string
- `NUXT_PUBLIC_BASE_URL` - Your production URL
- `NUXT_PRIVATE_POLAR_ACCESS_TOKEN` - Polar access token
- `NUXT_PRIVATE_EMAIL_CONTACT` - Address that receives contact form submissions
- `NUXT_PRIVATE_FROM_EMAIL` - Sender address of all emails

Also set `NUXT_PRIVATE_POLAR_SERVER=production` (the default is `sandbox`) and the values of the features you use: email provider, storage, OAuth credentials and analytics. `apps/web/.env.example` lists all of them.

## Database

Make sure your PostgreSQL database is accessible from your deployment platform. Most platforms offer:

- Managed PostgreSQL add-ons (recommended)
- Or connect to external PostgreSQL services like:

  - [Neon](https://neon.tech/)
  - [Supabase](https://supabase.com/)
  - [Railway](https://railway.app/)
  - [Render](https://render.com/)

## Post-Deploy

After deployment, run the database migrations:

```bash
pnpm db:migrate
```

Most platforms support running commands after deployment or you can run this manually.

## Sitemap

See the full [sitemap](https://nuxtstarterkit.com/sitemap.md) for all pages.
