Supabase

Add backend database, authentication, and storage to your App2 projects. Connect your own Supabase projects for full backend capabilities.

Written By Nick Gatzoulis

Last updated 3 months ago

What is Supabase integration?

Supabase integration connects your App2 projects to your own Supabase backend, giving you database, authentication, storage, and serverless functions.

What Supabase provides:

  • PostgreSQL database: Powerful relational database

  • Authentication: User login and management

  • Storage: File uploads and media management

  • Edge Functions: Serverless backend logic

  • Real-time: Live data updates

  • Row Level Security: Built-in data protection

How integration works:

  1. Connect your Supabase account (OAuth)

  2. Authorize App2 to access your organizations

  3. Select which Supabase project to link

  4. App2 configures environment variables automatically

  5. AI can build features using your Supabase backend

Note: You keep full control of your Supabase projects. App2 only accesses what you authorize.

Why connect Supabase?

Supabase turns your App2 projects into full-stack applications.

With Supabase, you can:

Add authentication:

  • User signup and login

  • Email/password authentication

  • Social logins (Google, GitHub, etc.)

  • Password reset flows

  • Session management

Build with database:

  • Store user data

  • Create tables and relationships

  • Run SQL queries

  • Real-time data subscriptions

  • Database migrations

Handle file storage:

  • Upload images and files

  • Serve media content

  • Manage user avatars

  • Generate signed URLs

Deploy backend logic:

  • Serverless edge functions

  • API endpoints

  • Background jobs

  • Webhook handlers

AI understands your setup:

  • Reads your database schema

  • Generates correct SQL queries

  • Uses proper authentication patterns

  • Follows Supabase best practices

Prerequisites

Before connecting Supabase:

  1. Supabase account: Free or paid account at supabase.com

  2. Supabase project: At least one project created in Supabase

  3. App2 workspace: Any tier (Free, Pro, Lifetime)

  4. Workspace role: Owner or Admin permissions

Creating a Supabase project:

  1. Go to app.supabase.com

  2. Click "New Project"

  3. Choose organization

  4. Enter project name and database password

  5. Select region

  6. Wait for provisioning (~2 minutes)

Setup steps

Step 1: Connect Supabase account

Authorize App2 to access your Supabase organizations.

  1. Go to Workspace Settings β†’ Integrations β†’ Supabase

  2. Click "Connect Supabase"

  3. Redirected to Supabase for authorization

  4. Log into Supabase (if not already)

  5. Review permissions requested

  6. Click "Authorize"

  7. Redirected back to App2

Your Supabase account is now connected.

Step 2: Select organizations

App2 discovers all Supabase organizations you authorized.

What you'll see:

  • List of your Supabase organizations

  • Projects within each organization

  • Link status for each project

  • Last synced timestamp

Step 3: Link project to App2

Connect a Supabase project to your App2 project.

  1. Open your App2 project

  2. Go to Project Settings β†’ General β†’ Supabase Backend

  3. Find "Connect Supabase project" section

  4. Select Supabase project from dropdown

  5. Click "Connect Supabase project"

  6. Linked successfully

Auto-configuration:

  • Environment variables set automatically

  • Supabase URL and keys configured

  • AI can now use Supabase features

  • Ready to build backend functionality

Linking projects

Connect your Supabase backend to specific App2 projects.

One-to-one linking

Important rule: Each App2 project can link to one Supabase project, and each Supabase project can link to one App2 project.

Why one-to-one:

  • Prevents configuration conflicts

  • Clear environment variable management

  • Isolated backend per app

  • Better security

If you need multiple apps:

  • Create separate Supabase projects

  • Or use one Supabase project for multiple environments (dev, staging, prod)

Environment variables

App2 automatically configures Supabase credentials when you link a project.

Variables added:

Web projects (Vite):

  • VITE_SUPABASE_URL: Your Supabase project URL

  • VITE_SUPABASE_ANON_KEY: Public anonymous key

Mobile projects (Expo):

  • EXPO_PUBLIC_SUPABASE_URL: Your Supabase project URL

  • EXPO_PUBLIC_SUPABASE_ANON_KEY: Public anonymous key

Service role key:

  • Stored securely in Supabase secrets

  • Used for edge functions

  • Never exposed in client code

Access in code:

// Web (Vite)
const supabaseUrl = import.meta.env.VITE_SUPABASE_URL
const supabaseAnonKey = import.meta.env.VITE_SUPABASE_ANON_KEY

// Mobile (Expo)
const supabaseUrl = process.env.EXPO_PUBLIC_SUPABASE_URL
const supabaseAnonKey = process.env.EXPO_PUBLIC_SUPABASE_ANON_KEY

Unlinking projects

Remove Supabase connection from an App2 project.

How to unlink:

  1. Go to Workspace Settings β†’ Integrations β†’ Supabase

  2. Find the linked project

  3. Click "Unlink" or "Remove"

  4. Confirm action

What happens:

  • Link removed from App2 database

  • Environment variables cleared from project

  • Supabase project remains intact (not deleted)

  • Can link to different App2 project

Managing organizations

Viewing organizations

See all connected Supabase organizations and their projects.

Where to view:Workspace Settings β†’ Integrations β†’ Supabase

What you'll see:

  • Organization names

  • Projects within each org

  • Link status (which App2 projects use which Supabase projects)

  • Last synced timestamp

  • Action buttons

Refreshing organizations

Sync latest projects from Supabase.

When to refresh:

  • Created new Supabase project

  • Deleted Supabase project

  • Changed project settings

  • Want latest data

How to refresh:

  1. Find organization in Supabase settings

  2. Click "Refresh" button next to organization

  3. Wait for sync (~5 seconds)

  4. Project list updates

Deleting organizations

Remove Supabase organizations from your workspace.

When you can delete:

  • Organization has no linked projects

  • All projects unlinked first

  • You no longer need the connection

How to delete:

  1. Go to Workspace Settings β†’ Integrations β†’ Supabase

  2. Find organization to remove

  3. Verify no projects are linked (unlink them first if needed)

  4. Click "Delete" or "Remove" button

  5. Confirm deletion

What gets deleted:

  • Organization connection in App2

  • Stored access tokens

  • Project list from that org

What stays intact:

  • Your Supabase organization (unchanged in Supabase)

  • All Supabase projects (not deleted)

  • Data in Supabase (safe)

If projects are linked:

  • Cannot delete organization

  • Must unlink all projects first

  • Error message shows which projects are linked

Tip: Unlink all projects before deleting an organization to clean up unused connections.

Using Supabase

Once linked, ask the AI to build backend features.

AI capabilities with Supabase

The AI can:

  • Create database tables with migrations

  • Set up authentication flows

  • Implement Row Level Security (RLS)

  • Build API endpoints with edge functions

  • Configure file storage buckets

  • Generate TypeScript types from schema

  • Write database queries

  • Set up real-time subscriptions

Example prompts:

Authentication:

  • "Add Supabase authentication with email and password"

  • "Create signup and login pages using Supabase auth"

  • "Implement password reset flow with Supabase"

Database:

  • "Create a 'tasks' table in Supabase with columns: id, user_id, title, completed, created_at"

  • "Add RLS policies so users can only see their own tasks"

  • "Write a query to fetch all tasks for the current user"

Storage:

  • "Set up Supabase storage bucket for user avatars"

  • "Add image upload functionality using Supabase storage"

  • "Implement file upload with progress indicator"

Real-time:

  • "Add real-time subscription to the tasks table"

  • "Show live updates when tasks change"

  • "Implement real-time chat using Supabase"

Supabase MCP tools

The AI has access to Supabase MCP tools for direct database operations.

Available tools:

  • execute_sql: Run SQL queries

  • list_tables: View database schema

  • apply_migration: Create database migrations

  • generate_typescript_types: Create type definitions

  • search_docs: Look up Supabase documentation

Automatic usage:

  • AI uses tools when appropriate

  • Queries docs for best practices

  • Generates migrations for schema changes

  • Creates types for type safety

Managing secrets

Use Security Center to manage Supabase secrets (environment variables stored in Supabase).

Access secrets management:

  1. Go to Settings β†’ Security Center

  2. Click Secrets tab

  3. Create, view, or delete secrets

Secrets are stored securely in Supabase and never exposed via API. For detailed instructions, see Security Center - Supabase Secrets.

Tip: Only workspace owners and admins can access secrets. Secret values are never shown after creation for security.

Best practices

Security

Protect your data:

  • Always implement RLS policies

  • Never expose service role key in client code

  • Use anon key for client-side operations

  • Test RLS policies thoroughly

  • Monitor Supabase dashboard for suspicious activity

Access control:

  • Link Supabase projects only to trusted App2 projects

  • Review authorization permissions

  • Revoke access when no longer needed

  • Use separate Supabase projects for dev/prod

Schema management

Database best practices:

  • Use migrations for all schema changes

  • Generate TypeScript types after schema updates

  • Test migrations on development projects first

  • Document your database schema

Example workflow:

  1. Ask AI to create table with migration

  2. Generate TypeScript types

  3. Test with sample data

  4. Deploy to production

Organization structure

Organize Supabase projects:

  • One organization per team/company

  • Separate projects for dev/staging/prod

  • Or one Supabase project per App2 project

  • Clear naming conventions

Linking strategy:

  • Link dev Supabase project to dev App2 project

  • Link prod Supabase project to prod App2 project

  • Don't cross-link environments

Troubleshooting

OAuth authorization failed

Issue: Can't connect Supabase account or authorization fails.

Solutions:

  1. Check you're logged into Supabase in same browser

  2. Verify Supabase account has organizations

  3. Try authorization in incognito/private mode

  4. Clear browser cache and cookies

  5. Ensure pop-ups are allowed for App2.dev


No Supabase projects showing

Issue: Connected organization but no projects appear.

Solutions:

  1. Create a Supabase project in that organization

  2. Click "Refresh" button to sync latest projects

  3. Wait a few seconds for projects to provision

  4. Verify organization is active in Supabase dashboard


Can't link Supabase project

Issue: "Connect Supabase project" button disabled or error occurs.

Solutions:

  1. Verify Supabase project isn't already linked to another App2 project

  2. Check you selected a project from dropdown

  3. Ensure you have owner/admin role in App2 workspace

  4. Refresh organization to get latest project list

  5. Try unlinking from other App2 project first


Can't delete organization

Issue: "Delete" option not available or fails.

Solutions:

  1. Check if organization has linked projects

  2. Unlink all App2 projects using this organization first

  3. Verify you're workspace owner/admin

  4. Refresh page and try again


Environment variables not working

Issue: Supabase credentials not available in code.

Solutions:

  1. Verify Supabase project is linked in project settings

  2. Check environment variable names match your framework (Vite vs Expo)

  3. Restart development server/sandbox

  4. Rebuild project if needed

  5. Verify link wasn't removed

FAQ

Do all subscription tiers support Supabase?

Yes. Supabase integration works with Free, Pro, and Lifetime Pro workspaces. It's not tier-restricted.

Does connecting Supabase cost extra?

No extra cost from App2. Supabase has its own pricingβ€”check supabase.com/pricing for details. Supabase offers a generous free tier.

Can I use one Supabase project for multiple App2 projects?

No. Each Supabase project can only link to one App2 project. This prevents configuration conflicts and maintains security.

What if I delete my Supabase project?

The link breaks and your App2 project may freeze or show errors. Unlink in App2 first, then delete in Supabase.

Can I change which Supabase project is linked?

Yes. Unlink the current Supabase project, then link a different one. Only one can be linked at a time.

Will App2 modify my Supabase database?

Only when you ask the AI to make changes (create tables, run queries, etc.). App2 doesn't modify your Supabase project without your explicit prompts.

Can I use Supabase auth with my App2 app?

Yes. Ask the AI to implement Supabase authentication. It will create signup/login pages, handle sessions, and configure auth properly.

Do I need to give App2 full access to my Supabase account?

You control which organizations to authorize during OAuth. Only authorized organizations appear in App2. Revoke access anytime in Supabase dashboard.

Can I delete a Supabase organization from App2?

Yes, but only if no App2 projects are linked to projects in that organization. Unlink all projects first, then delete the organization connection.

What happens to my Supabase data if I disconnect?

Nothing. Your Supabase projects, data, and configuration remain unchanged. Disconnecting only removes the link in App2.

Related links