Quick Start
Choose Connection Mode
Supabase offers two connection methods:
- REST API (Recommended)
- Direct PostgreSQL
Installation
- REST API Mode
- Direct PostgreSQL Mode
Connection Modes
REST API Mode
Uses Supabase’s REST API with automatic schema generation:Direct PostgreSQL Mode
Uses standard PostgreSQL connection through Supabase’s pooler:Configuration Options
| Option | REST Mode | Direct Mode | Description |
|---|---|---|---|
database_url | https://xxx.supabase.co | postgresql://... | Supabase URL |
supabase_key | ✅ Required | ❌ | API key (anon or service_role) |
max_retries | 3 | 3 | Retries for paused project recovery |
retry_delay | 2.0 | 0.5 | Base delay between retries |
auto_create_tables | True | True | Create tables automatically |
Usage Patterns
Environment-Based Setup
Manual REST Configuration
Full Lifecycle Example
Supabase-Specific Features
Paused Project Recovery
Free tier projects auto-pause after 1 week of inactivity. PraisonAI handles wake-up automatically:Row Level Security (RLS)
Enable RLS in Supabase for multi-tenant agents:Real-time Subscriptions
Listen to conversation changes in real-time:Best Practices
Choose the Right Mode
Choose the Right Mode
- REST API: Best for rapid prototyping, automatic pausing recovery, built-in auth
- Direct PostgreSQL: Better performance, lower latency, standard SQL features
Handle Project Pausing
Handle Project Pausing
Free tier projects pause after 1 week. Design for graceful wake-up:
Use Service Role Keys Carefully
Use Service Role Keys Carefully
Service role keys bypass Row Level Security. Use them only for admin operations:
Monitor Usage
Monitor Usage
Track your Supabase usage:
- Database size: Conversation history grows over time
- API requests: REST calls count toward monthly limits
- Bandwidth: File uploads/downloads if using storage
Environment Variables
| Variable | Mode | Format | Example |
|---|---|---|---|
SUPABASE_URL | REST | https://xxx.supabase.co | https://abcdefgh.supabase.co |
SUPABASE_KEY | REST | JWT token | eyJhbGciOiJIUzI1NiIs... |
SUPABASE_DATABASE_URL | Direct | postgresql://... | postgresql://postgres:pass@db.xxx.supabase.com:5432/postgres |
OPENAI_API_KEY | Both | sk-... | sk-1234567890abcdef... |
Troubleshooting
Project Paused Error
If you get “project is paused” errors:API Key Permissions
Ensure your API key has the right permissions:SSL Connection Issues
For direct PostgreSQL mode, ensure SSL:Related
Cloud Databases Overview
Compare all cloud database providers
Real-time Features
Build real-time AI applications

