supabase-auth-storage-realtime-core
Configures Auth, Storage, and Realtime features in Supabase to build a complete backend.
Install
mkdir -p .claude/skills/supabase-auth-storage-realtime-core && curl -L -o skill.zip "https://agentskills.codes/api/skills/download/8792" && unzip -o skill.zip -d .claude/skills/supabase-auth-storage-realtime-core && rm skill.zipInstalls to .claude/skills/supabase-auth-storage-realtime-core
Activation
This is the description your AI agent reads to decide when to run this skill — the better it matches your request, the more reliably it fires.
Implement Supabase Auth (signUp, signIn, OAuth, session management),Key capabilities
- →Manage user authentication flows
- →Handle file uploads and signed URLs
- →Configure bucket-level RLS policies
- →Subscribe to Postgres database changes
- →Implement presence tracking and broadcast channels
How it works
It integrates authentication, storage, and real-time subscriptions into a single client, securing all operations with Row-Level Security policies.
Inputs & outputs
When to use supabase-auth-storage-realtime-core
- →Implement user sign-up and login flows
- →Setup file upload to Supabase storage
- →Enable real-time database updates in UI
- →Configure bucket-level RLS policies
About this skill
Supabase Auth + Storage + Realtime Core
Overview
Implement the three pillars that turn a Supabase database into a full application backend: user authentication (email/password, OAuth, magic links, session lifecycle), file storage (uploads, downloads, signed URLs, bucket-level RLS policies), and real-time subscriptions (Postgres change events, client-to-client broadcast, presence tracking). Every operation integrates with Row-Level Security through auth.uid().
Each pillar below carries a lean skeleton in this file; the full, copy-paste walkthroughs live in references/ so this file stays scannable.
Prerequisites
- Supabase project created at supabase.com/dashboard
@supabase/supabase-jsv2 installed (npm install @supabase/supabase-js)SUPABASE_URLandSUPABASE_ANON_KEYavailable from project Settings > API- For Python:
pip install supabase(wrapspostgrest-py,gotrue-py,storage3,realtime-py)
Instructions
Read the file (Read), edit or create the client and route/component code (Write, Edit), and grep the project (Grep) to reuse an existing Supabase client before creating a new one. Use Bash(npm:*) to install the SDK and Bash(supabase:*) to run migrations/policies.
Step 1: Auth — registration, login, OAuth
Initialize the client once, then wire the flows your app needs. The skeleton:
import { createClient } from '@supabase/supabase-js'
const supabase = createClient(process.env.SUPABASE_URL!, process.env.SUPABASE_ANON_KEY!)
// Email/password
await supabase.auth.signUp({ email, password })
await supabase.auth.signInWithPassword({ email, password })
// OAuth — redirect the user to data.url
const { data } = await supabase.auth.signInWithOAuth({ provider: 'google' })
// React to session changes (SIGNED_IN / SIGNED_OUT / TOKEN_REFRESHED)
supabase.auth.onAuthStateChange((event, session) => { /* update UI */ })
Full auth walkthrough — OAuth callback, magic link, session lifecycle, password reset: references/auth.md. Python: references/python-examples.md.
Step 2: Storage — upload, download, secure with bucket policies
Public buckets serve via CDN URLs; private buckets require signed URLs. The skeleton:
// Upload to the signed-in user's own folder (RLS enforces ownership)
await supabase.storage.from('avatars').upload(`${userId}/avatar.png`, file, { upsert: true })
// Public URL (public bucket) vs. time-limited signed URL (private bucket)
supabase.storage.from('avatars').getPublicUrl(`${userId}/avatar.png`)
await supabase.storage.from('documents').createSignedUrl('reports/q4.pdf', 3600)
Full storage walkthrough — download, list, delete, and the bucket RLS policies that enforce per-user access: references/storage.md. Python: references/python-examples.md.
Step 3: Realtime — Postgres changes, broadcast, presence
Three channel types: database change listeners, client-to-client broadcast, and presence. The skeleton:
const channel = supabase
.channel('chat-room')
.on('postgres_changes',
{ event: 'INSERT', schema: 'public', table: 'messages' },
(payload) => console.log('New:', payload.new))
.subscribe()
// One-time table setup: ALTER PUBLICATION supabase_realtime ADD TABLE messages;
supabase.removeChannel(channel) // clean up
Full realtime walkthrough — UPDATE/DELETE filters, RLS-scoped subscriptions, broadcast, and presence tracking: references/realtime.md. Python: references/python-examples.md.
Output
- Auth: user registration, password login, OAuth flow (Google/GitHub), magic link, session lifecycle with
onAuthStateChange, password reset - Storage: file upload/download, public URLs for CDN-served assets, time-limited signed URLs for private files, bucket-level RLS policies using
auth.uid()andstorage.foldername() - Realtime: Postgres change subscriptions with server-side filters, broadcast channels for client-to-client messaging, presence tracking for online status
Error Handling
| Error | Cause | Solution |
|---|---|---|
AuthApiError: User already registered | Duplicate email signup | Use signInWithPassword or check existence first |
AuthApiError: Invalid login credentials | Wrong email or password | Verify credentials; check email confirmation status |
AuthApiError: Email not confirmed | User has not clicked confirmation link | Resend with resend({ type: 'signup', email }) |
StorageApiError: Bucket not found | Bucket does not exist | Create via dashboard or INSERT INTO storage.buckets |
StorageApiError: new row violates row-level security | RLS policy blocking the operation | Verify storage.objects policies match the user and bucket |
StorageApiError: The resource already exists | File exists and upsert: false | Set upsert: true to overwrite or use a unique path |
Realtime: channel error or TIMED_OUT | Network issues or Realtime not enabled | Check ALTER PUBLICATION supabase_realtime ADD TABLE for the target table |
Realtime: too many channels | Exceeded concurrent channel limit | Unsubscribe unused channels with removeChannel() |
Examples
The end-to-end flow — sign in, upload an avatar to the user's RLS-guarded folder, resolve its public URL, and subscribe to live profile updates — is in references/examples.md. Each step composes the three skeletons above with no new API surface.
Resources
- Auth Guide
- Auth API Reference
- Storage Guide
- Storage Access Control
- Realtime Guide
- Realtime Postgres Changes
- Realtime Broadcast
- Realtime Presence
Next Steps
For common Supabase errors and debugging, see supabase-common-errors.
For database queries and CRUD operations, see supabase-crud-core.
Prerequisites
Limitations
- →Concurrent channel limit for Realtime
- →RLS policies must match user and bucket
How it compares
This approach centralizes auth, storage, and real-time logic into a single backend integration rather than managing them as separate services.
Compared to similar skills
supabase-auth-storage-realtime-core side by side with the closest alternatives in the catalog.
| Skill | Installs | Updated | Safety | Difficulty |
|---|---|---|---|---|
| supabase-auth-storage-realtime-core (this skill) | 0 | 27d | Review | Intermediate |
| supabase-developer | 95 | 7mo | Review | Intermediate |
| supabase-mcp-integration | 13 | 8mo | Review | Advanced |
| better-auth-best-practices | 18 | 6mo | No flags | Intermediate |
Try saying
Example prompts that trigger this skill in your AI assistant.
More by jeremylongshore
View all by jeremylongshore →You might also like
supabase-developer
daffy0208
Build full-stack applications with Supabase (PostgreSQL, Auth, Storage, Real-time, Edge Functions). Use when implementing authentication, database design with RLS, file storage, real-time features, or serverless functions.
supabase-mcp-integration
manutej
Comprehensive Supabase integration covering authentication, database operations, realtime subscriptions, storage, and MCP server patterns for building production-ready backends with PostgreSQL, Auth, and real-time capabilities
better-auth-best-practices
novuhq
Skill for integrating Better Auth - the comprehensive TypeScript authentication framework.
nextjs-supabase-auth
davila7
Expert integration of Supabase Auth with Next.js App Router Use when: supabase auth next, authentication next.js, login supabase, auth middleware, protected route.
cloudbase-guidelines
TencentCloudBase
Essential CloudBase (TCB, Tencent CloudBase, 云开发, 微信云开发) development guidelines. MUST read when working with CloudBase projects, developing web apps, mini programs, or backend services using CloudBase platform.
firebase-vertex-ai
jeremylongshore
Execute firebase platform expert with Vertex AI Gemini integration for Authentication, Firestore, Storage, Functions, Hosting, and AI-powered features. Use when asked to "setup firebase", "deploy to firebase", or "integrate vertex ai with firebase". Trigger with relevant phrases based on skill purpose.