Local development
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:4321You typically need DATABASE_URL (a Neon branch 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.
Useful scripts:
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:buildAuthenticated 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 the Neon dev branch, not production. CI does the same with the E2E_DATABASE_URL / E2E_BETTER_AUTH_SECRET GitHub secrets.
pnpm test:e2e:authpnpm 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.
| Variable | Purpose |
|---|---|
DATABASE_URL | Neon Postgres (pooled) — server only |
DATABASE_URL_UNPOOLED | Direct connection for db:migrate / db:backup (local only) |
BETTER_AUTH_SECRET | Signs sessions (Better Auth) |
GOOGLE_* / DISCORD_* / GITHUB_* | OAuth sign-in apps |
GARAGE_TEMP_FEED_URL | Default public probe JSON feed (guest Home demo) |
OPENWEATHER_API_KEY / OPENWEATHER_CITY_ID | Outdoor weather (server-only; map tiles via /api/weather/tiles) |
TURNSTILE_SITE_KEY / TURNSTILE_SECRET_TOKEN | Bot protection on contact and auth forms |
SMTP_MAIL_FROM / SMTP_MAIL_TO | From address + ops/contact To |
STRIPE_SECRET_KEY / STRIPE_WEBHOOK_SECRET | Billing + webhooks |
STRIPE_PRICE_ID / STRIPE_PRICE_ID_PRO / STRIPE_PRICE_ID_PORTFOLIO | Monthly Member / Pro / Portfolio price IDs |
STRIPE_PRICE_ID_ANNUAL / STRIPE_PRICE_ID_PRO_ANNUAL / STRIPE_PRICE_ID_PORTFOLIO_ANNUAL | Annual 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_INTERVAL | monthly (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 / ORIGIN | OAuth, password reset, Stripe redirects |
CRON_SECRET | Bearer for manual history cron (/api/cron/collect-history) |
INGEST_KEY_ENCRYPTION_SECRET | Encrypt recoverable push ingest keys for Reveal ingest key |
AMBIENT_APPLICATION_KEY | Operator key for Ambient Weather personal stations |
OPS_DISCORD_WEBHOOK_URL | Optional Discord when jobs / pages fail |
Database
Migrations live in db/migrations/ (NNNN_name.sql, applied in order and recorded in public.schema_migrations):
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:
pnpm ops:check
pnpm test && pnpm typecheck && pnpm build
pnpm db:pending # then pnpm db:migrate if anything is listed
pnpm secrets:push
pnpm deployWorker name on Cloudflare may still be garage-temp; the product brand is ProbeHarbor. Set SITE_URL / ORIGIN to https://probeharbor.dev.
Docs site only
pnpm --dir docs --ignore-workspace install
pnpm docs:devPages deploy runs from .github/workflows/docs.yml on pushes that touch docs/, sketches/, or public/openapi.yaml.