Cloud sync with Supabase
Supabase is optional. When configured, it enables authentication (email/password, OAuth, and Passkeys), user profiles, multi-device subscription and category sync, Bark notification settings, Lifetime Premium entitlements, Developer API keys, and AI capture monthly quota/budget accounting.Required variables
SUPABASE_SECRET_KEY is server-only and is used by Netlify Functions (SUPABASE_SERVICE_ROLE_KEY remains supported as a legacy alias).
SQL migrations
The database schema is managed by 13 timestamped migrations insupabase/migrations/:
npm run db:verify (supabase start, supabase db reset --local, supabase db lint --local, and supabase test db --local). For an existing production project, follow supabase/README.md (supabase/audit/preflight.sql before applying migrations).
Data model areas
- User profiles store account metadata and Lifetime Premium status.
- Subscriptions store recurring payment records, monthly
billing_anchor_day, and free-trial fields (is_trial,trial_ends_on). - Categories store custom user categories.
- Notification settings & delivery locks store Bark reminder preferences, delivery history, and idempotency locks.
- API keys, rate-limit windows & audit logs store SHA-256 hashed key material, scopes, per-minute/failed-auth rate windows, and public API write snapshots.
- AI usage & cost windows track per-user monthly AI capture counts (
10Free /300Premium) and workspace-wide monthly token budget reservations — without storing pasted text, screenshots, or parsed content. - Payment ledger & account deletion: self-serve account deletion (
delete-account.ts) deletes the Auth user and all user-owned subscription/category/API data, while settingpayments.user_idtoNULLand retaining necessary transaction fields for financial reconciliation, refunds, and disputes.
Passkeys (WebAuthn)
Passkey sign-in uses Supabase Auth WebAuthn (auth.experimental.passkey: true, requiring @supabase/supabase-js ≥ 2.105.0).
Local CLI
supabase/config.toml enables:
http://127.0.0.1:5173 (prefer 127.0.0.1 over localhost) so the browser origin matches rp_id and rp_origins.
Production Dashboard
In the Supabase Dashboard under Authentication → Passkeys:- Enable Passkey authentication.
- Set Relying Party Display Name (e.g.
SteadyRenew). - Set Relying Party ID to your bare production domain (e.g.
steadyrenew.com). - Add exact HTTPS origins (up to 5) under Relying Party Origins (e.g.
https://steadyrenew.com). - Confirm Site URL and Redirect URLs include your
/appcallback for OAuth and password recovery.
Security & domain migration notes
- Keep Row Level Security (RLS) enabled on all user-owned tables.
- Never expose
SUPABASE_SECRET_KEY/SUPABASE_SERVICE_ROLE_KEYinVITE_*browser variables. - Passkeys are cryptographically bound to their original Relying Party (
rp_id) domain and cannot be migrated across domains via redirect URLs; users moving from an old domain must sign in via email/password or OAuth and enroll a new passkey on the new domain.