# Netlify (/docs/starter/deploy/netlify)

`apps/web/netlify.toml` deploys the app to [Netlify](https://www.netlify.com). Netlify only runs the app: the database, Redis, file storage, and email come from your providers (for example Neon or Supabase, Upstash, and Cloudflare R2).

A project with a [frontend and its API](../../cli/frontend-and-api.mdx) can't use this option yet: it deploys on [any container host](./container-host.mdx#a-frontend-and-its-api) or [Railway](./railway.mdx#a-frontend-and-its-api). Nor can a project [without a website](../../cli/without-a-website.mdx), whose API deploys on [any container host](./container-host.mdx#without-a-website) or [Railway](./railway.mdx#without-a-website): the CLI refuses this option for it.

<Callout>
  [`pnpm clubedge deploy`](../../cli/deploy/netlify.mdx) does these steps for you: the site, its base directory, the variables, and the deploy.
</Callout>

## What netlify.toml sets [#what-netlifytoml-sets]

The build command: `pnpm run check:env && pnpm --dir ../.. db:migrate && pnpm run build`.

- **`check:env`** (Starter v0.18.0 or newer) stops the build when a variable the project's modules need is unset, points at `localhost`, or isn't an absolute URL, and lists each one. `SKIP_ENV_CHECK=1` builds anyway.
- **Migrations:** Netlify has no step that runs before a release, so the build applies them against the `DATABASE_URL` of the deploy context. Give deploy previews their own database, or remove the migration step and run migrations yourself.
- **The build:** with Next.js, Netlify installs its Next.js runtime automatically and publishes `.next`; with TanStack Start, the build detects Netlify and writes its functions and static assets to `dist`.

## Deploy by hand [#deploy-by-hand]

Import the repository in Netlify, set the site's Base directory to `apps/web`, and add the [production variables](./index.mdx#production-variables) for every deploy context you build (production and deploy previews). Set `NEXT_PUBLIC_APP_URL` to the site's URL before the first build, since Next.js compiles it in.

Also set `CLIENT_IP_HEADER=x-nf-client-connection-ip` in the site's settings, where Netlify puts each [client's address](../before-deploying.mdx#client-addresses) (Starter v0.27.0 or newer). Netlify takes runtime variables only from the site's settings, not from `netlify.toml`.

Serverless functions open a connection per instance: use your provider's pooled connection URL (Supabase's transaction pooler or Neon's pooled endpoint).

## Background jobs [#background-jobs]

Netlify runs no worker for [background jobs](../modules/jobs.mdx). Set `JOBS_WORKER=off` and `CRON_SECRET`, then call `/api/jobs/run` every minute from a [scheduled function](https://docs.netlify.com/build/functions/scheduled-functions/) or another scheduler, with the header `Authorization: Bearer <CRON_SECRET>`.

## The deploy workflow [#the-deploy-workflow]

The Deploy job installs the workspace and runs `netlify deploy --build --prod` from `apps/web`: it builds with `netlify.toml` (including its migrations) and the site's variables, then deploys. It needs the secrets `NETLIFY_AUTH_TOKEN`, a personal access token, and `NETLIFY_SITE_ID`, from the site's settings.
