Supabase Management Skill
This skill provides workflows and knowledge for managing the Supabase backend specific to this project (fastapi-supabase-todo-v1).
1. Health Checks
Do NOT rely on the standard /health endpoint for database connectivity. It is a service logic-only check.
To check database connectivity:
- Use the
/db-healthendpoint logic. - The project includes a dedicated script for this:
scripts/check_db.py. - Usage:
python scripts/check_db.py- This script attempts to verify connectivity and the existence of the
todostable.
- This script attempts to verify connectivity and the existence of the
2. Troubleshooting Connection Issues
If you encounter 503 Service Unavailable or PGRST301 errors:
Check Environment Variables:
- Ensure
SUPABASE_URLandSUPABASE_KEY(Anon Key) are set. - For admin operations (like
/db-health),SUPABASE_SERVICE_KEYis required.
- Ensure
Refer to Documentation:
- See
docs/TROUBLESHOOTING_SUPABASE.mdfor specific error codes and fixes. - Common issue: Supabase project is paused (Free tier limit). Solution: Log in to Supabase dashboard to unpause.
- See
3. Database Schema
- Schema File:
schema.sql(orschema_with_auth.sqlfor auth policies). - Applying Changes: This project does NOT use an automated migration tool (like Alembic) yet. Changes must be applied via the Supabase SQL Editor.
4. Authentication & RLS
- RLS Policies: Row Level Security is ENABLED on the
todostable. - Service Key: To bypass RLS (e.g., for health checks or admin tasks), use the
SUPABASE_SERVICE_KEYand theget_admin_client()function inapp/db/supabase.py. - Anon Key: Used for standard user interactions; respects RLS policies.
Converted and distributed by TomeVault — claim your Tome and manage your conversions.