← Canvas

Help

dark_mode

Cloud deploy

Host Bitfield on Vercel (or any Next.js host) with Postgres 16 and object storage for images.

This page is the generic path. The git file docs/DEPLOY_VERCEL.md is the smoke board for this Cogitum instance (hostnames, DNS, invite migration).

Pieces

| Piece | Typical choice | |-------|----------------| | App | Vercel, Next.js App Router | | Database | Neon pooled DATABASE_URL (any Postgres 16 works) | | Uploads | Vercel Blob when BLOB_READ_WRITE_TOKEN is set | | Auth URL | BETTER_AUTH_URL=https://<your-host> (no trailing slash) |

Omit the Blob token and the app writes to ./data/uploads instead — that is the self-host adapter, not a second product.

Database

  1. Create a Postgres 16 database. Copy the pooled URL into DATABASE_URL.
  2. From your machine, migrate and bootstrap (use a direct URL for migrate if the pooler breaks DDL):
DATABASE_URL='postgresql://…?sslmode=require' pnpm db:migrate
DATABASE_URL='…' \
  BETTER_AUTH_SECRET='…long-random…' \
  BETTER_AUTH_URL='https://your-host' \
  BOOTSTRAP_ADMIN_EMAIL='you@example.com' \
  BOOTSTRAP_ADMIN_PASSWORD='…at-least-8-chars…' \
  pnpm db:bootstrap

Invites need migration 0006. Git pushes to Vercel do not run Drizzle — apply migrations yourself.

Environment (production)

| Name | Notes | |------|--------| | DATABASE_URL | Pooled Postgres URL | | BETTER_AUTH_SECRET | ≥32 random characters | | BETTER_AUTH_URL | Public origin | | BLOB_READ_WRITE_TOKEN | From the Blob store, if you want cloud uploads | | GOOGLE_CLIENT_ID / SECRET | Recommended | | GITHUB_CLIENT_ID / SECRET | Optional | | AUTH_DISABLE_SIGNUP | true after the first real user — then invite friends |

OAuth callbacks must be {BETTER_AUTH_URL}/api/auth/callback/google (and /github).

Login chrome is prerendered. Flip AUTH_DISABLE_SIGNUP and redeploy so /login hides “Create one”.

Smoke

  1. Signed-out / shows the splash. Sign in works.
  2. Place a sticky, reload — it is still there.
  3. Upload an image, refresh — it loads.
  4. A second user cannot fetch the first user’s /api/uploads/[key].
  5. Invite a friend from Settings → User Management (see Accounts).

Vercel Web Analytics is mounted in the app. Enable Web Analytics on the Vercel project if you want the dashboard; local Compose is a no-op.