Deploy with one command
The first deploy of a project to Railway, Fly.io, Vercel, Netlify, or Render with one command, and every release after it, or Docker Compose on a server of your own.
pnpm clubedge deploy deploys a project to the platform it was created for, with the platform's own CLI or API and your login. Sign in when it asks, and it does the rest: the project or service, the databases where the platform hosts them, the production variables, the public URL, and the release. With docker, it prepares Docker Compose for a server of your own instead.
pnpm clubedge deploy # asks before creating anything; reads .env.production
pnpm clubedge deploy --dry-run # the plan, nothing createdIt creates resources in your account on the platform, which bills their usage on your plan. It asks first; --yes agrees.
Platforms
Each platform has its own page: what deploy creates there, how it signs in, and what to do when a deploy fails.
| Platform | Deploy option | Since | What runs where |
|---|---|---|---|
| Railway | railway | CLI 0.22.0 | The app, Postgres, and Redis on Railway, or your own databases |
| Fly.io (experimental) | fly | CLI 0.25.0 | The app, Postgres, and Upstash Redis on Fly.io, or your own databases |
| Vercel (experimental) | vercel | CLI 0.28.0 | The app on Vercel; the databases and services from your providers |
| Netlify (experimental) | netlify | CLI 0.29.0 | The app on Netlify; the databases and services from your providers |
| Render (experimental) | render | CLI 0.29.0 | The app on Render, built from your Git repository; the database from your provider |
| Docker Compose | docker | CLI 0.42.0 | The app behind Caddy on a server of your own, its images on GitHub's container registry |
The platform comes from the project's deploy module. Switch it with pnpm clubedge add deploy <option>. With docker, deploy writes the Compose files for a server of your own; for another container host, follow the deploy guide.
A frontend and its API deploy with docker or railway (CLI 0.35.0 or newer): deploy sets up both services, with the frontend public and the API private. With docker, it writes a compose.yaml that runs both behind Caddy, the API on the Compose network (Docker Compose); on Railway, see A frontend and its API.
A project without a website deploys its API alone, as the one public service, with docker or railway (CLI 0.44.0 or newer): behind Caddy with Docker Compose, or on Railway with its own *.up.railway.app domain. Fly.io, Vercel, Netlify, and Render deploy a web app, so deploy refuses them there.
A mobile app or a native app runs no server, so deploy leaves it out. The steps below describe one app on a hosted platform.
Experimental platforms work end to end but are newer: their steps or messages may still change between releases. Run --dry-run first, and report anything that goes wrong.
What every platform does
- Signs in. The platform's login opens in the browser when you are signed out (Render asks for an API key instead). With a token in the environment, nothing opens.
- Creates or reuses what the app runs on, named after the package: a Railway service, a Fly app, a Vercel project, a Netlify site, or a Render web service. A second run finds it again.
- Sets the production variables: your provider keys, the public URL as
APP_URLandNEXT_PUBLIC_APP_URL, with Better Auth a generatedBETTER_AUTH_SECRETthat later runs keep, and where the app finds a client's address. - Deploys and waits. The migrations run before the release, and
deployprints the URL once the platform reports the release live.
Running it again reuses everything, so it also ships a new release and adds variables.
Provider keys
The platform can't guess your storage, email, or payment keys. Put the production values in .env.production at the project's root (Git ignores it), and deploy reads it (CLI 0.26.0 or newer; older releases need --env-file). For another file, pass it:
pnpm clubedge deploy # reads .env.production when there is one
pnpm clubedge deploy --env-file .env.staging # or another fileVariables that .env.example lists and nothing sets are reported as Not set, for the modules that need them, before the build starts.
Your own databases
CLI 0.26.0 or newer. On Railway and Fly.io, without DATABASE_URL and REDIS_URL in the env file, the platform hosts everything. With them, deploy creates neither and the platform only runs the app: for example Postgres on Supabase or Neon, Redis on Upstash, and files on Cloudflare R2.
On Vercel, Netlify, and Render, DATABASE_URL always comes from the env file: those platforms only run the app. Use your provider's pooled connection URL on Vercel and Netlify, where each serverless function opens its own connection (Supabase's transaction pooler or Neon's pooled endpoint).
DATABASE_URL=postgresql://postgres.abc:password@aws-0-eu-west-1.pooler.supabase.com:6543/postgres
REDIS_URL=rediss://default:password@eu1-example.upstash.io:6379
STORAGE_ENDPOINT=https://<account-id>.r2.cloudflarestorage.com
# ...the other keys your modules useWith a DATABASE_URL in the env file, deploy also sends DATABASE_URL_DIRECT (CLI 0.30.0 or newer), the direct connection that migrations and the jobs worker use: the file's value, or for a pooled Neon URL the same URL without -pooler. It never sends one next to the platform's own database. Before deploying the free Neon database the CLI created, it warns that Neon deletes it unless you claim it.
Each one decides for itself: only DATABASE_URL keeps Redis on the platform. URLs to localhost (from a development env file) are ignored with a warning. A later deploy without the env file keeps the URL the service already has. When you move from the platform's database to your own, the old one stays in the project, unused: delete it in the dashboard once you no longer need its data.
Client addresses
Rate limits and logs count each visitor by address, which the platform's proxies hide. From CLI 0.42.0, deploy tells the public service where to find it, for projects from Starter v0.27.0 on:
| Platform | Setting |
|---|---|
| Railway, Vercel | CLIENT_IP_HEADER=x-real-ip |
| Render | CLIENT_IP_HEADER=cf-connecting-ip |
| Fly.io | CLIENT_IP_HEADER=fly-client-ip |
| Netlify | CLIENT_IP_HEADER=x-nf-client-connection-ip |
| Docker Compose | TRUSTED_PROXY_HOPS=1: Caddy is the one proxy of your own that sets X-Forwarded-For |
CLIENT_IP_HEADER names the header the platform's edge sets to the client's address, replacing any copy the client sent. A frontend's API, reached only through the frontend's server, which sends on the one address it found, gets TRUSTED_PROXY_HOPS=1 and never CLIENT_IP_HEADER. An API without a website is the public service itself, so it gets its platform's setting. Previews get the same as production, and try sets x-real-ip on its Railway VM.
Either setting in the env file replaces both defaults, for another proxy in front. Neither is ever reported as unset, and projects from Starters before v0.27.0 ignore them. See Client addresses for how the app reads them.
Previews
On Vercel and Railway, pnpm clubedge deploy --preview deploys the current Git branch next to production, with its own branch of the Neon database. It deploys a web app only, not a frontend and its API, nor a project without a website. See Preview deployments.
Deploying by hand
deploy is a shortcut, not a requirement. Each platform's page in the deploy guide covers the same setup by hand, the files the project ships for it, and the deploy workflow for GitHub Actions.
How is this guide?