Back to all articles

Store Data in Your App

12 min readJanuary 12, 2026By Spawned Team

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.

  1. Sign up at supabase.com
  2. Create a new project
  3. 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

Ready to try it?

Build your first app in a few minutes.

Start Building