New:New releases:CLIcreate-clubedge-app v0.49.1·Clubedge Starter v0.32.0

Clubedge Starter Docs

A database on Neon

A hosted PostgreSQL database with nothing to install and no account, kept by claiming it into a free Neon account.

--infra neon gives the project a Neon PostgreSQL database instead of local services. It needs CLI 0.30.0 or newer.

pnpm dlx @clubedge/create-clubedge-app my-app --infra neon
cd my-app
pnpm db:migrate
pnpm dev

The CLI creates a free database through Neon's claimable Postgres: no account, no Docker, nothing to install. It writes two URLs into apps/web/.env.local, or apps/api/.env.local for a frontend and its API, since the API owns the database:

  • DATABASE_URL: the pooled connection, whose host ends in -pooler. The app uses it.
  • DATABASE_URL_DIRECT: the direct connection, the same host without -pooler. Migrations and the background jobs worker use it, since a transaction pooler can break them. See pooled and direct connections.

Neon keeps an unclaimed database for 72 hours, with up to 100 MB. Claim it to keep it.

Keep it, or start over

pnpm clubedge neon           # where it stands and how many hours it has left
pnpm clubedge neon claim     # open Neon's page that moves it into your Neon account
pnpm clubedge neon create    # a new, empty database, for example after one expired
  • neon claim opens a link that works for 15 minutes (--no-open prints it instead). Sign in to Neon (free) and accept: the database moves to your account with its data. Keep the link private, since whoever opens it gets the database.
  • After claiming, Neon resets the database password. Open the project in the Neon console, choose Connect, and copy the pooled connection string into DATABASE_URL and the direct one (pooling off) into DATABASE_URL_DIRECT.
  • neon create replaces the two URLs. It asks first when DATABASE_URL points at a database that is still alive; --yes agrees, and --dry-run shows what it would do without creating anything.

The CLI keeps what it needs to claim each database in neon.json in its config directory (~/.config/clubedge, or %APPDATA%\clubedge on Windows; $XDG_CONFIG_HOME/clubedge when XDG_CONFIG_HOME is set). Treat that file as a secret.

Your own Neon project

To use a Neon project you already have, paste its pooled and direct connection strings into the two variables. --no-neon creates the project without a database:

pnpm dlx @clubedge/create-clubedge-app my-app --infra neon --no-neon

Switch an existing project

pnpm clubedge add infra neon

It creates a database when DATABASE_URL still held the old local services' example value. A URL you set yourself stays, and pnpm clubedge neon create replaces it when you want. --no-neon switches the project without creating a database.

Checks and deploys

  • doctor checks the two URLs: the pooled one for the app, the direct one without -pooler, both for the same database. It warns when a free database has less than a day left. See Check a project.
  • deploy sends DATABASE_URL_DIRECT along with a DATABASE_URL from .env.production, and derives it from a pooled Neon URL when the file has none. It warns before deploying a database that is still unclaimed. See Deploy with one command.
  • try --infra neon runs on a Railway VM against a free Neon database. See Try on a Railway VM.
  • Pull requests can each get their own branch of the database. See Preview environments.

How is this guide?