What is Supabase?
Supabase is an open-source Firebase alternative offering:- PostgreSQL Database - Relational database with SQL
- Authentication - User signup, login, OAuth
- Storage - File uploads and media
- Real-time - Live data subscriptions
- Edge Functions - Serverless backend logic
Connecting Supabase
First-Time Setup
- Go to Settings > Supabase
- Click Connect Supabase
- Sign in to Supabase (or create account)
- Authorize Kleap
- Connection saved
Creating a Database
After connecting:- Go to Settings > Database
- Click Create Database
- Choose a region (closest to your users)
- Database created in ~60 seconds
Each app can have its own database, or multiple apps can share one.
Database Features
Tables
Store your app’s data in tables:Creating Tables via AI
Ask Kleap to create tables:Row Level Security (RLS)
Control data access at the database level:Authentication
Built-in Auth Methods
- Email/Password - Traditional signup
- Magic Link - Passwordless email login
- OAuth Providers - Google, GitHub, etc.
Adding Auth via AI
- Supabase Auth configuration
- Login/signup pages
- Protected routes
- User session handling
Auth Code Example
Storage
File Uploads
Store images, documents, and media:Storage Buckets
Organize files in buckets:| Bucket | Access | Use Case |
|---|---|---|
| public | Anyone | Public images, assets |
| private | Authenticated | User uploads |
| avatars | Per-user | Profile pictures |
Real-time Subscriptions
Get live updates when data changes:- Live chat
- Real-time dashboards
- Collaborative editing
- Notifications
Edge Functions
Run server-side code:Database Management
Via Kleap
Ask the AI to make database changes:Via Supabase Dashboard
- Go to supabase.com/dashboard
- Select your project
- Use Table Editor, SQL Editor, or Auth settings
Supabase Pricing
| Plan | Database | Storage | Auth | Price |
|---|---|---|---|---|
| Free | 500 MB | 1 GB | 50K MAU | $0 |
| Pro | 8 GB | 100 GB | 100K MAU | $25/mo |
| Team | Unlimited | Unlimited | Unlimited | $599/mo |
Best Practices
Enable RLS on all tables
Enable RLS on all tables
Row Level Security is your primary defense against data leaks.
Use proper data types
Use proper data types
Use appropriate PostgreSQL types:
uuid for IDs, timestamptz for dates, jsonb for flexible data.Index frequently queried columns
Index frequently queried columns
Add indexes to columns used in WHERE clauses and JOINs for better performance.
Don't expose service key
Don't expose service key
Only use the public
anon key in client code. Keep the service_role key secret.Troubleshooting
Database connection failed
Database connection failed
- Check your Supabase project is active
- Verify environment variables are set
- Ensure project hasn’t been paused (free tier pauses after inactivity)
Auth not working
Auth not working
- Enable the auth provider in Supabase dashboard
- Check redirect URLs are configured
- Verify site URL is set correctly
RLS blocking access
RLS blocking access
- Check your policies allow the intended operations
- Verify
auth.uid()is correct for the logged-in user - Test policies in Supabase SQL Editor
Security Best Practices
Learn how to secure your Supabase database

