NetlifyExperimental
Deploy to Netlify with one command; the database and other services come from your providers.
In a project with deploy netlify (CLI 0.29.0 or newer), pnpm clubedge deploy uses Netlify's CLI and your Netlify login:
pnpm clubedge add deploy netlify # if the project deploys elsewhere today
pnpm clubedge deployNetlify only runs the app, so the database, Redis, storage, and email come from your providers. Put their production values in .env.production first: deploy stops without DATABASE_URL. Use your provider's pooled URL (Neon's pooled endpoint, Supabase's transaction pooler), since each serverless function opens its own connection.
What it does
- Signs in with
netlify login, which opens the browser when you are signed out and returns at once when you are signed in. WithNETLIFY_AUTH_TOKENset, it skips this. - Creates or reuses the site. It reuses the site the project is linked to (
.netlify/state.json), or<name>.netlify.appwhen it is yours. Otherwise it creates the site in your team, named after the package, with a short suffix when the name is taken, since Netlify's names are global. The base directory isapps/web, wherenetlify.tomlis; on an existing site,deploysets it when it differs. - Sets the production variables with
netlify env:import, from a private temporary file it deletes afterwards, so no value appears on a command line: the env file's values, the site URL asAPP_URLandNEXT_PUBLIC_APP_URL,CLIENT_IP_HEADER=x-nf-client-connection-ip, where the client's address is (CLI 0.42.0 or newer), and with Better Auth a generatedBETTER_AUTH_SECRETthat later runs keep.STORAGE_DIRECTORYis left out, since Netlify keeps no disk. - Runs
netlify deploy --build --prod. The build runs on your machine with the site's variables:check:env, the migrations againstDATABASE_URL, then the app's build with Netlify's runtime. The result is uploaded and published.
The site's URL is known before the build, so one deploy is enough.
Netlify's CLI
deploy uses an installed netlify, else the latest netlify-cli through npx. It is a large package, so installing it once makes deploy much faster:
npm install -g netlify-cliCosts
Netlify bills usage on your plan. Your database and other services bill on their own plans.
When a deploy fails
The build log above the error says why. Most often check:env names a missing variable: add it to .env.production and run deploy again, which reuses the site. Since the build runs on your machine, pnpm install must have run and the build must pass locally. netlify open opens the site's dashboard, with its deploys and function logs.
To set up Netlify without this command, see Netlify in the deploy guide.
How is this guide?