# Supabase Client Libraries

Supabase client for Nuxt.js

## Files

- `lib/`
  - `supabase/`
    - `client.ts`
- `server/`
  - `api/`
    - `profile.get.ts`
  - `middleware/`
    - `is-authenticated.ts`
  - `supabase/`
    - `client.ts`

Full source: https://supabase.com/library/r/supabase-client-nuxtjs.json

## Installation

If your project already has a Supabase client, reuse it instead of running this command. Otherwise, install the client and configure the environment variables below.

Install this block:

```bash
npx shadcn-vue@latest add https://supabase.com/library/r/supabase-client-nuxtjs.json
```

## Usage

This block installs a Supabase client for connecting your Nuxt.js project to Supabase. It's designed to fully supports server-side rendering (SSR).

If you've already set up your Supabase client—either using the `npm create nuxt@latest` template or another method—you can continue using your existing setup.

### Getting started

After installing the block, you'll have the following environment variables in your `.env.local` file:

```env
NUXT_PUBLIC_SUPABASE_URL=
NUXT_PUBLIC_SUPABASE_PUBLISHABLE_KEY=
```

- If you're using supabase.com, you can find these values in the [Connect modal](https://supabase.com/dashboard/project/_?showConnect=true\&connectTab=frameworks\&framework=nuxt\&using=supabasejs) under App Frameworks or in your project's [API keys](https://supabase.com/dashboard/project/_/settings/api-keys).

- If you're using a local instance of Supabase, you can find these values by running `supabase start` or `supabase status` (if you already have it running).

- Nuxt recommends [NuxtSupabase](https://supabase.nuxtjs.org/) module to integrate Nuxt application with Supabase. It’s an alternative to this approach, but both approaches are fine.

Warning: This Supabase client is built for SSR with the Nuxt.js. If you're building a Vue SPA, use the [Vue
SPA client](https://supabase.com/library/docs/vue/client.md) instead.

## Further reading

- [Use Supabase with Nuxt](https://supabase.com/docs/guides/getting-started/quickstarts/nuxtjs)
- [Build a User Management App with Nuxt 3](https://supabase.com/docs/guides/getting-started/tutorials/with-nuxt-3)
