Store Data in Your App
Connect Supabase and save user data. Examples for profiles, posts, and other common patterns.
When You Need a Database
Your app needs a database when you want to:
- Save user-created content (posts, tasks, profiles)
- Store settings that persist between sessions
- Share data between users
- Keep data even after the user closes the browser
Setting Up Supabase
Supabase is a database with a nice API layer. It's free to start and scales well.
- Sign up at supabase.com
- Create a new project
- Go to Settings → API and copy your credentials
Add to your environment:
NEXT_PUBLIC_SUPABASE_URL=your-url
NEXT_PUBLIC_SUPABASE_ANON_KEY=your-key
Creating Tables
Ask the AI to create your data structure:
"Create a tasks table with title, description, completed status, and due date. Link tasks to users."
The AI generates:
- SQL to create the table
- TypeScript types for the data
- API functions to create, read, update, delete
Common Patterns
User profiles:
"Add a profiles table that extends the auth user with name, avatar URL, and bio"
Posts or content:
"Create a posts table with title, body, published status, and author"
Settings:
"Add a user_settings table for notification preferences and theme choice"
CRUD Operations
Once your table exists, add UI for managing data:
"Create a form to add new tasks"
"Show a list of all tasks with edit and delete buttons"
"Add a toggle to mark tasks complete"
Row Level Security
Supabase can restrict data access automatically. Ask:
"Make it so users can only see and edit their own tasks"
This prevents User A from seeing User B's private data.
Relationships
Need related data? Just describe it:
"Tasks can have multiple comments. Each comment has text and author."
The AI creates the relationship and handles loading related data.
Related Articles
Make Your Landing Page Look Good
How to change colors, fonts, and layout to match your brand. Simple tweaks that make a big difference.
The Three Builder Modes Explained
Chat, Agent, and Visual modes each work differently. Here is when to use each one.
Add Login and Signup to Your App
Set up user accounts with Supabase auth. Users can create accounts, log in, and stay signed in.
See where AI recommends your competitors
Run a free visibility audit across ChatGPT, Claude, and Gemini. No signup required.
Run the free audit