Supabase Setup
Oversight uses Supabase for its database, authentication, and real-time subscriptions. This guide walks through creating a project, running migrations, and configuring the auth provider.
Create a Supabase Project
- Go to supabase.com/dashboard and create a new project.
- Choose a region close to where you will run the oversight server.
- Copy your project credentials from Settings → API:
- Project URL →
SUPABASE_URL - anon public key →
SUPABASE_ANON_KEY - service_role secret key →
SUPABASE_SERVICE_ROLE_KEY
- Project URL →
service_role key bypasses Row Level Security.
Never expose it to the browser. Only the server and runner use it.
Run Migrations
Oversight ships numbered SQL migrations in supabase/migrations/. Apply
them using the Supabase CLI or the SQL Editor in the dashboard.
Option A: Supabase CLI
# Link to your project
supabase link --project-ref <your-project-ref>
# Push all migrations
supabase db push
Option B: SQL Editor
Open the SQL Editor in the Supabase dashboard and run each migration file in order:
001_initial.sql— Createsrepos,analyses,analysis_items, andtaskstables with RLS policies and indexes.002_tasks_notion_fields.sql— Adds Notion page tracking columns to tasks.003_user_settings.sql— Creates theuser_settingstable.004_merge_status.sql— Adds merge status tracking to analysis items.005_tasks_posted_tracking.sql— Tracks when reviews are posted to GitHub.006_shared_data.sql— Converts per-user data to shared model with new RLS policies.007_repos_case_insensitive.sql— Makes repo name lookups case-insensitive.008_tasks_params.sql— Adds a params JSONB column to tasks.009_staleness_defaults_30.sql— Updates default staleness thresholds to 30 days.010_audit_log_and_output.sql— Creates theaudit_logtable and adds output logging.011_runner_heartbeats.sql— Creates therunner_heartbeatstable.012_engagement_status.sql— Adds engagement signal tracking.013_runner_commands.sql— Creates therunner_commandstable for remote restart.014_repo_steward.sql— Adds steward assignment and nightly refresh tracking to repos.
Database Schema
After running all migrations, the schema includes these core tables:
| Table | Purpose |
|---|---|
repos | GitHub repositories tracked by oversight |
analyses | Analysis runs (PR or issue scans) per repo |
analysis_items | Individual PRs/issues within an analysis, with AI-generated summaries and engagement signals |
tasks | Background tasks (reviews, analyses, resolves) with real-time progress |
user_settings | Per-user configuration (staleness thresholds, ping templates) |
audit_log | Audit trail of user and system actions |
runner_heartbeats | Tracks runner liveness and current task count |
runner_commands | Remote commands (restart, self-update) sent to runners |
engagement_overrides | Manual overrides for computed engagement status |
RLS Policies
Oversight uses a shared data model. After migration 006, all tables use
authenticated-user RLS policies — any logged-in user can read and
write all data. The service_role key bypasses RLS entirely for the server
and runner.
Key policy pattern:
CREATE POLICY "Authenticated users can view all repos"
ON repos FOR SELECT
USING (auth.role() = 'authenticated');
Enable Realtime
The tasks table is added to the Supabase Realtime publication so the
dashboard can show live progress updates as the runner executes reviews. This is done
automatically by migration 001:
ALTER PUBLICATION supabase_realtime ADD TABLE tasks;
If you need to verify this manually, check the Supabase dashboard under
Database → Replication and confirm tasks is listed
under the supabase_realtime publication.
GitHub OAuth Provider
Oversight uses GitHub as its Supabase auth provider. Configure it in Authentication → Providers → GitHub:
- Create a GitHub OAuth App at github.com/settings/developers.
- Set the Authorization callback URL to
https://<your-project-ref>.supabase.co/auth/v1/callback. - Copy the Client ID and Client Secret into the Supabase GitHub provider settings.
- Also set them as
GITHUB_OAUTH_CLIENT_IDandGITHUB_OAUTH_CLIENT_SECRETin your.envfor the server-side token refresh endpoint.
repo scope so
oversight can read private repos, fetch PR diffs, and post review comments.
Getting Credentials
Quick reference for where to find each value:
| Credential | Where to Find |
|---|---|
| Project URL | Supabase Dashboard → Settings → API → Project URL |
| Anon Key | Supabase Dashboard → Settings → API → anon public |
| Service Role Key | Supabase Dashboard → Settings → API → service_role secret |
| OAuth Client ID | GitHub → Settings → Developer settings → OAuth Apps → your app |
| OAuth Client Secret | Same as above — generate a new secret if needed |