Skip to content

Local development ​

bash
git clone https://github.com/doodersrage/probeharbor.git
cd probeharbor
pnpm install
cp .env.example .env   # fill DATABASE_URL, BETTER_AUTH_SECRET, SITE_URL, etc.
pnpm dev               # http://localhost:4321

You typically need a database of your own (never production), BETTER_AUTH_SECRET, and SITE_URL / ORIGIN (e.g. http://localhost:4321). Turnstile keys are required for register/sign-in.

The database driver is chosen at runtime (src/lib/db/client.ts):

  • Any Postgres (Layerbase, local, …): DATABASE_DRIVER=hyperdrive and CLOUDFLARE_HYPERDRIVE_LOCAL_CONNECTION_STRING_HYPERDRIVE=postgresql://… (the local stand-in for the Worker's Hyperdrive binding). This is how production runs since 2026-11-15.
  • Directly: leave DATABASE_DRIVER unset and set DATABASE_URL to any Postgres; the app connects with pg (no Hyperdrive).

Useful scripts:

bash
pnpm test
pnpm typecheck         # full-repo tsc --noEmit
pnpm build
pnpm test:e2e          # Playwright (needs build / local server per config)
pnpm audit:stripe      # compare STRIPE_DISPLAY_* to live Stripe prices
pnpm docs:dev          # this docs site locally (base /probeharbor/)
pnpm docs:build

Authenticated E2E: set E2E_TEST_EMAIL and E2E_TEST_PASSWORD, plus E2E_DATABASE_URL and E2E_BETTER_AUTH_SECRET. The last two must match the preview's DATABASE_URL / BETTER_AUTH_SECRET (in dist/server/.dev.vars): the helper signs in through Better Auth with them and hands the session cookie to the browser. Use a test database, not production. CI does the same with the E2E_DATABASE_URL / E2E_BETTER_AUTH_SECRET GitHub secrets.

bash
pnpm test:e2e:auth

pnpm setup:e2e-github-secrets copies the four E2E_* values to GitHub for CI. pnpm e2e:reset-password sets a new e2e password in DATABASE_URL and E2E_DATABASE_URL and writes it to .env; sync GitHub afterwards.

Environment variables ​

Configure in .env (local) and Cloudflare Worker secrets / vars (production). Full list: .env.example. Do not commit .env.

VariablePurpose
DATABASE_DRIVERhyperdrive = Postgres through the HYPERDRIVE binding (production); unset = straight to DATABASE_URL
DATABASE_URLPostgres (Layerbase in production) when not using Hyperdrive; also what local scripts (ops:*) connect to — server only
DATABASE_URL_UNPOOLEDDirect connection for db:migrate / db:backup / db-copy (local only)
BETTER_AUTH_SECRETSigns sessions (Better Auth)
GOOGLE_* / DISCORD_* / GITHUB_*OAuth sign-in apps
GARAGE_TEMP_FEED_URLDefault public probe JSON feed (guest Home demo)
OPENWEATHER_API_KEY / OPENWEATHER_CITY_IDOutdoor weather (server-only; map tiles via /api/weather/tiles)
TURNSTILE_SITE_KEY / TURNSTILE_SECRET_TOKENBot protection on contact and auth forms
SMTP_MAIL_FROM / SMTP_MAIL_TOFrom address + ops/contact To
STRIPE_SECRET_KEY / STRIPE_WEBHOOK_SECRETBilling + webhooks
STRIPE_PRICE_ID / STRIPE_PRICE_ID_PRO / STRIPE_PRICE_ID_PORTFOLIOMonthly Member / Pro / Portfolio price IDs
STRIPE_PRICE_ID_ANNUAL / STRIPE_PRICE_ID_PRO_ANNUAL / STRIPE_PRICE_ID_PORTFOLIO_ANNUALAnnual Member / Pro / Portfolio price IDs
STRIPE_DISPLAY_MEMBER_* / STRIPE_DISPLAY_PRO_* / STRIPE_DISPLAY_PORTFOLIO_*Display-only USD amounts on /pricing (must match Stripe)
PRICING_DEFAULT_INTERVALmonthly (default) or annual: interval /pricing opens on
TWILIO_*Pro SMS
VAPID_*Pro browser Web Push — pnpm generate:vapid
FCM_*Pro Android FCM (HTTP v1 service account)
SITE_URL / ORIGINOAuth, password reset, Stripe redirects
CRON_SECRETBearer for manual history cron (/api/cron/collect-history)
INGEST_KEY_ENCRYPTION_SECRETEncrypt recoverable push ingest keys for Reveal ingest key
AMBIENT_APPLICATION_KEYOperator key for Ambient Weather personal stations
OPS_DISCORD_WEBHOOK_URLOptional Discord when jobs / pages fail

Database ​

Migrations live in db/migrations/ (NNNN_name.sql, applied in order and recorded in public.schema_migrations):

bash
pnpm db:pending        # list what isn't applied yet (exit 1 if any); read-only
pnpm db:migrate        # apply them (DATABASE_URL_UNPOOLED)

Access is enforced in the server-side queries, each scoped in SQL to the signed-in user or household. Database tests (pnpm test:db) run the real queries against a local Postgres.

Deploy (production) ​

See Deploy & ops. Short path:

bash
pnpm ops:check
pnpm test && pnpm typecheck && pnpm build
pnpm db:pending   # then pnpm db:migrate if anything is listed
pnpm secrets:push
pnpm deploy

Worker name on Cloudflare may still be garage-temp; the product brand is ProbeHarbor. Set SITE_URL / ORIGIN to https://probeharbor.dev.

Docs site only ​

bash
pnpm --dir docs --ignore-workspace install
pnpm docs:dev

Pages deploy runs from .github/workflows/docs.yml on pushes that touch docs/, sketches/, or public/openapi.yaml.

App & product guides: probeharbor.dev · This site: developer reference