AGENT SKILL

supabase-backend

暂无简介

使用场景后端与接口
License 许可
MIT
最近更新
2026-06-24
Stars
★ 66
Forks
24

03 SKILL.md 正文

Supabase

Client Setup

import { createClient } from '@supabase/supabase-js';
const supabase = createClient(SUPABASE_URL, SUPABASE_ANON_KEY);

Database (Postgres)

const { data } = await supabase.from('posts').select('*, author:users(name)').order('created_at', { ascending: false }).limit(10);
await supabase.from('posts').insert({ title, body, user_id: user.id });
await supabase.from('posts').update({ title }).eq('id', postId);

Auth

await supabase.auth.signUp({ email, password });
await supabase.auth.signInWithPassword({ email, password });
await supabase.auth.signInWithOAuth({ provider: 'github' });
const { data: { user } } = await supabase.auth.getUser();

Real-time

supabase.channel('posts').on('postgres_changes',
    { event: '*', schema: 'public', table: 'posts' },
    (payload) => console.log(payload)
).subscribe();

Storage

await supabase.storage.from('avatars').upload(path, file);
const { data: { publicUrl } } = supabase.storage.from('avatars').getPublicUrl(path);

RLS (Row Level Security) for fine-grained access control in Postgres policies

04 同仓库更多 Skills