Supabase Development

Mindrally/skills/supabase-development

作者 Mindrally7682ca77710e0971eab4e0ae5dddfa281aea0ba5无许可证269 个星标收录于 2026年10月8日更新于 2026年10月9日仓库5周前更新

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

AI 生成的概览

Supabase 开发指南:数据库设计、身份验证、实时订阅、Edge Functions 与存储。

功能
提供使用 Supabase 的开发指南参考,涵盖 PostgreSQL 模式设计、行级安全(RLS)策略、身份验证流程、实时订阅、Edge Functions 和存储桶。还列出 Next.js 与 SvelteKit 的集成模式,以及连接池、缓存、索引和分页等性能实践。产出的是指导建议,而非代码或文件。
适用场景
在实现或审查基于 Supabase 的应用、需要模式、RLS、身份验证、实时功能或 Edge Functions 的约定时使用。也适用于将 Supabase 集成到 Next.js 或 SvelteKit,或调优查询性能的场景。
运行要求
除智能体本身外无其他要求;仅为说明性内容,不附带脚本。

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提交7682ca7

许可证: 无许可证

内容归原作者所有。SourceWeft 从公开仓库中收录这些内容。

举报或申请下架