# Deployment

> Deploy your SaaS application to any hosting platform.

*Canonical: https://makerkit.dev/docs/nextjs-prisma/going-to-production/deployment*

---

Deploying this app means provisioning infra, setting env vars, deploying code, running Prisma migrations, and wiring any billing webhooks you actually use.

This guide covers the general process. For platform-specific steps, see [Railway](./railway) or [Docker](./docker).

## Infrastructure

You need:

- hosting for `apps/web`
- a PostgreSQL database
- object storage if you use uploads
- an email provider

## Build Settings

- Root directory: `apps/web`
- Build command: `pnpm build`
- Output directory: `.next`
- Install command: `pnpm install`

## Database Migrations

Run production migrations with:

```bash
read -s DATABASE_URL && export DATABASE_URL && npx prisma migrate deploy --schema packages/database/src/prisma/schema.prisma
```

## Webhooks

Verify the route used by your active billing provider before configuring production webhooks.

For Stripe in this repo, the local listener forwards to:

```text
/api/auth/stripe/webhook
```

## Common Pitfalls

- forgetting production migrations
- wrong webhook path
- missing env vars
- wrong monorepo root directory in the hosting platform

---
