# Deployment

> Learn how to deploy your Nuxt Starter Kit application.

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](/docs/getting-started/going-to-production) guide before deploying your application to production.

</warning>

## Deployment Platforms

The starter kit works with any Node.js hosting platform:

### Vercel

1. Connect your repository to Vercel
2. Set up environment variables in the Vercel dashboard
3. Vercel will automatically detect it's a Nuxt app and deploy

### Netlify

1. Connect your repository to Netlify
2. Set build command: `pnpm build`
3. Set publish directory: `apps/web/.output/public`
4. Configure environment variables in Netlify

### Railway

1. Create a new project in Railway
2. Connect your GitHub repository
3. Add a PostgreSQL database
4. Set environment variables
5. Railway will auto-deploy on git push

### Any VPS (DigitalOcean, Linode, etc.)

1. Set up a server with Node.js installed
2. Clone your repository
3. Install dependencies with `pnpm install`
4. Build the application with `pnpm build`
5. Run migrations with `pnpm db:migrate`
6. Start the server with the generated output

## Environment Variables

Ensure all required environment variables are set in your deployment platform:

- `NUXT_PRIVATE_DATABASE_URL` - PostgreSQL connection string
- `BETTER_AUTH_SECRET` - Secret for session encryption
- `BETTER_AUTH_URL` - Your production URL
- `NUXT_PRIVATE_POLAR_ACCESS_TOKEN` - For payments (if using Polar)
- `NUXT_PRIVATE_POLAR_ORGANIZATION_ID` - Your Polar org ID
- OAuth credentials (if using social login)

## 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/)

## Build Command

The build command for the monorepo is:

```bash
pnpm build
```

This uses Turborepo to build all packages in the correct order.

## 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.
