> ## Documentation Index
> Fetch the complete documentation index at: https://docs.nometria.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Database Setup

> Connect Supabase or Appwrite as your production database.

Nometria supports two managed database backends: **Supabase** (PostgreSQL) and **Appwrite** (NoSQL + file storage). Most AI builders use Supabase — it's the default recommendation.

## Supabase

### Use an existing Supabase project

If your app already has a Supabase project (most Base44 and Lovable apps do):

1. In your Supabase dashboard, go to **Settings** → **API**
2. Copy your **Project URL** and **service\_role key**
3. In Nometria configuration, select **Use existing Supabase project** and paste these values
4. Nometria connects to your project and verifies the schema

<Warning>Use the `service_role` key only server-side. Your `anon` key is safe to use in the browser — set it as a `VITE_` or `NEXT_PUBLIC_` variable. The `service_role` key bypasses Row Level Security and should never be exposed to the browser.</Warning>

### Create a new Supabase project

If you're migrating from a builder's managed database to your own:

1. In Nometria configuration, select **Create new Supabase project**
2. Enter a project name and choose a region
3. Nometria provisions a new Supabase project via the Supabase Management API
4. Your schema is migrated automatically — tables, relationships, indexes, RLS policies

Nometria then injects your new Supabase credentials as environment variables:

```bash theme={null}
NEXT_PUBLIC_SUPABASE_URL=https://xxxxxxxxxxxx.supabase.co
NEXT_PUBLIC_SUPABASE_ANON_KEY=eyJ...
SUPABASE_SERVICE_ROLE_KEY=eyJ...
```

### Schema migration

During setup, Nometria:

1. Exports the SQL schema from your source (builder's Supabase or your existing project)
2. Replays it against your new Supabase project using `psql`
3. Verifies all tables and foreign keys are present
4. Optionally seeds your data if you provide a seed SQL file

<Info>RLS (Row Level Security) policies are migrated as-is. If your builder generated RLS policies, they carry over to your own project unchanged.</Info>

### Supabase Edge Functions

If your app uses Supabase Edge Functions, Nometria deploys them to your new project using the Supabase CLI. Edge Functions run on Deno at the edge, close to your users.

***

## Appwrite

Appwrite is an alternative to Supabase with document-based collections, built-in file storage, and a different authentication model.

### Connect existing Appwrite project

1. Go to your Appwrite Console → **API Keys** → create a key with full permissions
2. In Nometria configuration, select **Use existing Appwrite project**
3. Paste your **Endpoint**, **Project ID**, and **API Key**

### Migrate from Supabase to Appwrite

If your builder used Supabase but you want to switch to Appwrite:

<Warning>This is a significant migration. Supabase uses PostgreSQL tables with SQL; Appwrite uses document collections. Your frontend code will need updates to use the Appwrite SDK instead of the Supabase client.</Warning>

For most vibe-coded apps that don't have complex SQL queries, Nometria can map Supabase tables to Appwrite collections. Contact support for complex schemas.

***

## Firebase to Supabase

If your app uses Firebase (Firestore + Firebase Auth), see the dedicated migration guide:

<Card title="Firebase → Supabase migration guide" icon="database" href="/migrate/firebase-to-supabase" horizontal>
  Step-by-step guide to migrating from Firebase to Supabase
</Card>
