Local Dev Setup

Run the full site locally against the dev Supabase project.

Prerequisites

  • Ruby 3.x + Bundler + development headers (ruby --version, bundle --version)
    • On Fedora/RHEL: sudo dnf install -y ruby-devel gcc make
  • PostgreSQL client tools for data sync (psql, pg_dump)
  • .env.dev in repo root (copy from .env.dev.example, fill in DB URLs)

One-time setup

1. Install Ruby gems

bundle install

2. Apply schema to dev Supabase

Already done via MCP. If you ever need to re-apply (e.g. after schema changes):

source .env.dev
psql "$DEV_DB_URL" -f supabase/supabase-schema.sql

Or use the Supabase SQL Editor at https://supabase.com/dashboard/project/lbefrzvyznaoaglldluk/sql.

3. Deploy Edge Functions

Requires the Supabase CLI:

# Install (one-time)
brew install supabase/tap/supabase   # or: npm i -g supabase

# Link to dev project
supabase link --project-ref lbefrzvyznaoaglldluk

# Deploy all functions
supabase functions deploy submit-question
supabase functions deploy moderate-question
supabase functions deploy notify-subscribers
supabase functions deploy check-notification-status

Or deploy via MCP (already done for initial setup).

4. Set Edge Function secrets

Set these in the Supabase Dashboard → Edge Functions → Manage secrets (https://supabase.com/dashboard/project/lbefrzvyznaoaglldluk/functions):

Secret Required by Notes
OPENAI_API_KEY submit-question Same key as prod, or a test key
OPENAI_MODEL submit-question Optional; defaults to gpt-4o-mini
NOTIFY_SECRET moderate-question, notify-subscribers, check-notification-status Any strong random string for dev
SMTP_HOST notify-subscribers Dev mailbox host, or leave blank to skip email
SMTP_PORT notify-subscribers 465 or 587
SMTP_USER notify-subscribers SMTP username
SMTP_PASS notify-subscribers SMTP password
SITE_URL notify-subscribers Set to http://localhost:4000 for dev
SENDER_EMAIL notify-subscribers e.g. me@example.com

SUPABASE_URL and SUPABASE_SERVICE_ROLE_KEY are auto-injected by the platform.

Running locally

bash scripts/serve-dev.sh

Site will be at http://localhost:4000 with live reload and drafts visible, pointing at the dev Supabase project (lbefrzvyznaoaglldluk.supabase.co).

Syncing prod data to dev (optional)

To get realistic content in the dev database:

bash scripts/sync-prod-to-dev.sh

This replaces all dev data with a copy of prod. Safe to re-run repeatedly.

How it works

  • _config.yml + _config.dev.yml — Jekyll merges these; dev values override prod
  • _config.dev.yml contains the dev Supabase URL + anon key (public, safe to commit)
  • All JS modules receive the Supabase URL/key via Jekyll template variables
  • Edge Functions run on the dev Supabase project and use the dev database