Supabase
The Supabase store uses the @supabase/supabase-js client to write failures and detect patterns via PostgREST.
Free tier: 500 MB database, unlimited projects (paused after 1 week of inactivity).
Installation
Section titled “Installation”bun add -D @flaky-tests/store-supabase# or: npm install -D @flaky-tests/store-supabase-
Create a Supabase project at supabase.com
-
Create the tables — go to the SQL editor and run:
create table if not exists runs (id text primary key,started_at timestamptz not null,finished_at timestamptz,exit_code integer);create table if not exists failures (id text primary key,run_id text not null references runs(id),test_file text not null,test_name text not null,failure_kind text not null,error_message text,error_stack text,failed_at timestamptz not null); -
Get your project URL and anon key from Settings → API
-
Add to your environment
Terminal window SUPABASE_URL=https://abcdefghijklmnop.supabase.coSUPABASE_KEY=eyJhbGci...
import { SupabaseStore } from '@flaky-tests/store-supabase'
const store = new SupabaseStore({ url: process.env.SUPABASE_URL!, key: process.env.SUPABASE_KEY!,})Constructor options
Section titled “Constructor options”interface SupabaseStoreOptions { /** Your Supabase project URL */ url: string /** Your anon or service role key */ key: string /** Prefix for `{prefix}_runs` / `{prefix}_failures` table names. Default: `flaky_test`. */ tablePrefix?: string /** Retry tuning for read methods. Defaults: 3 attempts, 100ms base delay. */ retry?: { attempts?: number; baseMs?: number }}Error handling, retries, and cancellation
Section titled “Error handling, retries, and cancellation”Driver errors are wrapped in StoreError with cause preserved. Read methods auto-retry transient failures (network transport errors, HTTP 5xx) with exponential backoff and jitter; writes are not retried (no idempotency key). Read methods accept an optional signal?: AbortSignal, forwarded to postgrest-js via native .abortSignal() for mid-flight cancellation.
CLI usage
Section titled “CLI usage”FLAKY_TESTS_STORE=supabase \ SUPABASE_URL=https://... \ SUPABASE_KEY=eyJhbGci... \ bunx @flaky-tests/coreLimitations
Section titled “Limitations”Using the service role key
Section titled “Using the service role key”The anon key works with default RLS policies disabled. If you have RLS enabled on your tables, use the service role key instead (keep it in server-side secrets only, never expose to browsers).
SUPABASE_KEY=your-service-role-key # from Settings → API → service_role