Deploy a Nuxt 4 SaaS with Docker or Node.js
This starter kit is vendor-free and can be deployed to any platform that supports Node.js and PostgreSQL.
Build
Run the build from the repository root:
pnpm build
The output is a standalone Nuxt server in apps/web/.output. Start it with node apps/web/.output/server/index.mjs.
/pricing loads the Polar products and /testimonials reads the database. Production builds therefore need the secrets as well. Without them, those pages prerender empty.If the build runs out of memory, see 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:
- Use the Dockerfile build pack with
/Dockerfile, targetruntimeand port9009 - Enable build secrets and let the Dockerfile manage build arguments
- 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 or a VPS (DigitalOcean, Hetzner, Linode, …):
- Install Node.js 26 and pnpm 12
- Clone your repository
- Install dependencies with
pnpm install - Set the environment variables
- Build the application with
pnpm build - Run migrations with
pnpm db:migrate - 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-authNUXT_PRIVATE_DATABASE_URL- PostgreSQL connection stringNUXT_PUBLIC_BASE_URL- Your production URLNUXT_PRIVATE_POLAR_ACCESS_TOKEN- Polar access tokenNUXT_PRIVATE_EMAIL_CONTACT- Address that receives contact form submissionsNUXT_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:
Post-Deploy
After deployment, run the database migrations:
pnpm db:migrate
Most platforms support running commands after deployment or you can run this manually.
Upgrade to the Layer Architecture
Move a project from the Turborepo version of Nuxt Starter Kit to the layer architecture: new .env location, Zod-validated config and moved folders.
Going to production
Checklist before launch: rename and rebrand the app, replace the intruder redirects, adapt the email templates, switch Polar to production and check SEO.