Overview
This quickstart guide will walk you through:- Creating a Supabase project
- Setting up a database table
- Connecting from your application
- Performing CRUD operations
- Adding authentication
- Securing data with Row Level Security
Prefer video? Check out our video tutorials or follow framework-specific guides for Next.js, React, or Flutter.
Step 1: Create a Supabase Project
1
Sign up for Supabase
Navigate to supabase.com/dashboard and sign up for a free account using:
- GitHub
- GitLab
- Bitbucket
- Email/password
2
Create a new project
Click New Project and fill in the details:
- Name: Choose a descriptive name (e.g., “my-app”)
- Database Password: Use a strong password and save it securely
- Region: Select the region closest to your users
- Pricing Plan: Start with the Free tier
3
Get your API credentials
Once your project is ready:
- Go to Project Settings (gear icon in sidebar)
- Navigate to the API section
- Copy the following values:
- Project URL (e.g.,
https://xyzcompany.supabase.co) - anon public key (safe to use in browsers)
- Project URL (e.g.,
Step 2: Create Your First Table
Let’s create a simpletodos table to manage tasks.
1
Open SQL Editor
Navigate to SQL Editor in the left sidebar. This is where you can run SQL queries and manage your database schema.
2
Create the table
Click New Query and paste the following SQL:Click Run or press
Cmd/Ctrl + Enter to execute.3
Verify the table
Navigate to Table Editor in the sidebar. You should see your new
todos table with the defined columns.You can manually add test data here, but we’ll insert data programmatically in the next step.What is Row Level Security (RLS)?RLS is a PostgreSQL feature that restricts which rows users can access. The policies we created ensure users can only see and modify their own todos. This security is enforced at the database level, not in your application code.
Step 3: Install the Supabase Client
Now let’s connect to Supabase from your application.- JavaScript/TypeScript
- Python
- Flutter
- Swift
Install the Supabase JavaScript client:Create a Supabase client (Create a
lib/supabase.js or lib/supabase.ts):.env.local file with your credentials:Step 4: Perform CRUD Operations
Now let’s interact with our database.Step 5: Add Authentication
Supabase provides multiple authentication methods out of the box.Email/Password Authentication
Magic Link Authentication
Users can sign in with just their email - no password required:Social Authentication
Enable social providers in Authentication > Providers in your dashboard:Step 6: Subscribe to Realtime Changes
Get instant updates when data changes:Step 7: Deploy Your Application
Using Vercel (Recommended for Next.js)
1
Install Supabase Integration
- Go to the Supabase Vercel Integration
- Click Add Integration
- Select your Vercel project and Supabase project
- Environment variables are automatically configured
2
Deploy
Manual Deployment
For other platforms:-
Add environment variables to your hosting platform:
NEXT_PUBLIC_SUPABASE_URLNEXT_PUBLIC_SUPABASE_ANON_KEY
-
Configure redirect URLs in Authentication > URL Configuration:
- Add your production URL to Site URL
- Add redirect URLs to Redirect URLs
- Deploy your application
Next Steps
Congratulations! You’ve built a full-stack application with Supabase. Here’s what to explore next:Architecture Deep Dive
Learn how all Supabase components work together
Storage
Upload and serve files with automatic optimization
Edge Functions
Add custom server-side logic with TypeScript
Database Functions
Write PostgreSQL functions for complex logic
Common Issues
RLS policies preventing access
RLS policies preventing access
If you can’t read or write data:
- Verify RLS is enabled:
ALTER TABLE todos ENABLE ROW LEVEL SECURITY; - Check your policies match your use case
- Use the Table Editor to verify policies are active
- Test with the SQL Editor using
SELECT * FROM todos;while signed in
Environment variables not loading
Environment variables not loading
- Restart your dev server after adding
.envfiles - Check the variable naming (e.g.,
NEXT_PUBLIC_prefix for Next.js) - Verify the file is in the correct location (project root)
- Don’t commit
.env.localto version control
CORS errors
CORS errors
CORS errors usually mean:
- Your site URL isn’t configured in Authentication > URL Configuration
- You’re using the wrong URL (check for
httpvshttps) - Your redirect URL isn’t in the allowed list
TypeScript type errors
TypeScript type errors
Generate TypeScript types from your database:Then use them in your client:
