SDKsBackend & Authentication

Supabase is your backend-in-a-box.

This repo already includes a Supabase client wrapper + an example Edge Function (used by the AI feature). This guide explains how the backend side is structured and how to extend it safely.

What Supabase gives you

  • Postgres database (with Row Level Security)
  • Auth (email/password, OAuth, magic links, etc.)
  • Storage (buckets for files)
  • Edge Functions (server-side code on the edge)

Official docs: Supabase docs

Where the code lives (in this repo)

  • Supabase client: src/shared/libs/supabase.ts
    • supabase client instance
    • isSupabaseConfigured() / getSupabaseConfigError() guards
  • Example usage (Storage + Functions):
    • src/features/ai/services/ai.service.ts
      • uploads images to Storage (chat-images bucket)
      • calls a Supabase Edge Function for AI chat
  • Edge Functions code: supabase/functions/
    • currently: supabase/functions/ai/
  • Local Supabase config: supabase/config.toml

Configure Supabase credentials (required)

Create a Supabase project, then copy credentials from Project Settings → API into your .env:

  • EXPO_PUBLIC_SUPABASE_URL
  • EXPO_PUBLIC_SUPABASE_ANON_KEY

Why:

  • The app uses isSupabaseConfigured() to avoid runtime crashes and to show a helpful error.
  • The client is created with “safe” placeholder values when missing, so imports don’t explode, but requests will fail.