# Connect your Turbostarter (Next.js, React Native, Vite) app to Supabase in 5 minutes

> Learn how to connect your TurboStarter monorepo (Next.js, React Native, Vite) to Supabase and use it as your unified database, storage, and edge backend.

Published: 2025-11-20 · Tags: web, mobile, extension, guide, storage, database, auth

When you spin up a new [TurboStarter](https://www.turbostarter.dev) project – a starter kit for **web apps, mobile apps, and browser extensions** powered by [Turborepo](https://turborepo.dev/repo) – one of the first questions is: **where does my data live and how do I ship fast without fighting my backend?**

[Supabase](https://supabase.com) answers that with a managed [PostgreSQL](https://www.postgresql.org/) platform – database, storage, and edge runtime – while TurboStarter gives you a production‑ready monorepo with [Next.js](https://nextjs.org/), [React Native](https://reactnative.dev/), and [Vite](https://vite.dev/)/[WXT](https://wxt.dev/) already wired together.

In this article, you’ll follow the **same setup flow as our official Supabase recipe** – just with a more opinionated, SEO‑friendly walkthrough. By the end, you’ll have **one Supabase Postgres database and optional Supabase Storage + Edge Functions** wired into your TurboStarter stack, ready to power web, mobile, and extension apps from a single source of truth.

TurboStarter complements Supabase perfectly:

* **Monorepo by default** – web, mobile, and extensions in one place.
* **Shared database package** – `@workspace/db` with [Drizzle ORM](https://orm.drizzle.team/) so schema and migrations are defined once and reused everywhere.
* **Production‑grade tooling** – [Turborepo](https://turborepo.dev/repo), TypeScript, best‑practice configs, and CI‑ready structure.

You get the **speed of a starter kit** with the **power of a real platform**, without locking yourself into proprietary APIs. If you are still choosing the host, start with [Neon vs Supabase](https://www.turbostarter.dev/blog/neon-vs-supabase). Let’s plug Supabase into TurboStarter in about five minutes.

## What you’ll set up

In this guide you will:

* **Create a Supabase project** backed by managed Postgres.
* **Point TurboStarter’s database** at Supabase via `DATABASE_URL`.
* **Run TurboStarter migrations** so your full schema lives in Supabase.
* **Use Supabase Storage as S3‑compatible storage** for things like avatars, logos, and uploads.
* **Optionally run your API on Supabase Edge Functions** using [Hono](https://hono.dev) close to your data.
* **Explore extra Supabase features** (Auth, Realtime, Vector, Cron) that fit naturally into TurboStarter’s architecture.

Everything here follows the same structure as the Supabase recipe in your docs, so you can skim this post, follow along, and then dive into the [reference documentation](https://www.turbostarter.dev/docs/web/database/overview) when you need more detail.

## Supabase features at a glance

Before wiring anything up, it helps to understand what you’re getting from Supabase and how it pairs with TurboStarter’s monorepo.

### Managed Postgres database

At the core of Supabase is a **fully managed PostgreSQL database** with automatic provisioning, backups, monitoring, and scaling. You keep the full power of Postgres – joins, constraints, indexes, transactions, extensions – while managing everything through a modern UI ([database overview](https://supabase.com/docs/guides/database)). TurboStarter plugs into this via `@workspace/db` and Drizzle, so your schema and migrations stay in Git while Supabase handles the heavy lifting of running Postgres in production.

### Auth and Row Level Security

Supabase ships a complete **authentication and authorization system** on top of your database: email/password, magic links, OAuth providers (GitHub, Google, etc.), and SSO flows ([auth overview](https://supabase.com/docs/guides/auth)). It integrates tightly with Postgres **Row Level Security (RLS)**, letting you express rules like “users only see their own rows” directly in SQL. You can treat Supabase Auth as a dedicated identity provider, or combine it with TurboStarter’s existing auth patterns and user tables.

### Auto‑generated APIs

Out of the box, Supabase can expose your tables via **auto‑generated REST and GraphQL APIs** ([API guides](https://supabase.com/docs/guides/api)). As you evolve your schema, these APIs update automatically, which is great for rapid prototyping or internal tools. In a TurboStarter project you can either lean on these generated APIs, or keep using your own `@workspace/api` routes and use Supabase strictly as your database and storage layer.

### Storage for files and media

Supabase Storage gives you **S3‑compatible object storage** that is aware of your Postgres auth rules ([storage docs](https://supabase.com/docs/guides/storage)). You can group files into buckets (avatars, documents, videos), secure them with RLS, and serve them through a CDN. Because TurboStarter already expects an S3‑style interface, plugging in Supabase Storage is mostly a matter of setting `S3_ENDPOINT`, bucket name, and access keys in `.env.local`.

### Realtime powered by Postgres

Supabase Realtime listens to **Postgres replication** and streams inserts, updates, and deletes over websockets ([realtime docs](https://supabase.com/docs/guides/realtime)). Instead of polling, your apps can subscribe to table changes or custom channels and update UI instantly – ideal for dashboards, activity feeds, or collaborative experiences. With TurboStarter, you can enable Realtime on top of the same tables you manage via `@workspace/db`, without introducing a second realtime system.

### Edge Functions and Cron

Supabase Edge Functions let you run **serverless Deno functions** close to your database and users ([functions quickstart](https://supabase.com/docs/guides/functions/quickstart)). They’re perfect for webhooks, custom business logic, or tasks that don’t belong in your frontend. Combined with [Cron](https://supabase.com/modules/cron) and `pg_cron`, you can schedule recurring jobs – for example nightly cleanups, report generation, or billing checks – all deployed alongside your database and accessible from your TurboStarter apps.

### Vector and AI‑ready Postgres

With the [pgvector](https://github.com/pgvector/pgvector) extension and Supabase’s [Vector](https://supabase.com/docs/guides/ai) tooling, you can store embeddings directly in Postgres and run similarity search queries. That means you can build AI‑powered features – recommendations, semantic search, RAG pipelines – without standing up a separate vector database. TurboStarter’s schema and migrations can define vector columns like any other field, so AI features live in the same repository and workflows as the rest of your data model.

### Supabase Studio and CLI

Finally, Supabase includes **Supabase Studio**, a browser‑based dashboard for browsing tables, editing data, running SQL, inspecting logs, and managing auth, storage, and functions ([architecture docs](https://supabase.com/docs/guides/getting-started/architecture)). The **Supabase CLI** complements this with local development, migrations, and function deployment commands. Together they give your TurboStarter team a single pane of glass for everything running in your Supabase project.

## Prerequisites

Before you start, make sure you have:

| Requirement              | Details                                                                                                                                  |
| ------------------------ | ---------------------------------------------------------------------------------------------------------------------------------------- |
| **TurboStarter project** | Cloned locally with dependencies installed (you can use our [CLI](https://www.turbostarter.dev/docs/web/cli) to create a new project in seconds).                    |
| **Supabase account**     | Create one at [supabase.com](https://supabase.com/sign-up) and spin up a project.                                                        |
| **Tooling**              | [`pnpm`](https://pnpm.io/) and [Node.js](https://nodejs.org/en) installed (see [development setup](https://www.turbostarter.dev/docs/web/installation/development)). |

If you’re already familiar with our core database docs:

* [Database overview](https://www.turbostarter.dev/docs/web/database/overview)
* [Migrations](https://www.turbostarter.dev/docs/web/database/migrations)
* [Database client](https://www.turbostarter.dev/docs/web/database/client)

…you’re in a perfect place to connect TurboStarter to Supabase.

## Connect TurboStarter to Supabase in 5 minutes

Let’s go step‑by‑step through wiring a fresh TurboStarter monorepo to a new Supabase project. This is based closely on the official [Supabase recipe](https://www.turbostarter.dev/docs/web/recipes/supabase), adapted for a blog format and SEO.

<Steps>
  <Step>
    ## Create a new Supabase project

    1. Go to the [Supabase dashboard](https://supabase.com).
    2. Create a **new project** (choose a strong database password and a region close to your users).
    3. Supabase will automatically provision a **PostgreSQL database** for you.

    ![Create a new Supabase project](https://www.turbostarter.dev/images/docs/web/recipes/supabase/create-project.png)

    Optionally, you can customize the **Security options** by choosing the **Only Connection String** option – it opts out of autogenerating APIs for tables inside your database. It’s not required for TurboStarter, but you can still leverage Supabase’s generated APIs for your own use‑cases if you want.

    ![Security options](https://www.turbostarter.dev/images/docs/web/recipes/supabase/security-options.png)

    Once the project is ready, you’re ready to grab the connection string.
  </Step>

  <Step>
    ## Get the database connection string

    In the Supabase dashboard:

    1. Open your project.
    2. Click on the **Connect** button at the top.
    3. Locate the **connection string** for your chosen ORM (under the **ORMs** tab).

    ![Connect application](https://www.turbostarter.dev/images/docs/web/recipes/supabase/connect-app.png)

    Copy this value – you’ll use it as your `DATABASE_URL`.

    <Callout title="Replace password placeholder" type="warn">
      In your Supabase connection string, you’ll see a placeholder like `[YOUR-PASSWORD]`. Make sure to replace this with the **actual password** you set when creating your Supabase project.
    </Callout>
  </Step>

  <Step>
    ## Configure TurboStarter to use Supabase Postgres

    TurboStarter reads database connection settings from the **root** `.env.local` file and uses them inside the `@workspace/db` package. That means once you point `DATABASE_URL` at Supabase, **all apps that rely on `@workspace/db` (web, mobile backends, extension backends) will automatically talk to Supabase Postgres**.

    Create (or update) the `.env.local` file in the **monorepo root**:

    ```dotenv title=".env.local"
    DATABASE_URL="postgres://postgres.[YOUR-PROJECT-REF]:[YOUR-PASSWORD]@aws-0-[aws-region].pooler.supabase.com:6543/postgres?pgbouncer=true&connection_limit=1"
    ```

    Replace:

    * `YOUR-PROJECT-REF` with your Supabase project ref.
    * `YOUR-PASSWORD` with the database password you set when creating the project.
    * `aws-region` with the region shown in the Supabase connection string.

    <Callout>
      This `DATABASE_URL` is validated in the `@workspace/db` package and used to create the [Drizzle](https://orm.drizzle.team/) client for your database. You stay in full control of your schema and migrations while letting Supabase handle **hosting, backups, and performance**.
    </Callout>

    For more background on how `DATABASE_URL` is used under the hood, see the [Database overview](https://www.turbostarter.dev/docs/web/database/overview).
  </Step>

  <Step>
    ## Apply the TurboStarter schema to Supabase

    With `DATABASE_URL` now pointing to Supabase, you can apply the existing TurboStarter schema to your Supabase database.

    From the monorepo root, run:

    ```bash
    pnpm with-env pnpm --filter @workspace/db db:migrate
    ```

    This will:

    * Use your Supabase `DATABASE_URL` from `.env.local`.
    * Run all pending SQL migrations from `packages/db/migrations`.
    * Create the full TurboStarter schema (users, billing, demo tables, etc.) in Supabase.

    If you’re actively iterating on the schema, you can generate new migrations and apply them as described in [Migrations](https://www.turbostarter.dev/docs/web/database/migrations).

    <Callout title="Seeding your database" type="info">
      After running your migrations, you may want to seed your database with initial data (such as demo users or organizations). You can do this by running:

      ```bash
      pnpm with-env pnpm turbo db:seed
      ```

      This will populate your Supabase Postgres database with example data you can use to explore TurboStarter’s features across web, mobile, and extensions.
    </Callout>
  </Step>

  <Step>
    ## Use Supabase Storage as S3‑compatible storage

    TurboStarter’s storage layer is designed to work seamlessly with **any S3‑compatible provider**. Supabase Storage provides a simple, S3‑compatible API and is a great choice if you’re already using Supabase for your database.

    ### Create a storage bucket

    1. In the Supabase dashboard, go to **Storage → Buckets**.
    2. Click **Create bucket** (name it whatever you want, for example `avatars` or `uploads`).
    3. Adjust settings based on your needs (e.g. max file size, allowed file types).

    ![Create a new bucket](https://www.turbostarter.dev/images/docs/web/recipes/supabase/create-bucket.png)

    You can create multiple buckets (for documents, images, videos, etc.) if needed.

    ### Generate S3 access keys in Supabase dashboard

    1. Go to **Storage → S3 → Access keys**.
    2. Click **New access key**.
    3. Give it a descriptive name and create the key.
    4. Copy the **Access key ID** and **Secret access key** to use in your application.

    ![Generate S3 access keys](https://www.turbostarter.dev/images/docs/web/recipes/supabase/s3-keys.png)

    ### Configure S3 environment variables for Supabase Storage

    In your web application’s `.env.local`, add (or update) the S3 configuration used by TurboStarter’s storage layer:

    ```dotenv title=".env.local"
    S3_REGION="us-east-1"
    S3_BUCKET="avatars"
    S3_ENDPOINT="https://[YOUR-PROJECT-REF].supabase.co/storage/v1/s3"
    S3_ACCESS_KEY_ID="your-access-key-id"
    S3_SECRET_ACCESS_KEY="your-secret-access-key"
    ```

    These variables integrate directly with the storage configuration described in:

    * [Storage overview](https://www.turbostarter.dev/docs/web/storage/overview)
    * [Storage configuration](https://www.turbostarter.dev/docs/web/storage/configuration)

    Once set, existing TurboStarter file upload flows (e.g. user avatars, organization logos) will use **Supabase Storage via presigned URLs** – no extra code changes required.
  </Step>

  <Step>
    ## Run your API on Supabase Edge Functions

    TurboStarter uses [Hono](https://hono.dev) as an API server. If you want, you can deploy it as a **Supabase Edge Function** so it runs close to your users and your Supabase Postgres database.

    At a high level:

    1. Install the [Supabase CLI](https://supabase.com/docs/guides/cli) and initialize a Supabase project locally with `supabase init`.
    2. Create a new [Edge Function](https://supabase.com/docs/guides/functions/quickstart) (for example `hono-backend`) with:

    ```bash
    supabase functions new hono-backend
    ```

    3. Inside the generated function (for example `supabase/functions/hono-backend/index.ts`), set up a basic Hono app and export it via `Deno.serve(app.fetch)`:

    ```ts
    import { Hono } from "jsr:@hono/hono";

    // change this to your function name
    const functionName = "hono-backend";
    const app = new Hono().basePath(`/${functionName}`);

    app.get("/hello", (c) => c.text("Hello from hono-server!"));

    Deno.serve(app.fetch);
    ```

    4. Run the function locally with `supabase start` and `supabase functions serve --no-verify-jwt`, then call it from your TurboStarter app using the local or deployed function URL.
    5. When you’re ready, deploy the function with `supabase functions deploy` (or `supabase functions deploy hono-backend`) and manage it using the Supabase dashboard, as described in the [Supabase Edge Functions docs](https://supabase.com/docs/guides/functions).

    This is entirely optional, but it’s a great fit for **lightweight APIs, webhooks, and other serverless logic** you want to run alongside your Supabase project.
  </Step>

  <Step>
    ## Explore additional Supabase features (without rewriting your app)

    Once your TurboStarter project is backed by Supabase Postgres and Storage, you can gradually add more Supabase features as your app grows.

    Some features that fit especially well with TurboStarter’s design:

    * [**Realtime**](https://supabase.com/docs/guides/realtime) – built on [Postgres replication](https://www.postgresql.org/docs/current/runtime-config-replication.html), so you can stream changes from your existing TurboStarter tables (inserts, updates, deletes) into live UIs without changing how you manage schema or RLS. You still define tables and policies via `@workspace/db`, and opt into Realtime on top.
    * [**Vector**](https://supabase.com/docs/guides/ai) – powered by the [pgvector](https://github.com/pgvector/pgvector) extension and stored in regular Postgres tables, making it easy to integrate semantic search or AI features while keeping everything in the same migrations and Drizzle models you already use in TurboStarter. We’re using it extensively in our dedicated [AI Kit](https://www.turbostarter.dev/ai).
    * [**Cron**](https://supabase.com/modules/cron) – lets you schedule background jobs and periodic tasks with [pg_cron](https://github.com/citusdata/pg_cron), perfect for scheduled cleanups, report generation, or recurring workflows.

    Because these features are layered on top of Postgres, you manage them through the **same TurboStarter migrations and db package** – no separate database, no duplicated schema.
  </Step>
</Steps>

## Optional: talk directly to Supabase from your apps

Everything above works with TurboStarter’s existing database abstractions – you don’t have to add any Supabase SDKs to ship a production‑ready app backed by Supabase.

If you **do** want to integrate Supabase more deeply, you have options:

* Call Supabase **REST** endpoints from your Next.js, React Native, or extension frontends.
* Use the official **JavaScript client** in places where it makes sense (for example, for auth or realtime in a specific app).

Here’s a minimal example of the kind of query you might run once a client is configured (see the Supabase docs for full setup details):

```ts
// Example shape only – not part of TurboStarter's core setup
const { data, error } = await supabase.from("todos").select("*");
```

Or, for a simple REST call:

```ts
await fetch(`${process.env.NEXT_PUBLIC_SUPABASE_URL}/rest/v1/todos`, {
  headers: {
    apikey: process.env.NEXT_PUBLIC_SUPABASE_ANON_KEY!,
  },
});
```

These are **optional enhancements** on top of the core “Drizzle + Supabase Postgres” architecture described above.

## Production best practices for Supabase + TurboStarter

To get a **production‑grade** setup, keep these points in mind:

* **Environment variables**:
  * Keep secrets (service role keys, database passwords) outside of the client bundle.
  * Use `.env.local` in development and environment variables in your hosting provider for production.
* **Row Level Security**:
  * Turn on RLS for user‑facing tables.
  * Start from Supabase’s [RLS examples](https://supabase.com/docs/guides/auth/row-level-security) and adapt them to your TurboStarter schema.
* **Connection pooling**:
  * Supabase’s connection strings can include `pgbouncer` and `connection_limit` defaults.
  * This is important when you run TurboStarter across multiple server instances or edge regions.
* **Monitoring and logs**:
  * Use Supabase’s dashboard to monitor slow queries, function errors, and auth issues.
  * Pair it with your TurboStarter logging/observability setup for a complete view of your system.

The combination of Supabase’s platform tools and TurboStarter’s structure lets you move from prototype to production without rewriting your backend – and if you ever start a new project, you can spin it up in seconds with [TurboStarter](https://www.turbostarter.dev) and reuse the same patterns.

## Deploy your Supabase‑powered TurboStarter stack

Once your stack is integrated, deployment is straightforward:

* Use our guide on [self‑hosting your Next.js Turborepo app with Docker in 5 minutes](https://www.turbostarter.dev/blog/self-host-your-nextjs-turborepo-app-with-docker-in-5-minutes).
* Pair it with Supabase’s managed Postgres and Storage for a **fully managed backend**.
* Optimize builds with [Turbopack](https://www.turbostarter.dev/blog/turbopack-ultimate-guide-to-next-gen-webpack-bundler-replacement) and our [advanced Turbo CLI techniques](https://www.turbostarter.dev/blog/10-advanced-turbo-cli-techniques-to-boost-your-development-workflow).

You now have a **modern, scalable, Supabase‑backed TurboStarter app** that runs across web, mobile, and extensions with a single source of truth. Explore more patterns in the [Supabase docs](https://supabase.com/docs) and our own [TurboStarter documentation](https://www.turbostarter.dev/docs/web) to keep leveling up your stack – or start your next idea with [TurboStarter](https://www.turbostarter.dev) and reuse everything you learned here.


More posts: [blog](https://www.turbostarter.dev/blog.md)
