Skip to content

feat: pivot config to Sanity singletons (Phase A)#607

Merged
codercatdev merged 1 commit intodevfrom
feat/config-sanity-singletons
Mar 5, 2026
Merged

feat: pivot config to Sanity singletons (Phase A)#607
codercatdev merged 1 commit intodevfrom
feat/config-sanity-singletons

Conversation

@codercatdev
Copy link
Contributor

Phase A: Pivot Config to Sanity Singletons

Replaces the Supabase config tables approach with Sanity singleton documents. Alex already lives in Sanity Studio — config editing is free, changes propagate instantly via Live Content API, and no new infrastructure needed.

Changes (+519 / -487, 11 files)

6 new Sanity singleton schemas in sanity/schemas/singletons/:

Schema Fields Key Defaults
pipelineConfig 8 geminiModel='gemini-2.0-flash', qualityThreshold=50, visibility='private'
remotionConfig 6 awsRegion='us-east-1', timeout=240s, memory=2048MB
contentConfig 7 8 RSS feeds, Cleo Abram system instruction, 3-5 scenes
sponsorConfig 4 cooldown=14d, 3 rate card tiers, email template
distributionConfig 4 notification emails, YouTube template + tags
gcsConfig 2 bucket + project ID

Rewrote lib/config.ts — Sanity writeClient.fetch instead of Supabase. Same API surface (getConfig, getConfigValue, invalidateConfig), same 5-min stale-while-revalidate caching.

Updated lib/types/config.ts — camelCase field names, _id/_type/_updatedAt instead of id/updated_at.

Registered all 6 singletons in sanity.config.ts schema.types + singletonPlugin().

Removed:

  • supabase/migrations/003_config_tables.sql (no longer needed)
  • app/api/dashboard/config/invalidate/route.ts (Sanity handles propagation)

Type check

Zero new TS errors. Only pre-existing: sanity-plugin-media, @vercel/analytics, @vercel/speed-insights.

Why Sanity over Supabase

  • Alex already lives in Sanity Studio — config editing for free
  • Instant propagation via Live Content API (no 5-min cache delay)
  • Follows existing dashboardSettings singleton pattern
  • Keeps Supabase focused on auth + cron

Closes Phase A task for spec MBYYpe5Y.

- 6 singleton schemas (pipelineConfig, remotionConfig, contentConfig,
  sponsorConfig, distributionConfig, gcsConfig)
- Rewrite lib/config.ts to use writeClient.fetch instead of Supabase
- Update lib/types/config.ts to camelCase field names
- Remove Supabase migration SQL and invalidate endpoint
- Register all singletons in sanity.config.ts

Co-authored-by: content <content@miriad.systems>
@vercel
Copy link

vercel bot commented Mar 5, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
codingcat-dev Ignored Ignored Mar 5, 2026 5:40am

@codercatdev codercatdev merged commit b8cc013 into dev Mar 5, 2026
2 of 3 checks passed
@codercatdev codercatdev deleted the feat/config-sanity-singletons branch March 5, 2026 06:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant