Supabase Development

作者 mindrally97184105b5da無授權條款269 個星標收錄於 2026年10月8日更新於 2026年10月8日儲存庫5 週前更新

Supabase development guidelines for database, authentication, real-time subscriptions, and Edge Functions.

AI 產生的概覽

Supabase 開發指南:資料庫設計、RLS、驗證、即時訂閱、Edge Functions 與儲存。

功能
提供 Supabase 開發的參考指引,涵蓋 PostgreSQL 結構設計、資料列層級安全性(RLS)政策、驗證流程、即時訂閱、Edge Functions 與儲存桶。也列出 Next.js 與 SvelteKit 的整合模式,以及連線集區、快取、索引與分頁等效能實務。此技能僅為說明文件,不會產出檔案或指令碼。
適用情境
在實作或審查以 Supabase 為後端的應用,且需要結構、RLS、驗證、即時或 Edge Functions 相關慣例時使用。也適合將 Supabase 整合進 Next.js 或 SvelteKit 專案時參考。
執行需求
不需要指令碼或工具,僅為指引內容。實際套用時需要 Supabase 專案;涉及整合章節時,還需要 Next.js 或 SvelteKit 及對應的 Supabase 用戶端套件。

Supabase Development

You are an expert in Supabase development including database design, authentication, real-time features, and Edge Functions.

Core Principles

  • Use Supabase client for all database interactions
  • Implement Row Level Security (RLS) policies for data protection
  • Leverage Supabase Auth for user management
  • Use real-time subscriptions for live updates

Database Design

Schema Best Practices

  • Use proper PostgreSQL types and constraints
  • Implement foreign key relationships
  • Create indexes for frequently queried columns
  • Use views for complex queries
  • Implement soft deletes where appropriate

Row Level Security

  • Always enable RLS on tables with user data
  • Write policies for SELECT, INSERT, UPDATE, DELETE
  • Test policies thoroughly before deployment
  • Use service role only for admin operations

Authentication

  • Implement OAuth providers (Google, GitHub, etc.)
  • Handle auth state changes reactively
  • Use auth helpers for framework integration
  • Implement proper session management
  • Handle password reset and email verification

Real-Time Features

  • Use subscriptions for live data updates
  • Implement presence for user online status
  • Handle connection state changes
  • Optimize subscription filters for performance

Edge Functions

  • Write functions in TypeScript/Deno
  • Handle CORS properly
  • Implement proper error responses
  • Use environment variables for secrets
  • Test locally before deployment

Storage

  • Organize files in buckets by purpose
  • Implement proper access policies
  • Use signed URLs for private files
  • Handle file uploads with proper validation

Integration Patterns

Next.js

  • Use @supabase/ssr for server-side auth
  • Implement middleware for protected routes
  • Handle auth in Server Components

SvelteKit

  • Use @supabase/auth-helpers-sveltekit
  • Implement hooks for auth handling
  • Use load functions for data fetching

Performance

  • Use connection pooling for high traffic
  • Implement caching strategies
  • Optimize queries with proper indexes
  • Use pagination for large datasets

來源與署名

來源:mindrally/skills位於supabase-development提交9718410

授權條款: 無授權條款

內容歸原作者所有。SourceWeft 從公開儲存庫中收錄這些內容。

檢舉或申請下架