> For the complete documentation index, see [llms.txt](https://docs.emobiq.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.emobiq.com/emobiq-ai/readme/supabase/local-supabase-setup.md).

# Local Supabase Setup

Exporting Your Supabase Project from eMOBIQ-AI to Your Local Environment

***

### Step 1 — Set Up Supabase Locally

Running Supabase locally gives you the same core services that eMOBIQ-AI used remotely:

<table data-header-hidden><thead><tr><th width="146.3984375"></th><th></th></tr></thead><tbody><tr><td>Service</td><td>Description</td></tr><tr><td>🗄️ Postgres</td><td>Database</td></tr><tr><td>👥 Auth</td><td>User authentication</td></tr><tr><td>📦 Storage</td><td>File management</td></tr><tr><td>🧰 Studio</td><td>Supabase’s web dashboard</td></tr></tbody></table>

***

#### 1. Install Docker and the Supabase CLI

Follow the official Supabase installation guide:

👉 [Supabase Local Development Setup](https://supabase.com/docs/guides/local-development)

***

#### 2. Initialize and Start Your Local Stack

From your terminal:

```sh
supabase init
supabase start
```

This launches all Supabase services in Docker containers.

***

#### 3. Get Your Local Environment Info

```sh
supabase status -o env
```

You’ll get something like:

```sh
API URL: http://127.0.0.1:54321
Database URL: postgresql://postgres:postgres@127.0.0.1:54322/postgres
Studio URL: http://127.0.0.1:54323
Publishable key: sb_publishable_XXXXXXXXXXXX
```

You’ll use the API URL and Publishable key when reconnecting your project files.

***

### Step 2 — Export Data from Your Supabase Cloud Project

This step copies your eMOBIQ-AI-connected Supabase database to your local instance.

#### 1. Use pg\_dump to Export Your Cloud Database

Run:

```
pg_dump \
  -h db.[YOUR_SUPABASE_PROJECT_REF].supabase.co \
  -U postgres \
  -d postgres \
  -p 6543 \
  -Fc \
  -f dump.sql
```

Replace \[YOUR\_SUPABASE\_PROJECT\_REF] with your project ID, e.g. uiqtrynalesuctjsemzf.

You can find this in the Supabase Dashboard URL:

<figure><img src="/files/bw4YlaPKis1cpuvMettK" alt=""><figcaption></figcaption></figure>

<figure><img src="/files/C3gVtjO2aMOTX3BeSYNf" alt=""><figcaption></figcaption></figure>

When prompted for a password, use the Database password from Project Settings → Database → Connection Info in Supabase Cloud.

***

### Step 3 — Import Data into Your Local Supabase

Now import that dump into your local instance:

```
psql -h 127.0.0.1 -p 54322 -U postgres -d postgres -f dump.sql
```

Default local password:

```
postgres
```

When done, open Supabase Studio at <http://127.0.0.1:54323> and confirm your tables and data are visible.

***

### Step 4 — Update Your HTML/JS Project to Point to Local Supabase

Your eMOBIQ-AI projects connect to Supabase Cloud using createClient().

Now, replace those cloud credentials with your local instance values.

#### ESM (common in modern setups)

```
<script type="module">
  import { createClient } from 'https://esm.sh/@supabase/supabase-js'

  const supabase = createClient(
    'http://127.0.0.1:54321',          // local API URL
    'sb_publishable_XXXXXXXXXXXXXXXX'  // local publishable key
  )

  const { data, error } = await supabase.from('your_table').select('*')
  console.log({ data, error })
</script>
```

#### UMD (non-module)

```
<script src="https://cdn.jsdelivr.net/npm/@supabase/supabase-js@2"></script>
<script>
  const supabase = window.supabase.createClient(
    'http://127.0.0.1:54321',
    'sb_publishable_XXXXXXXXXXXXXXXX'
  )
</script>
```

***

### Step 5 — Run Your App Locally

Avoid running HTML files directly with file:// — use a lightweight dev server instead:

```
npx serve .
```

Then open <http://localhost:3000>.

***

### Step 6 — Sanity Checks

<table data-header-hidden><thead><tr><th width="189.25"></th><th></th></tr></thead><tbody><tr><td>Feature</td><td>How to Test</td></tr><tr><td>🗃️ Database</td><td>Check tables in Studio → <a href="http://127.0.0.1:54323">http://127.0.0.1:54323</a></td></tr><tr><td>👥 Auth</td><td>Create a test user; view the email in <a href="http://127.0.0.1:54324">Mailpit</a></td></tr><tr><td>📦 Storage</td><td>Upload a file via Studio → Storage</td></tr><tr><td>⚡ Frontend</td><td>Your app fetches data from http://127.0.0.1:54321</td></tr></tbody></table>

***

### Optional — Switching Between Cloud & Local

You can toggle environments with a small script helper:

```
const USE_LOCAL = location.hostname === 'localhost' || location.hostname === '127.0.0.1'

const SUPABASE_URL = USE_LOCAL
  ? 'http://127.0.0.1:54321'
  : 'https://YOUR_PROJECT_REF.supabase.co'

const SUPABASE_KEY = USE_LOCAL
  ? 'sb_publishable_LOCALXXXXXXXXXXXX'
  : 'eyJhbGciOi...CLOUDXXXXXXXXXXXX'

const supabase = createClient(SUPABASE_URL, SUPABASE_KEY)
```

***

### 🎉 You’re Done!

Your Supabase project — originally linked through eMOBIQ-AI — is now fully local.

You can edit your schema, test API calls, and build offline without relying on Supabase Cloud or eMOBIQ-AI’s live environment.

***

### Troubleshooting

<table data-header-hidden><thead><tr><th width="326.50390625"></th><th></th></tr></thead><tbody><tr><td>Issue</td><td>Possible Fix</td></tr><tr><td>supabase: command not found</td><td>Reinstall the CLI with npm install -g supabase or brew install supabase/tap/supabase</td></tr><tr><td>pg_dump: could not translate host name</td><td>Check your network or ensure you included port 6543</td></tr><tr><td>Can’t connect from browser</td><td>Serve files via npx serve ., not file://</td></tr><tr><td>Wrong port</td><td>Database: 54322, API: 54321, Studio: 54323</td></tr><tr><td>Missing tables</td><td>Ensure you imported your dump into the correct port (54322)</td></tr></tbody></table>

***

### Enterprise Deployment Support

If you’d like to deploy your Supabase environment to a virtual machine (VM) or your own production server, we can help you set that up securely.

For enterprise deployment assistance, please contact our team **here**.

Our enterprise support can guide you through:

* Deploying Supabase on your own infrastructure (AWS, Azure, GCP, etc.)
* Setting up backups, SSL, and domain routing
* Scaling from local to production-grade environments

***

### References

* [Supabase Local Development Docs](https://supabase.com/docs/guides/local-development)
* [Supabase CLI Guide](https://supabase.com/docs/guides/cli)
* [PostgreSQL pg\_dump Reference](https://www.postgresql.org/docs/current/app-pgdump.html)
