diff --git a/.github/workflows/deploy_vercel_prod.yml b/.github/workflows/deploy_vercel_prod.yml
deleted file mode 100644
index dceb61fbcde..00000000000
--- a/.github/workflows/deploy_vercel_prod.yml
+++ /dev/null
@@ -1,27 +0,0 @@
-name: Deploy studio app to production on vercel
-on:
- push:
- branches:
- - studio
- paths:
- - 'studio/**'
-jobs:
- deploy:
- runs-on: ubuntu-18.04
- timeout-minutes: 10
-
- steps:
- - uses: actions/checkout@v2
- # remove ./studio/pages/api folder before deploying to vercel
- - uses: JesseTG/rm@v1.0.2
- with:
- path: ./studio/pages/api
- - uses: amondnet/vercel-action@v19
- with:
- vercel-token: ${{ secrets.VERCEL_TOKEN }} # Required
- github-comment: false
- vercel-args: '--prod -A .vercel/production.json'
- vercel-org-id: team_E6KJ1W561hMTjon1QSwOh0WO #Required
- vercel-project-id: Qmd7Mw8yFW8SbtvTWFV9uyRzw9P1rJLmgtHjSezywhtYec #Required
- working-directory: ./studio #Your Working Directory, Optional
- vercel-project-name: app
diff --git a/.github/workflows/deploy_vercel_staging.yml b/.github/workflows/deploy_vercel_staging.yml
deleted file mode 100644
index d6bb3760187..00000000000
--- a/.github/workflows/deploy_vercel_staging.yml
+++ /dev/null
@@ -1,27 +0,0 @@
-name: Deploy studio app to staging on vercel
-on:
- push:
- branches:
- - master
- paths:
- - 'studio/**'
-jobs:
- deploy:
- runs-on: ubuntu-18.04
- timeout-minutes: 10
-
- steps:
- - uses: actions/checkout@v2
- # remove ./studio/pages/api folder before deploying to vercel
- - uses: JesseTG/rm@v1.0.2
- with:
- path: ./studio/pages/api
- - uses: amondnet/vercel-action@v19
- with:
- vercel-token: ${{ secrets.VERCEL_TOKEN }} # Required
- github-comment: false
- vercel-args: '--prod -A .vercel/staging.json'
- vercel-org-id: team_E6KJ1W561hMTjon1QSwOh0WO #Required
- vercel-project-id: QmcmhbiAtCMFTAHCuGgQscNbke4TzgWULECctNcKmxWCoT #Required
- working-directory: ./studio #Your Working Directory, Optional
- vercel-project-name: staging-app
diff --git a/.github/workflows/studio-build.yml b/.github/workflows/studio-build.yml
index b51253bbf04..570baa1aa61 100644
--- a/.github/workflows/studio-build.yml
+++ b/.github/workflows/studio-build.yml
@@ -9,7 +9,6 @@ on:
- 'studio/**'
jobs:
build:
-
runs-on: ubuntu-latest
strategy:
@@ -18,15 +17,15 @@ jobs:
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/
steps:
- - uses: actions/checkout@v2
- - name: Use Node.js ${{ matrix.node-version }}
- uses: actions/setup-node@v2
- with:
- node-version: ${{ matrix.node-version }}
- cache: 'npm'
- - name: Install deps
- run: npm i
- working-directory: ./studio
- - name: Run build
- run: npm run build
- working-directory: ./studio
+ - uses: actions/checkout@v2
+ - name: Use Node.js ${{ matrix.node-version }}
+ uses: actions/setup-node@v2
+ with:
+ node-version: ${{ matrix.node-version }}
+ cache: 'npm'
+ - name: Install deps
+ run: npm ci
+ working-directory: ./
+ - name: Run build
+ run: npx turbo run build --filter=studio
+ working-directory: ./
diff --git a/apps/reference/_cli/intro.mdx b/apps/reference/_cli/intro.mdx
index 1615aa7ae28..8ac2186ca6e 100644
--- a/apps/reference/_cli/intro.mdx
+++ b/apps/reference/_cli/intro.mdx
@@ -16,6 +16,9 @@ The CLI is still under development, but it contains all the functionality for wo
- CI/CD for releasing to production: [`supabase db push`](https://supabase.com/docs/reference/cli/usage#supabase-db-push)
- Manage your Supabase projects: [`supabase projects`](https://supabase.com/docs/reference/cli/usage#supabase-projects)
- Generate types directly from your database schema: [`supabase gen types`](https://supabase.com/docs/reference/cli/usage#supabase-gen)
+ - A [community-supported GitHub Action](https://github.com/lyqht/generate-supabase-db-types-github-action) to generate TypeScript types
+- Shell autocomplete: [`supabase completion`](https://supabase.com/docs/reference/cli/usage#supabase-completion)
+ - A [community-supported Fig autocomplete spec](https://fig.io/manual/supabase) for macOS terminal
## Additional Links
diff --git a/apps/reference/docs/architecture.mdx b/apps/reference/docs/architecture.mdx
index f969f70fa33..235460308c4 100755
--- a/apps/reference/docs/architecture.mdx
+++ b/apps/reference/docs/architecture.mdx
@@ -2,38 +2,155 @@
id: architecture
title: Architecture
description: 'Supabase design and architecture'
-# hide_table_of_contents: true
---
-Supabase is open source. Wherever possible, we use and support existing tools rather than developing from scratch.
-We choose open source tools which are scalable and we make them simple to use.
+Supabase is open source. We choose open source tools which are scalable and make them simple to use.
+
+Supabase is not a 1-to-1 mapping of Firebase. While we are building many of the features that Firebase offers, we are not going about it the same way:
+our technological choices are quite different; everything we use is open source; and wherever possible, we use and support existing tools rather than developing from scratch.
+
+Most notably, we use Postgres rather than a NoSQL store. This choice was deliberate. We believe that no other database offers the functionality required to compete with Firebase,
+while maintaining the scalability required to go beyond it.
+
+## Architecture
+
+Each Supabase project consists of several tools:

-Supabase is not a 1-to-1 mapping of Firebase. While we are building many of the features that Firebase offers, we are not going about it the same way.
+### PostgreSQL (Database)
-Our technological choices are quite different from Firebase. Everything we use is open source. Wherever possible, we use and support existing tools rather than developing from scratch.
+PostgreSQL is the core of Supabase. We do not abstract the PostgreSQL database — you can access it and use it with full privileges. We simply provide tools which makes PostgreSQL as easy to use as Firebase.
-Most notably, we use Postgres rather than a NoSQL store. This choice was deliberate. We believe that no other database offers the scalability and functionality required to compete with Firebase.
+- Official Docs: [postgresql.org/docs](https://www.postgresql.org/docs/current/index.html)
+- Source code: [github.com/postgres/postgres](https://github.com/postgres/postgres) (mirror)
+- License: [PostgreSQL Licence](https://www.postgresql.org/about/licence/)
+- Language: C
-## Feature Status
+### Studio (Dashboard)
-| Product | Feature | Stage | Docs |
-| -------------------------- | ---------------------- | ----- | ------------------------------------------------ |
-| Database | Postgres | GA | [Link](/docs/guides/database) |
-| Database | Webhooks | Alpha | |
-| Database | Point in time Recovery | Alpha | |
-| Realtime | Postgres CDC | Beta | [Link](/docs/guides/realtime/postgres-cdc) |
-| Realtime | Broadcast | Alpha | [Link](/docs/guides/realtime#broadcast) |
-| Realtime | Presence | Alpha | [Link](/docs/guides/realtime#presence) |
-| Storage | | Beta | [Link](/docs/guides/storage) |
-| Storage | CDN | Beta | [Link](/docs/guides/storage-cdn) |
-| Edge Functions | | Beta | [Link](/docs/guides/functions) |
-| Auth | OAuth Providers | Beta | [Link](/docs/guides/auth/auth-apple) |
-| Auth | Passwordless | Beta | [Link](/guides/auth/auth-magic-link) |
-| Auth | Next.js Auth Helpers | Alpha | [Link](/docs/guides/auth/auth-helpers/nextjs) |
-| Auth | SvelteKit Auth Helpers | Alpha | [Link](/docs/guides/auth/auth-helpers/sveltekit) |
-| Public API | | Beta | [Link](/docs/reference/api) |
-| CLI | | Beta | [Link](/docs/guides/cli) |
-| Client Library: JavaScript | | GA | [Link](/docs/reference/javascript) |
-| Client Library: Dart | | Beta | [Link](/docs/reference/dart) |
+An open source Dashboard for managing your database and services.
+
+- Official Docs: [Supabase docs](/docs)
+- Source code: [github.com/supabase/supabase](https://github.com/supabase/supabase/tree/master/studio)
+- License: [Apache 2](https://github.com/supabase/supabase/blob/master/LICENSE)
+- Language: TypeScript
+
+### GoTrue (Auth)
+
+A JWT-based API for managing users and issuing access tokens. This integrates with PostgreSQL's Row Level Security and the API servers.
+
+- Official Docs: [Supabase Auth reference docs](/docs/reference/auth)
+- Source code: [github.com/supabase/gotrue](https://github.com/supabase/gotrue)
+- License: [MIT](https://github.com/supabase/gotrue/blob/master/LICENSE)
+- Language: Go
+
+### PostgREST (API)
+
+A standalone web server that turns your PostgreSQL database directly into a RESTful API.
+We use this with our [pg_graphql](https://github.com/supabase/pg_graphql) extension to provide a GraphQL API.
+
+- Official Docs: [postgrest.org](https://postgrest.org/)
+- Source code: [github.com/PostgREST/postgrest](https://github.com/PostgREST/postgrest)
+- License: [MIT](https://github.com/PostgREST/postgrest/blob/main/LICENSE)
+- Language: Haskel
+
+### Realtime (API & multiplayer)
+
+A scalable websocket engine for managing user Presence, broadcasting messages, and streaming database changes.
+
+- Official Docs: [Supabase Realtime docs](/docs/guides/realtime)
+- Source code: [github.com/supabase/realtime](https://github.com/supabase/realtime)
+- License: [Apache 2](https://github.com/supabase/realtime/blob/master/LICENSE)
+- Language: Elixir
+
+### Storage API (large file storage)
+
+An S3-compatible object storage service that stores metadata in Postgres.
+
+- Official Docs: [Supabase Storage reference docs](/docs/reference/storage)
+- Source code: [github.com/supabase/storage-api](https://github.com/supabase/storage-api)
+- License: [Apache 2.0](https://github.com/supabase/storage-api/blob/master/LICENSE)
+- Language: NodeJS / TypeScript
+
+### Deno (Edge Functions)
+
+A modern runtime for JavaScript and TypeScript.
+
+- Official Docs: [deno.land](https://deno.land/)
+- Source code: [github.com/denoland/deno](https://github.com/denoland/deno)
+- License: [MIT](https://github.com/denoland/deno/blob/main/LICENSE.md)
+- Language: TypeScript / Rust
+
+### postgres-meta (Database management)
+
+A RESTful API for managing your Postgres. Fetch tables, add roles, and run queries.
+
+- Official Docs: [supabase.github.io/postgres-meta](https://supabase.github.io/postgres-meta/)
+- Source code: [github.com/supabase/postgres-meta](https://github.com/supabase/postgres-meta)
+- License: [Apache 2.0](https://github.com/supabase/postgres-meta/blob/master/LICENSE)
+- Language: NodeJS / TypeScript
+
+### PgBouncer
+
+A lightweight connection pooler for PostgreSQL. This is useful for connecting to Postgres when using Serverless functions.
+
+- Official Docs: [pgbouncer.org](http://www.pgbouncer.org/)
+- Source code: [pgbouncer/pgbouncer](https://github.com/pgbouncer/pgbouncer)
+- License: [ISC](https://github.com/pgbouncer/pgbouncer/blob/master/COPYRIGHT)
+- Language: C
+
+### Kong (API Gateway)
+
+A cloud-native API gateway, built on top of Nginx.
+
+- Official Docs: [docs.konghq.com](https://docs.konghq.com/)
+- Source code: [github.com/kong/kong](https://github.com/kong/kong)
+- License: [Apache 2.0](https://github.com/Kong/kong/blob/master/LICENSE)
+- Language: Lua
+
+## Product Principles
+
+It is our goal to provide an architecture that any large-scale company would design for themselves,
+and then provide tooling around that architecture that is easy-to-use for indie-developers and small teams.
+
+We use a series of principles to ensure that scalability and usability are never mutually exclusive:
+
+### Everything works in isolation
+
+Each system must work as a standalone tool with as few moving parts as possible.
+The litmus test for this is: "Can a user run this product with nothing but a Postgres database?"
+
+### Everything is integrated
+
+Supabase is composable. Even though every product works in isolation, each product on the platform needs to 10x the other products.
+For integration, each tool should expose an API and Webhooks.
+
+### Everything is extensible
+
+We're deliberate about adding a new tool, and prefer instead to extend an existing one.
+This is the opposite of many cloud providers whose product offering expands into niche use-cases. We provide _primitives_ for developers, which allow them to achieve any goal.
+Less, but better.
+
+### Everything is portable
+
+To avoid lock-in, we make it easy to migrate in and out. Our cloud offering is compatible with our self-hosted product.
+We use existing standards to increase portability (like pg_dump an CSV files). If a new standard emerges which competes with a "Supabase" approach, we will deprecate the approach in favor of the standard.
+This forces us compete on experience. We aim to be the best Postgres hosting service.
+
+### Play the long game
+
+We sacrifice short-term wins for long-term gains. For example, it is tempting to run a fork of Postgres with additional functionality which only our customers need.
+Instead, we prefer to support efforts to upstream missing functionality so that the entire community benefits. This has the additional benefit of ensuring portability and longevity.
+
+### Build for developers
+
+"Developers" are a specific profile of user: they are _builders_.
+When assessing impact as a function of effort, developers have a large efficiency due to the type of products and systems they can build.
+As the profile of a developer changes over time, Supabase will continue to evolve the product to fit this evolving profile.
+
+### Support existing tools
+
+Supabase supports existing tools and communities wherever possible. Supabase is more like a "community of communities" - each tool typically has its own community
+which we work with.
+Open source is something we approach [collaboratively](https://supabase.com/blog/supabase-series-b#giving-back): we employ maintainers, sponsor projects, invest in businesses, and develop our own open source tools.
diff --git a/apps/reference/docs/guides/auth/auth-azure.mdx b/apps/reference/docs/guides/auth/auth-azure.mdx
index 93d1a6c11c6..6475d9d8470 100644
--- a/apps/reference/docs/guides/auth/auth-azure.mdx
+++ b/apps/reference/docs/guides/auth/auth-azure.mdx
@@ -65,6 +65,10 @@ This will allow your users to use your custom Azure login page when logging in.
## Add login code to your client app
+:::tip
+Supabase Auth requires that Azure returns a valid email address. Therefore you must request the `email` scope in the `signIn` method above.
+:::
+
When your user signs in, call [signInWithOAuth()](/docs/reference/javascript/auth-signinwithoauth) with `azure` as the `provider`:
```js
diff --git a/apps/reference/docs/guides/auth/auth-helpers/nextjs.mdx b/apps/reference/docs/guides/auth/auth-helpers/nextjs.mdx
index f17a9fe926e..700a1a75765 100644
--- a/apps/reference/docs/guides/auth/auth-helpers/nextjs.mdx
+++ b/apps/reference/docs/guides/auth/auth-helpers/nextjs.mdx
@@ -31,7 +31,8 @@ This library supports the following tooling versions:
- Node.js: `^10.13.0 || >=12.0.0`
- Next.js: `>=10`
-Optionally, install **React Auth Helpers** for components and hooks that can be used across all React-based frameworks.
+Additionally, install the **React Auth Helpers** for components and hooks that can be used across all React-based frameworks.
+
```sh
npm install @supabase/auth-helpers-react
```
@@ -48,7 +49,7 @@ This library supports the following tooling versions:
- Node.js: `^10.13.0 || >=12.0.0`
- Next.js: `>=10`
-Optionally, install **React Auth Helpers** for components and hooks that can be used across all React-based frameworks.
+Additionally, install the **React Auth Helpers** for components and hooks that can be used across all React-based frameworks.
```sh
yarn add @supabase/auth-helpers-react
@@ -61,23 +62,30 @@ yarn add @supabase/auth-helpers-react
Retrieve your project URL and anon key in your project's [API settings](https://app.supabase.com/project/_/settings/api) in the Dashboard to set up the following environment variables. For local development you can set them in a `.env.local` file. See an [example](https://github.com/supabase/auth-helpers/blob/main/examples/nextjs/.env.local.example).
-```bash
-NEXT_PUBLIC_SUPABASE_URL=https://your-project.supabase.co
-NEXT_PUBLIC_SUPABASE_ANON_KEY=your-anon-key
+```bash title=".env.local"
+NEXT_PUBLIC_SUPABASE_URL=YOUR_SUPABASE_URL
+NEXT_PUBLIC_SUPABASE_ANON_KEY=YOUR_SUPABASE_ANON_KEY
```
## Basic Setup
+
+
+
Wrap your `pages/_app.js` component with the `SessionContextProvider` component:
```jsx title="pages/_app.js"
-import React from 'react'
-import { useRouter } from 'next/router'
import { createBrowserSupabaseClient } from '@supabase/auth-helpers-nextjs'
import { SessionContextProvider } from '@supabase/auth-helpers-react'
-function MyApp({ Component, pageProps }: AppProps) {
+function MyApp({ Component, pageProps }) {
const router = useRouter()
+ // Create a new supabase browser client on every first render.
const [supabaseClient] = useState(() => createBrowserSupabaseClient())
return (
@@ -85,58 +93,105 @@ function MyApp({ Component, pageProps }: AppProps) {
supabaseClient={supabaseClient}
initialSession={pageProps.initialSession}
>
-
-
)
}
```
+
+
+
+Wrap your `pages/_app.tsx` component with the `SessionContextProvider` component:
+
+```jsx title="pages/_app.tsx"
+import { createBrowserSupabaseClient } from '@supabase/auth-helpers-nextjs'
+// highlight-next-line
+import { SessionContextProvider, Session } from '@supabase/auth-helpers-react'
+
+function MyApp({
+ Component,
+ pageProps,
+}: AppProps<{
+ // highlight-next-line
+ initialSession: Session,
+}>) {
+ // Create a new supabase browser client on every first render.
+ const [supabaseClient] = useState(() => createBrowserSupabaseClient())
+
+ return (
+
+
+
+ )
+}
+```
+
+
+
+
You can now determine if a user is authenticated by checking that the `user` object returned by the `useUser()` hook is defined.
## Usage with TypeScript
You can pass types that were [generated with the Supabase CLI](/docs/reference/javascript/typescript-support#generating-types) to the Supabase Client to get enhanced type safety and auto completion:
-```js
-// Creating a new supabase client object:
-import { Database } from '../db_types';
+### Browser client
-const [supabaseClient] = useState(() =>
- createBrowserSupabaseClient()
- );
+```ts
+// Creating a new supabase client object:
+import { createBrowserSupabaseClient } from '@supabase/auth-helpers-nextjs'
+import { Database } from '../database.types'
+
+const supabaseClient = createBrowserSupabaseClient()
```
-```js
+```ts
// Retrieving a supabase client object from the SessionContext:
-import { useSupabaseClient } from '@supabase/auth-helpers-react';
-import { Database } from '../db_types';
+import { useSupabaseClient } from '@supabase/auth-helpers-react'
+import { Database } from '../database.types'
-const supabaseClient = useSupabaseClient();
+const supabaseClient = useSupabaseClient()
+```
+
+### Server client
+
+```ts
+// Creating a new supabase server client object (e.g. in API route):
+import type { NextApiRequest, NextApiResponse } from 'next'
+import type { Database } from 'types_db'
+
+export default async (req: NextApiRequest, res: NextApiResponse) => {
+ const supabaseServerClient = createServerSupabaseClient({
+ req,
+ res,
+ })
+ const {
+ data: { user },
+ } = await supabaseServerClient.auth.getUser()
+
+ res.status(200).json({ name: user?.name ?? '' })
+}
```
## Client-side data fetching with RLS
-For [row level security](https://supabase.com/docs/learn/auth-deep-dive/auth-row-level-security) to work properly when fetching data client-side, you need to make sure to use the `supabaseClient` from the `useSessionContext` hook and only run your query once the user is defined client-side in the `useUser()` hook:
+For [row level security](https://supabase.com/docs/learn/auth-deep-dive/auth-row-level-security) to work properly when fetching data client-side, you need to make sure to use the `supabaseClient` from the `useSupabaseClient` hook and only run your query once the user is defined client-side in the `useUser()` hook:
```js
import { Auth, ThemeSupa } from '@supabase/auth-ui-react'
-import { useUser, useSessionContext } from '@supabase/auth-helpers-react'
+import { useUser, useSupabaseClient } from '@supabase/auth-helpers-react'
import { useEffect, useState } from 'react'
const LoginPage = () => {
- const { isLoading, session, error, supabaseClient } = useSessionContext()
+ const supabaseClient = useSupabaseClient()
const user = useUser()
const [data, setData] = useState()
+ // highlight-start
useEffect(() => {
async function loadData() {
const { data } = await supabaseClient.from('test').select('*')
@@ -145,19 +200,17 @@ const LoginPage = () => {
// Only run query once user is logged in.
if (user) loadData()
}, [user])
+ // highlight-end
if (!user)
return (
- <>
- {error &&
{error.message}
}
-
- >
+
)
return (
@@ -174,7 +227,7 @@ const LoginPage = () => {
export default LoginPage
```
-### Server-side rendering (SSR) - withPageAuth
+## Server-side rendering (SSR) - withPageAuth
If you wrap your `getServerSideProps` with `withPageAuth` your props object will be augmented with the user object.
@@ -191,7 +244,7 @@ export const getServerSideProps = withPageAuth({ redirectTo: '/login' })
If there is no authenticated user, they will be redirect to your home page, unless you specify the `redirectTo` option.
You can pass in your own `getServerSideProps` method, the props returned from this will be merged with the
-user props. You can also access the user session data by calling `getUser` inside of this method, eg:
+user props. You can also access the user session data by calling `supabase.auth.getUser()` inside of this method, eg:
```js title="pages/protected-page.js"
import { withPageAuth } from '@supabase/auth-helpers-nextjs'
@@ -212,7 +265,7 @@ export const getServerSideProps = withPageAuth({
})
```
-### Server-side data fetching with RLS
+## Server-side data fetching with RLS
Both `withApiAuth` and `withPageAuth` return a supabase client that you can use to run [row level security](https://supabase.com/docs/learn/auth-deep-dive/auth-row-level-security) authenticated queries server-side:
@@ -245,44 +298,62 @@ export const getServerSideProps = withPageAuth({
})
```
-### Server-side data fetching to OAuth APIs using `provider_token`
+## Server-side data fetching to OAuth APIs using `provider_token`
When using third-party auth providers, sessions are initiated with an additional `provider_token` field which is persisted as an HTTPOnly cookie upon logging in to enabled usage on the server side. The `provider_token` can be used to make API requests to the OAuth provider's API endpoints on behalf of the logged-in user. In the following example, we fetch the user's full profile from the third-party API during SSR using their id and auth token:
```js
-import { User, withPageAuth, getUser } from '@supabase/auth-helpers-nextjs'
-
-interface Profile {
- /* ... */
-}
+import { User, withPageAuth } from '@supabase/auth-helpers-nextjs'
export default function ProtectedPage({
user,
- data,
+ allRepos,
}: {
user: User,
- profile: Profile,
+ allRepos: any,
}) {
- return
Protected content
+ return (
+ <>
+
Protected content for {user.email}
+
Data fetched with provider token:
+
{JSON.stringify(allRepos, null, 2)}
+
user:
+
{JSON.stringify(user, null, 2)}
+ >
+ )
}
export const getServerSideProps = withPageAuth({
redirectTo: '/',
- async getServerSideProps(ctx) {
- // Retrieve provider_token from cookies
- const provider_token = ctx.req.cookies['sb-provider-token']
- // Get logged in user's third-party id from metadata
- const { user } = await getUser(ctx)
- const userId = user?.user_metadata.provider_id
- const profile: Profile = await (
- await fetch(`https://api.example.com/users/${userId}`, {
- method: 'GET',
- headers: {
- Authorization: `Bearer ${provider_token}`,
- },
- })
+ async getServerSideProps(ctx, supabase) {
+ const {
+ data: { session },
+ error,
+ } = await supabase.auth.getSession()
+ if (error) {
+ throw error
+ }
+ if (!session) {
+ return { props: {} }
+ }
+
+ // Retrieve provider_token & logged in user's third-party id from metadata
+ const { provider_token, user } = session
+ const userId = user.user_metadata.user_name
+
+ const allRepos = await (
+ await fetch(
+ `https://api.github.com/search/repositories?q=user:${userId}`,
+ {
+ method: 'GET',
+ headers: {
+ Authorization: `token ${provider_token}`,
+ },
+ }
+ )
).json()
- return { props: { profile } }
+
+ return { props: { allRepos, user } }
},
})
```
@@ -355,6 +426,7 @@ export const config = {
```
- The `supabaseClient` and `supabaseServerClient` have been removed in favor of the `createBrowserSupabaseClient` and `createServerSupabaseClient` methods. This allows you to provide the CLI-generated types to the client:
+
```js
// client-side
import type { Database } from 'types_db';
@@ -373,12 +445,14 @@ export const config = {
res.status(200).json({ name: user?.name ?? '' })
}
```
+
- The `UserProvider` has been replaced by the `SessionContextProvider`. Make sure to wrap your `pages/_app.js` componenent with the `SessionContextProvider`. Then, throughout your application you can use the `useSessionContext` hook to get the `session` and the `useSupabaseClient` hook to get an authenticated `supabaseClient`.
- The `useUser` hook now returns the `user` object or `null`.
- Usage with TypeScript: You can pass types that were [generated with the Supabase CLI](/docs/reference/javascript/typescript-support#generating-types) to the Supabase Client to get enhanced type safety and auto completion:
+
```js
// Creating a new supabase client object:
- import { Database } from '../db_types';
+ import { Database } from '../database.types';
const [supabaseClient] = useState(() =>
createBrowserSupabaseClient()
@@ -388,7 +462,7 @@ export const config = {
```js
// Retrieving a supabase client object from the SessionContext:
import { useSupabaseClient } from '@supabase/auth-helpers-react';
- import { Database } from '../db_types';
+ import { Database } from '../database.types';
const supabaseClient = useSupabaseClient();
```
diff --git a/apps/reference/docs/guides/auth/auth-workos.mdx b/apps/reference/docs/guides/auth/auth-workos.mdx
index e7e9c932b8d..422666106ad 100644
--- a/apps/reference/docs/guides/auth/auth-workos.mdx
+++ b/apps/reference/docs/guides/auth/auth-workos.mdx
@@ -65,12 +65,14 @@ async function signInWithWorkOS() {
const { data, error } = await supabase.auth.signInWithOAuth(
{
provider: 'workos',
+ options: {
+ queryParams: {
+ connection: '',
+ organization: '',
+ }
+ }
},
- {
- connection: '',
- organization: '',
- }
)
}
```
diff --git a/apps/reference/docs/guides/auth/server-side-rendering.mdx b/apps/reference/docs/guides/auth/server-side-rendering.mdx
new file mode 100644
index 00000000000..1c1e3818b78
--- /dev/null
+++ b/apps/reference/docs/guides/auth/server-side-rendering.mdx
@@ -0,0 +1,202 @@
+---
+id: server-side-rendering
+title: Server-Side Rendering
+description: Render pages with user information on the server.
+---
+
+Single-page apps with server-side rendering (SSR) is a popular way to optimize rendering
+performance and leverage advanced caching strategies.
+
+Supabase Auth supports server-side rendering when you need access to user
+information, or your server needs to authorize API requests on behalf of your
+user to render content.
+
+When a user authenticates with Supabase Auth, two pieces of information are
+issued by the server:
+
+1. **Access token** in the form of a JWT.
+2. **Refresh token** which is a randomly generated string.
+
+Most Supabase projects have their auth server listening on
+`.supabase.co/auth/v1`, thus the access token and refresh token are
+set as `sb-access-token` and `sb-refresh-token` cookies on the
+`.supabase.co` domain.
+
+:::note
+These cookie names are for internal Supabase use only and may change without
+warning. They are included in this guide for illustration purposes only.
+:::
+
+Web browsers limit access to cookies across domains, consistent with the
+[Same-Origin Policy
+(SOP)](https://developer.mozilla.org/en-US/docs/Web/Security/Same-origin_policy).
+
+Your web application cannot access these cookies,
+nor will these cookies be sent to your application's server.
+
+## Understanding the authentication flow
+
+When you call one of the `signIn` methods, the client library running in the
+browser sends the request to the Supabase Auth server. The Auth server determines
+whether to verify a phone number, email and password combination, a Magic Link,
+or use a social login (if you have any setup in your project).
+
+Upon successful verification of the identity of the user, the Supabase Auth
+server redirects the user back to your single-page app.
+
+:::tip
+You can configure [redirects URLs](https://app.supabase.com/project/_/auth/settings) in the Supabase Dashboard. You can use wildcard match patterns
+like `*` and `**` to allow redirects to different forms of URLs.
+:::
+
+These redirect URLs have the following structure:
+
+```
+https://yourapp.com/...#access_token=<...>&refresh_token=<...>&...
+```
+
+The first access and refresh tokens after a successful verification are
+contained in the URL fragment (anything after the `#` sign) of the redirect
+location. This is intentional and not configurable.
+
+The client libraries are designed to listen for this type of URL, extract
+the access token, refresh token and some extra information from it, and finally
+persist it in local storage for further use by the library and your app.
+
+:::info
+Web browsers do not send the URL fragment to the server they're making the
+request to. Since you may not be hosting the single-page app on a server under
+your direct control (such as on GitHub Pages or other freemium hosting
+providers), we want to prevent hosting services from getting access to your
+user's authorization credentials by default. Even if the server is under your
+direct control, `GET` requests and their full URLs are often logged. This
+approach also avoids leaking credentials in request or access logs.
+:::
+
+## Bringing it together
+
+As seen from the authentication flow, the initial request after successful
+login made by the browser to your app's server after user login **does not
+contain any information about the user**. This is because first the client-side
+JavaScript library must run before it makes the access and refresh token
+available to your server.
+
+It is very important to make sure that the redirect route right after login
+works without any server-side rendering. Other routes requiring authorization
+do not have the same limitation, provided you send the access and refresh
+tokens to your server.
+
+This is traditionally done by setting cookies. Here's an example you
+can add to the root of your application:
+
+```typescript
+supabase.auth.onAuthStateChange((event, session) => {
+ if (event === "SIGNED_OUT" || event === "USER_DELETED") {
+ // delete cookies on sign out
+ const expires = new Date(0).toUTCString();
+ document.cookie = `my-access-token=; path=/; expires=${expires}; SameSite=Lax; secure`;
+ document.cookie = `my-refresh-token=; path=/; expires=${expires}; SameSite=Lax; secure`;
+ } else if (event === "SIGNED_IN" || event === "TOKEN_REFRESHED") {
+ const maxAge = 100 * 365 * 24 * 60 * 60; // 100 years, never expires
+ document.cookie = `my-access-token=${session.access_token}; path=/; max-age=${maxAge}; SameSite=Lax; secure`;
+ document.cookie = `my-refresh-token=${session.refresh_token}; path=/; max-age=${maxAge}; SameSite=Lax; secure`;
+ }
+})
+```
+
+This uses the standard
+[`document.cookie` API](https://developer.mozilla.org/en-US/docs/Web/API/Document/cookie)
+to set cookies on all paths of your app's domain. All subsequent requests
+made by the browser to your app's server include the `my-access-token` and
+`my-refresh-token` cookies (the names of the cookies and additional
+parameters can be changed).
+
+In your server-side rendering code you can now access user and session
+information:
+
+
+```typescript
+const refreshToken = req.cookies['my-refresh-token'];
+const accessToken = req.cookies['my-access-token'];
+
+if (refreshToken && accessToken) {
+ await supabase.auth.setSession({
+ refresh_token: refreshToken,
+ access_token: accessToken
+ });
+} else {
+ // make sure you handle this case!
+ throw new Error("User is not authenticated.")
+}
+
+// returns user information
+await supabase.auth.getUser();
+```
+
+Use `setSession({ access_token, refresh_token })` instead of
+`setSession(refreshToken)` or `getUser(accessToken)` as refresh tokens or access tokens alone do not properly identify a user session.
+
+Access tokens are valid only for a short amount of time.
+
+Even though refresh tokens are long-lived, there is no guarantee that a user
+has an active session. They may have logged out and your application failed to
+remove the `my-refresh-token` cookie, or some other failure occurred that left
+a stale refresh token in the browser. Furthermore, a refresh token can only be
+used a few seconds after it was first used. Only use a refresh token if the
+access token is about to expire, which will avoid the introduction of difficult
+to diagnose logout bugs in your app.
+
+A good practice is to handle unauthorized errors by deferring rendering the
+page in the browser instead of in the server. Some user information is
+contained in the access token though, so in certain cases, you may be able to
+use this potentially stale information to render a page.
+
+## Frequently Asked Questions
+
+### How do I make the cookies `HttpOnly`?
+
+This is not necessary. Both the access token and refresh token are designed to
+be passed around to different components in your application. The browser-based
+side of your application needs access to the refresh token to properly maintain
+a browser session anyway.
+
+### My server is getting invalid refresh token errors. What's going on?
+
+It is likely that the refresh token sent from the browser to your server is
+stale. Make sure the `onAuthStateChange` listener callback is free of bugs and
+is registered relatively early in your application's lifetime.
+
+When you receive this error on the server-side, try to defer
+rendering to the browser where the client library can access an up-to-date
+refresh token and present the user with a better experience.
+
+### Should I set a shorter `Max-Age` parameter on the cookies?
+
+The `Max-Age` or `Expires` cookie parameters only control whether the browser
+sends the value to the server. Since a refresh token represents the
+long-lived authentication session of the user on that browser, setting a short
+`Max-Age` or `Expires` parameter on the cookies only results in a degraded
+user experience.
+
+The only way to ensure that a user has logged out or their session has ended
+is to get the user's details with `getUser()`.
+
+### What should I use for the `SameSite` property?
+
+Make sure you [understand the behavior of the property in different
+situations](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Set-Cookie/SameSite)
+as some properties can degrade the user experience.
+
+A good default is to use `Lax` which sends cookies when users are
+navigating to your site. Cookies typically require the `Secure` attribute,
+which only sends them over HTTPS. However, this can be a problem when
+developing on `localhost`.
+
+### Can I use server-side rendering with a CDN or cache?
+
+Yes, but you need to be careful to include at least the refresh token cookie
+value in the cache key. Otherwise you may be accidentally serving pages with
+data belonging to different users!
+
+Also be sure you set proper cache control headers. We recommend invalidating
+cache keys every hour or less.
diff --git a/apps/reference/docs/guides/cli/cicd-workflow.mdx b/apps/reference/docs/guides/cli/cicd-workflow.mdx
index 875d240c300..07afed16df8 100644
--- a/apps/reference/docs/guides/cli/cicd-workflow.mdx
+++ b/apps/reference/docs/guides/cli/cicd-workflow.mdx
@@ -348,6 +348,24 @@ Once pushed, check that the migration version is up to date for both local and r
supabase migration list
```
+### Permission denied on db remote commit
+
+If you have been using Supabase hosted projects for a long time, you might encounter the following permission error when executing `db remote commit`.
+
+```bash
+Error: Error running pg_dump on remote database: pg_dump: error: query failed: ERROR: permission denied for table _type
+
+pg_dump: error: query was: LOCK TABLE "graphql"."_type" IN ACCESS SHARE MODE
+```
+
+To resolve this error, you need to grant `postgres` role permissions to `graphql` schema. You can do that by running the following query from Supabase dashboard's SQL Editor.
+
+```sql
+grant all on all tables in schema graphql to postgres, anon, authenticated, service_role;
+grant all on all functions in schema graphql to postgres, anon, authenticated, service_role;
+grant all on all sequences in schema graphql to postgres, anon, authenticated, service_role;
+```
+
### Permission denied on db push
If you created a table through Supabase dashboard, and your new migration script contains `ALTER TABLE` statements, you might run into permission error when applying them on staging or production databases.
@@ -358,12 +376,14 @@ ERROR: must be owner of table employees (SQLSTATE 42501); while executing migrat
This is because tables created through Supabase dashboard are owned by `supabase_admin` role while the migration scripts executed through CLI are under `postgres` role.
-One way to solve this is to grant `postgres` role additional privileges through the SQL Editor available on Supabase dashboard. For example, the following command grants postgres permissions to alter any table in the public schema.
+One way to solve this is to reassign the owner of those tables to `postgres` role. For example, if your table is named `users` in the public schema, you can run the following command to reassign owner.
```sql
-GRANT ALL PRIVILEGES ON ALL TABLES IN SCHEMA public TO postgres;
+ALTER TABLE users OWNER TO postgres;
```
+Apart from tables, you also need to reassign owner of other entities using their respective commands, including [types](https://www.postgresql.org/docs/current/sql-alterschema.html), [functions](https://www.postgresql.org/docs/current/sql-alterroutine.html), and [schemas](https://www.postgresql.org/docs/current/sql-altertype.html).
+
### Rebasing new migrations
Sometimes your teammate may merge a new migration file to git main branch, and now you need to rebase your local schema changes on top.
diff --git a/apps/reference/docs/guides/features.mdx b/apps/reference/docs/guides/features.mdx
new file mode 100755
index 00000000000..bd3ae948058
--- /dev/null
+++ b/apps/reference/docs/guides/features.mdx
@@ -0,0 +1,171 @@
+---
+id: features
+title: Features
+description: 'Supabase features'
+---
+
+This is a non-exhaustive list of features that Supabase provides for every project.
+
+## Database
+
+### Postgres Database
+
+Every project is a full Postgres database. [Docs](/docs/guides/database).
+
+### Database Extensions
+
+Every database comes with a full set of Postgres extensions. [Docs](/docs/guides/database/extensions).
+
+### Database Functions
+
+Create custom database functions which you can call from the browser. [Docs](/docs/guides/database/functions).
+
+### Database Triggers
+
+Attach triggers to your tables to handle database changes. [Docs](/docs/guides/auth/managing-user-data#using-triggers).
+
+### Database Webhooks
+
+Send database changes to any external service using Webhooks. [Link](https://supabase.com/blog/supabase-functions-updates#database-webhooks-alpha).
+
+### Database Backups
+
+Projects are backed up daily with the option to upgrade to Point in Time recovery.
+
+### Search
+
+Build search functionality using Postgres Full Text Search. [Docs](/docs/guides/database/full-text-search).
+
+### Secrets and encryption
+
+Encrypt sensitive data and store secrets using our Postgres extension, Supabase Vault. [Link](https://supabase.com/blog/supabase-vault).
+
+### Database migrations
+
+Develop locally and push your changes to your production database using migrations. [Docs](/docs/guides/cli/local-development#database-migrations)
+
+
+
+## Auth
+
+### Email & Password Logins
+
+Build email logins for your application or website. [Docs](/docs/guides/auth/auth-email).
+
+### Magic Links
+
+Build passwordless logins for your application or website.[Docs](/docs/guides/auth/auth-magic-link).
+
+### Social Logins
+
+Provide social logins - everything from Apple, to GitHub, to Slack. [Docs](/docs/guides/auth/auth-apple).
+
+### Phone Logins
+
+Provide phone logins using a 3rd-party SMS provider. [Docs](/docs/guides/auth/auth-twilio).
+
+### Row Level Security
+
+Control the data each user can access with Postgres Policies. [Docs](/docs/guides/auth/row-level-security).
+
+### Serverside Auth Helpers
+
+Helpers for implementing user authentication in popular frameworks like [Next.js](/docs/guides/auth/auth-helpers/nextjs) and [SvelteKit](/docs/guides/auth/auth-helpers/sveltekit)
+
+### Auth UI Kit
+
+Build login and registration pages with custom themes. [Docs](/docs/guides/auth/auth-helpers/auth-ui).
+
+
+
+## APIs & Client libraries
+
+### Auto-generated REST API
+
+RESTful APIs are autogenerated from your database, without a single line of code. [Docs](/docs/guides/api#rest-api-overview).
+
+### Auto-generated GraphQL API
+
+Fast GraphQL APIs using our custom Postgres GraphQL extension. [Docs](/docs/guides/api#graphql-api-overview).
+
+### Realtime Database changes
+
+Receive your database changes through websockets. [Docs](/docs/guides/realtime/postgres-cdc).
+
+### User Broadcasting
+
+Send messages between connected users through websockets. [Docs](/docs/guides/realtime#broadcast).
+
+### User Presence
+
+Synchronize shared state across your users, including online status and typing indicators. [Docs](/docs/guides/realtime#presence).
+
+### Client libraries
+
+Official client libraries for [JavaScript](/docs/reference/javascript/) and [Dart](/docs/reference/dart).
+Unofficial libraries [supported by the community](https://github.com/supabase-community#client-libraries).
+
+
+
+## File Storage
+
+### Large File storage
+
+Supabase Storage makes it simple to store and serve large files. [Docs](/docs/guides/storage).
+
+### Storage CDN
+
+Cache large files using the Supabase CDN. [Docs](/docs/guides/storage-cdn).
+
+
+
+## Edge Functions
+
+### Deno Edge Functions
+
+Globally distributed TypeScript functions to execute custom business logic. [Docs](/docs/guides/functions).
+
+
+
+## Project Managment
+
+### CLI
+
+Use our CLI to develop your project locally and deploy to the Supabase Platform. [Docs](/docs/reference/cli).
+
+### Admin API
+
+Manage your projects programmatically. [Docs](/docs/reference/api).
+
+
+
+## Feature Status
+
+Both Postgres and the Supabase Platform are production-ready. Some tools we offer on top of Postgres are still under development.
+
+| Product | Feature | Stage |
+| -------------------------- | ---------------------- | ------- |
+| Database | Postgres | `GA` |
+| Database | Triggers | `GA` |
+| Database | Functions | `GA` |
+| Database | Extensions | `GA` |
+| Database | Full Text Search | `GA` |
+| Database | Webhooks | `alpha` |
+| Database | Point-in-Time Recovery | `alpha` |
+| Database | Vault | `alpha` |
+| Studio | | `GA` |
+| Realtime | Postgres CDC | `beta` |
+| Realtime | Broadcast | `alpha` |
+| Realtime | Presence | `alpha` |
+| Storage | Backend (S3) | `GA` |
+| Storage | API | `beta` |
+| Storage | CDN | `beta` |
+| Edge Functions | | `beta` |
+| Auth | OAuth Providers | `beta` |
+| Auth | Passwordless | `beta` |
+| Auth | Next.js Auth Helpers | `alpha` |
+| Auth | SvelteKit Auth Helpers | `alpha` |
+| Admin API | | `beta` |
+| CLI | | `beta` |
+| Client Library: JavaScript | | `GA` |
+| Client Library: Dart | | `beta` |
diff --git a/apps/reference/docs/guides/integrations/dhiwise.mdx b/apps/reference/docs/guides/integrations/dhiwise.mdx
new file mode 100644
index 00000000000..15b4110ed1e
--- /dev/null
+++ b/apps/reference/docs/guides/integrations/dhiwise.mdx
@@ -0,0 +1,175 @@
+---
+id: dhiwise
+title: 'DhiWise'
+description: 'Get started with Supabase and DhiWise. Convert your Figma designs into Flutter apps, store data, and authenticate your users'
+---
+import select from "/img/guides/integrations/dhiwise/select.png"
+import create from "/img/guides/integrations/dhiwise/create.png"
+
+This guide explains how to connect Supabase backend to DhiWise Flutter application quickly.
+
+[DhiWise](https://www.dhiwise.com/) is a Developer tool to convert Figma designs into React and Flutter applications. It lets you quickly integrate Databases and APIs into your React and Flutter Apps.
+
+If you don't have a DhiWise account, create one [here](https://app.dhiwise.com).
+
+DhiWise supports easy Supabase Integration in just five steps.
+
+Let's get started!
+
+## Step 1: SignIn to Supabase
+
+Go to [Supabase](https://supabase.com/), Click `Sign In`, and create a new account by authenticating with **GitHub**. If you already have an account, you will be logged in.
+
+## Step 2: Create a new project in Supabase
+
+Click on `New project` from the Dashboard and select an organization. If you don't have an organization, create one using `+ New organization.`
+
+- Give your Supabase project a `name.`
+- Enter a secure `Database Password.`
+- Choose the `region` where your app's backend is hosted.
+- Click `Create new project.`
+
+
+
+## Step 3: Find the API key and URL
+
+Once your project is created, you can access the API Key and URL string, Or if you already have an account go to your `organization-> app-> settings-> API`.
+
+
+
+## Step 4: Integrations
+
+There are two ways you can integrate Supabase into your DhiWise Flutter applications.
+
+### Authentication
+
+You can integrate `Supabase Email/Password SignUp` or `Supabase Email/Password SignIn` on your components.
+
+- Open the screen of your flutter application
+- Go to the component on which you want to add authentication
+- on the `onClick` method - select `authentication`
+- From the list, If you want SignUp - select `SignUp with Email/Password`; otherwise, select `SignIn with Email/Password` from Supabase Auth section
+
+
+
+And that's it. Supabase authentication will be added to the selected component.
+
+After downloading the application source code,
+1. Add Supabase URL and Supabase public key inside ***lib/core/utils/initial_bindings*** file.
+2. For additional details, refer ***https://supabase.com/docs/guides/with-flutter***
+
+### Working with Data
+
+When you first integrate Supabase in your DhiWise Flutter application, You will be asked to add [Supabase auth key and URL](##step-3-find-the-api-key-and-url). When you add them, all the tables available in your Supabase project will be synced in DhiWise. You can integrate Select and Create queries on your Flutter screen for a particular table in DhiWise.
+
+
Select records
+
+#### **Step 1:**
+Select the screen from the screen list where you want to integrate Supabase.
+
+#### **Step 2:**
+Next, go to the view where you want to add Integration, and from the suggestion box for the `onClick` property, choose `Supabase integration,` which will take you to the Integration screen. Where you will be asked to `Enter function name.` Enter the name of your function and click `Submit.`
+
+#### **Step 3:**
+After submitting the function name, you will be asked to select a type of Supabase integration. To retrieve data from Supabase, choose `select.`
+
+#### **Step 4:**
+Next, select the table from which you want to fetch records from the listed Tables.
+
+#### **Step 5:**
+Select the type of integration
+
+| Type | Description |
+| --- | --- |
+| **Single** | Used to fetch a single record from the database. |
+| **Multiple** | Used to fetch multiple records from the database. |
+
+:::info
+For Multiple types, you need to set `data limit,` `order by, and `order.`
+:::
+
+#### **Step 6:**
+You will be redirected to the API Integration screen, where you can set request and response.
+
+For request binding, the below types are supported. Also, Select the operator for comparison before moving forward.
+
+| Type | Description |
+| --- | --- |
+| **View** | Select any component from your screen. |
+| **Constant** | Select a constant you've created in your app. |
+| **Get from preference** | Select the key you want to fetch from preference. |
+| **Navigation argument** | Select data that's been passed from one screen to another. |
+
+For response binding, the below types are supported.
+
+| Type | Description |
+| --- | --- |
+| **View** | Select any component from the screen. |
+| **Save to preference** | Storing the data to preference. |
+
+#### **Select 7:**
+`Handle action` - Select the action you wish to take once the Supabase call has either been accepted successfully or refused due to an error.
+
+Available action for On success and On error are,
+
+1. [Show Alert](https://docs.dhiwise.com/docs/flutter/show-alert)
+2. [Navigation](https://docs.dhiwise.com/docs/flutter/navigation)
+
+#### **Step 8:**
+Finally, you have added Supabase to your application to fetch records on your screen!
+
+:::tip Example
+Suppose you want to fetch records from Supabase and populate the item list on your screen. You can integrate Supabase as discussed above and bind the response with your list view.
+:::
+
+
Create records
+
+#### **Step 1:**
+Choose the screen you wish to integrate Supabase for from the list of screens.
+
+#### **Step 2:**
+Next, switch to the component you want to add Integration, and on the `onClick` property, choose `Supabase integration,` which will take you to its integration screen, where you will be asked to **Enter function name**, which will be used in generated code. Enter the name for it and click `Submit`
+
+#### **Step 3:**
+After submitting the function name, you will be asked to select a type of Supabase integration. For example, to create a record in Supabase, choose `Create.`
+
+#### **Step 4:**
+Next, select the table where you want to create a record from the listed Tables.
+
+#### **Step 5:**
+If you want to create a Single record, Select **Select**. Otherwise, **Multiple**.
+
+#### **Step 6:**
+Now, you will be redirected to the API Integration screen, where you can set request and response.
+
+For request binding, the below types are supported.
+
+| Type | Description |
+| --- | --- |
+| **View** | Select any component from the screen |
+| **Constant** | Select a constant you've created in your app.|
+| **Get from preference** | Select the key you want to fetch from preference. |
+| **Navigation argument** | Select data that's been passed from one screen to another. |
+
+For response binding, the below types are supported.
+
+| Type | Description |
+| --- | --- |
+| **View** | Select any component from the screen |
+| **Save to preference** | Storing the data to preference. |
+
+#### **Select 7:**
+`Handle action` - Select the action you wish to take once the Supabase call has either been accepted successfully or refused due to an error.
+
+Available action for On success and On error are,
+
+1. [Show Alert](https://docs.dhiwise.com/docs/flutter/show-alert)
+2. [Navigation](https://docs.dhiwise.com/docs/flutter/navigation)
+
+#### **Step 9:**
+Finally, you have added Supabase to your application to create records from your screen data!
+
+## Resources
+
+- [DhiWise Official Website](https://dhiwise.com)
+- [DhiWise Documentation](https://docs.dhiwise.com)
\ No newline at end of file
diff --git a/apps/reference/docs/guides/integrations/integrations.mdx b/apps/reference/docs/guides/integrations/integrations.mdx
new file mode 100644
index 00000000000..9fdf5c6fa2d
--- /dev/null
+++ b/apps/reference/docs/guides/integrations/integrations.mdx
@@ -0,0 +1,34 @@
+---
+id: integrations
+title: 'Supabase Marketplace'
+description: 'Integrations and Partners'
+---
+
+The Supabase Marketplace brings together all the tools you need to extend your Supabase project. This includes:
+
+- [Experts](https://supabase.com/partners/experts) - partners to help you build and support your Supabase project.
+- [Integrations](https://supabase.com/partners/integrations) - extend your projects with external Auth, Caching, Hosting, and Low-code tools.
+
+## Build an integration
+
+Supabase provides several integration points:
+
+- The [Postgres connection](/docs/guides/database/connecting-to-postgres). Anything that works with Postgres also works with Supabase projects.
+- The [Project REST API](/docs/guides/api#rest-api) & client libraries.
+- The [Project GraphQL API](/docs/guides/api#graphql-api).
+- The [Platform API](/docs/reference/api).
+
+## List your integration
+
+[Apply to the Partners program](https://supabase.com/partners/integrations#become-a-partner) to list your integration in the Partners marketplace and in the Supabase docs.
+
+Integrations are assessed on the following criteria:
+
+- **Business viability**
+ While we welcome everyone to built an integration, we only list companies that are deemed to be long-term viable. This includes an official business registration and bank account, meaningful revenue, or Venture Capital backing. We require this criteria to ensure the health of the marketplace.
+- **Compliance**
+ Integrations should not infringe on the Supabase brand/trademark. In short, you cannot use "Supabase" in the name. As the listing appears on the Supabase domain, we don't want to mislead developers into thinking that an integration is an official product.
+- **Service Level Agreements**
+ All listings are required to have their own Terms and Conditions, Privacy Policy, and Acceptable Use Policy, and the company must have resources to meet their SLAs.
+- **Maintainability**
+ All integrations are required to be maintained and functional with Supabase, and the company may be assessed on your ability to remain functional over a long time horizon.
diff --git a/apps/reference/docs/guides/integrations/keyri.mdx b/apps/reference/docs/guides/integrations/keyri.mdx
new file mode 100644
index 00000000000..936db47bad8
--- /dev/null
+++ b/apps/reference/docs/guides/integrations/keyri.mdx
@@ -0,0 +1,149 @@
+
+id: keyri
+title: 'Keyri'
+description: 'QR authentication for an easy and flexible biometric solution across all platforms.'
+---
+
+Keyri can be used to incorporate sign-in-with-QR functionality into your Supabase app, allowing users to scan a QR code on your web app with your mobile app and be instantly logged into the web app without having to input any credentials.
+
+Configuration is split into Web and Mobile components. On web, the Keyri QR Widget needs to be installed along with an event listener, and in your mobile app, install the Keyri SDK and pass into it the user's refresh token when sign-in-with-QR is initiated. When the refresh token lands in your web app, it's passed into Supabase's `setSession()` method.
+
+# Sign up for Keyri
+
+First make a free account on the Keyri dashboard (). On Add Your Application, set a name and input the domain on which your app will eventually be deployed. You can create multiple application in Keyri to account for your development, staging, and production environments
+
+
+
+Note your application key from the Keys and Credentials section - this will be used in the Mobile portion of the implementation
+
+
+
+# Web
+
+[](http://www.youtube.com/watch?v=jrjrcpc2PFQ "Supabase & Keyri | Web Integration Overview")
+
+For your web app, first download KeyriQR.html (available [here](https://raw.githubusercontent.com/Keyri-Co/library-keyri-connect/main/KeyriQR.html)) and save it to a public directory.
+
+Next, embed KeyriQR.html in your login page as an iFrame within the desired div. This serves as the widget that displays the dynamic QR code and connects with the Keyri API.
+
+```html
+
+
+
+```
+
+Next, for the same login view, set up an event listener to pick up the session token that the iFrame emits when the QR code is scanned by your app.
+
+```javascript
+useEffect(() => {
+ window.addEventListener('message', async (evt) => {
+ if (evt.data.keyri && evt.data.data && document.location.origin == evt.origin) {
+ const { data } = evt;
+ if (!data.error) {
+ let refresh_token = JSON.parse(data.data).refreshToken;
+ await handleQrLogin(refresh_token);
+ } else if (data.error) {
+ console.log(`Keyri error: ${data.message}`);
+ }
+ }
+});
+```
+
+That's it!
+
+# Mobile
+
+[](http://www.youtube.com/watch?v=oGMsSKyh6tc "Supabase & Keyri | Mobile Integration Overview")
+
+### Install Flutter
+
+First, install the Flutter SDK, found at flutter.dev
+
+Make sure to add Flutter to your PATH, for example:
+
+```shell
+export PATH="$PATH:`pwd`/flutter/bin"
+```
+
+### Apple - initial setup
+
+Download the latest version of Xcode from the Mac App Store. Make sure the Xcode provided simulator is using a 64-bit device (iPhone 5s or later). You can check the device by viewing the settings in the simulator’s **Hardware > Device** or **File > Open Simulator** menus.
+
+### Android - initial setup
+
+Download the latest version of [Android Studio](https://developer.android.com/studio). Install Android SDK and needed emulator(s).
+
+### Create Project
+
+Run this command in your terminal/shell at the desired location for your new project
+
+```shell
+$ flutter create my_app
+```
+
+You can then CD into the new directory, and run the test app with
+
+```shell
+flutter run
+```
+
+This is a good test - if things are configured correctly so far you should see the default Flutter test app deployed.
+
+### Add dependencies (Keyri and Supabase)
+
+Open your Pubspec.yaml file, which should be at the top level directory in your new project
+
+Add Keyri and Supabase under **dependencies**
+
+
+
+One can now access Supabase and Keyri sdks in their Flutter code
+
+### Utilize the two together
+
+1. Make a request to Supabase to authenticate the user
+
+2. Parse the response to extract the token
+
+3. Authenticate using Keyri
+ 1. Below, we show how to utilize the EasyKeyriAuth function, which takes the user through scanning the code, creating the session, displaying the confirmation screen, and finalizing the payload transmission
+ - Note - you can find your App Key in the Keyri Developer Portal
+
+ 2. Alternatively, intermediate functions in the Keyri SDK, discussed in the mobile docs, can provide control over displaying a custom QR Scanner and/or Confirmation screen
+
+```kotlin
+// Sign in user with email and password
+// Alternatively one can utilize the Supabase API to accomplish the same thing
+final response = await client.auth.signIn(email: 'email', password: 'password');
+
+if (response.error != null) {
+ // Error
+ print('Error: ${response.error?.message}');
+} else {
+ // Success
+ final session = response.data;
+
+ // This is the payload that needs to be send through Keyri
+ final refreshToken = session.refreshToken
+
+ // EasyKeyriAuth guides the user through scanning and parsing the QR, confirming the session, and configuring the payload
+ // One can also use the initiateQRSession method to use the Keyri Scanner with a custom Confirmation screen
+ // Or the ProcessLink method if you have your own scanner or are using deep linking
+ await keyri
+ .easyKeyriAuth([App Key],
+ '{"refreshToken":"$refreshToken"}', [email])
+ .then((authResult) => _onAuthResult(authResult))
+ .catchError((error, stackTrace) => _onError(error));
+
+}
+
+
+```
diff --git a/apps/reference/docs/guides/realtime/quickstart.mdx b/apps/reference/docs/guides/realtime/quickstart.mdx
index f1918fe9ab6..47a77610d94 100644
--- a/apps/reference/docs/guides/realtime/quickstart.mdx
+++ b/apps/reference/docs/guides/realtime/quickstart.mdx
@@ -103,7 +103,7 @@ const channel = supabase.channel('calc-latency', {
})
channel.subscribe(async (status) => {
- if (status === 'SUBSCRIBED) {
+ if (status === 'SUBSCRIBED') {
const begin = performance.now()
await channel.send({
diff --git a/apps/reference/docs/guides/with-nextjs.mdx b/apps/reference/docs/guides/with-nextjs.mdx
index ebcc253325c..3d40b368b08 100644
--- a/apps/reference/docs/guides/with-nextjs.mdx
+++ b/apps/reference/docs/guides/with-nextjs.mdx
@@ -61,6 +61,7 @@ Now we are going to set up the database schema. We can use the "User Management
or you can just copy/paste the SQL from below and run it yourself.
```sql
--- Create a table for public "profiles"
+-- Create a table for public profiles
create table profiles (
- id uuid references auth.users not null,
+ id uuid references auth.users not null primary key,
updated_at timestamp with time zone,
username text unique,
+ full_name text,
avatar_url text,
website text,
- primary key (id),
- unique(username),
constraint username_length check (char_length(username) >= 3)
);
+-- Set up Row Level Security (RLS)
+-- See https://supabase.com/docs/guides/auth/row-level-security for more details.
+alter table profiles
+ enable row level security;
-alter table profiles enable row level security;
+create policy "Public profiles are viewable by everyone." on profiles
+ for select using (true);
-create policy "Public profiles are viewable by everyone."
- on profiles for select
- using ( true );
+create policy "Users can insert their own profile." on profiles
+ for insert with check (auth.uid() = id);
-create policy "Users can insert their own profile."
- on profiles for insert
- with check ( auth.uid() = id );
+create policy "Users can update own profile." on profiles
+ for update using (auth.uid() = id);
-create policy "Users can update own profile."
- on profiles for update
- using ( auth.uid() = id );
-
--- Set up Realtime!
-begin;
- drop publication if exists supabase_realtime;
- create publication supabase_realtime;
-commit;
-alter publication supabase_realtime add table profiles;
+-- This trigger automatically creates a profile entry when a new user signs up via Supabase Auth.
+-- See https://supabase.com/docs/guides/auth/managing-user-data#using-triggers for more details.
+create function public.handle_new_user()
+returns trigger as $$
+begin
+ insert into public.profiles (id, full_name, avatar_url)
+ values (new.id, new.raw_user_meta_data->>'full_name', new.raw_user_meta_data->>'avatar_url');
+ return new;
+end;
+$$ language plpgsql security definer;
+create trigger on_auth_user_created
+ after insert on auth.users
+ for each row execute procedure public.handle_new_user();
-- Set up Storage!
insert into storage.buckets (id, name)
-values ('avatars', 'avatars');
+ values ('avatars', 'avatars');
-create policy "Avatar images are publicly accessible."
- on storage.objects for select
- using ( bucket_id = 'avatars' );
+-- Set up access controls for storage.
+-- See https://supabase.com/docs/guides/storage#policy-examples for more details.
+create policy "Avatar images are publicly accessible." on storage.objects
+ for select using (bucket_id = 'avatars');
-create policy "Anyone can upload an avatar."
- on storage.objects for insert
- with check ( bucket_id = 'avatars' );
+create policy "Anyone can upload an avatar." on storage.objects
+ for insert with check (bucket_id = 'avatars');
+
+create policy "Anyone can update their own avatar." on storage.objects
+ for update using ( auth.uid() = owner ) with check (bucket_id = 'avatars');
```
@@ -163,12 +172,32 @@ Let's start building the Next.js app from scratch.
We can use [`create-next-app`](https://nextjs.org/docs/getting-started) to initialize
an app called `supabase-nextjs`:
+
+
+
```bash
-npx create-next-app supabase-nextjs --use-npm
+npx create-next-app@latest --use-npm supabase-nextjs
cd supabase-nextjs
```
-Then let's install the only additional dependency: [supabase-js](https://github.com/supabase/supabase-js)
+
+
+
+```bash
+npx create-next-app@latest --ts --use-npm supabase-nextjs
+cd supabase-nextjs
+```
+
+
+
+
+Then install the Supabase client library: [supabase-js](https://github.com/supabase/supabase-js)
```bash
npm install @supabase/supabase-js
@@ -182,93 +211,148 @@ NEXT_PUBLIC_SUPABASE_URL=YOUR_SUPABASE_URL
NEXT_PUBLIC_SUPABASE_ANON_KEY=YOUR_SUPABASE_ANON_KEY
```
-Now that we have the API credentials in place, let's create a helper file to initialize the Supabase client.
-These variables will be exposed on the browser, and that's completely fine since we have
-[Row Level Security](/docs/guides/auth#row-level-security) enabled on our Database.
-
-```js title="utils/supabaseClient.js"
-import { createClient } from '@supabase/supabase-js'
-
-const supabaseUrl = process.env.NEXT_PUBLIC_SUPABASE_URL
-const supabaseAnonKey = process.env.NEXT_PUBLIC_SUPABASE_ANON_KEY
-
-export const supabase = createClient(supabaseUrl, supabaseAnonKey)
-```
-
And one optional step is to update the CSS file `styles/globals.css` to make the app look nice.
-You can find the full contents of this file [here](https://raw.githubusercontent.com/supabase/examples/main/supabase-js-v2/user-management/nextjs-ts-user-management/styles/globals.css).
+You can find the full contents of this file [here](https://raw.githubusercontent.com/supabase/supabase/master/examples/user-management/nextjs-ts-user-management/styles/globals.css).
### Set up a Login component
-Let's set up a React component to manage logins and sign ups.
-We'll use Magic Links, so users can sign in with their email without using passwords.
+#### Supabase Auth Helpers
-```jsx title="components/Auth.js"
-import { useState } from 'react'
-import { supabase } from '../utils/supabaseClient'
+Next.js is a highly versatile framework offering pre-rendering at build time (SSG), server-side rendering at request time (SSR), API routes, and middleware edge-functions.
-export default function Auth() {
- const [loading, setLoading] = useState(false)
- const [email, setEmail] = useState('')
+It can be challenging to authenticate your users in all these different environments, that's why we've created the [Supabase Auth Helpers](https://supabase.com/docs/guides/auth/auth-helpers/nextjs) to make user management and data fetching within Next.js as easy as possible.
- const handleLogin = async (email) => {
- try {
- setLoading(true)
- const { error } = await supabase.auth.signInWithOtp({ email })
- if (error) throw error
- alert('Check your email for the login link!')
- } catch (error) {
- alert(error.error_description || error.message)
- } finally {
- setLoading(false)
- }
- }
+Install the auth helpers for React and Next.js
+
+```bash
+npm install @supabase/auth-helpers-react @supabase/auth-helpers-nextjs
+```
+
+
+
+
+Wrap your `pages/_app.js` component with the `SessionContextProvider` component:
+
+```jsx title="pages/_app.js"
+import { createBrowserSupabaseClient } from '@supabase/auth-helpers-nextjs'
+import { SessionContextProvider } from '@supabase/auth-helpers-react'
+
+function MyApp({ Component, pageProps }) {
+ const router = useRouter()
+ const [supabaseClient] = useState(() => createBrowserSupabaseClient())
return (
-
-
-
Supabase + Next.js
-
- Sign in via magic link with your email below
-
-
- setEmail(e.target.value)}
- />
-
-
-
-
-
+
+
+ )
+}
+```
+
+
+
+
+Wrap your `pages/_app.tsx` component with the `SessionContextProvider` component:
+
+```jsx title="pages/_app.tsx"
+import { createBrowserSupabaseClient } from '@supabase/auth-helpers-nextjs'
+// highlight-next-line
+import { SessionContextProvider, Session } from '@supabase/auth-helpers-react'
+
+function MyApp({
+ Component,
+ pageProps,
+}: AppProps<{
+ // highlight-next-line
+ initialSession: Session,
+}>) {
+ const [supabaseClient] = useState(() => createBrowserSupabaseClient())
+
+ return (
+
+
+
+ )
+}
+```
+
+See the [Auth Helpers docs](/docs/guides/auth/auth-helpers/nextjs#usage-with-typescript) for more details on usage with TypeScript.
+
+
+
+
+#### Supabase Auth UI
+
+We can use the [Supabase Auth UI](https://supabase.com/docs/guides/auth/auth-helpers/auth-ui) a pre-built React component for authenticating users via OAuth, email, and magic links.
+
+Install the Supabase Auth UI for React
+
+```bash
+npm install @supabase/auth-ui-react
+```
+
+Add the `Auth` component to your home page
+
+```jsx title="pages/index.js"
+import type { NextPage } from 'next'
+import { Auth, ThemeSupa } from '@supabase/auth-ui-react'
+import { useSession, useSupabaseClient } from '@supabase/auth-helpers-react'
+
+const Home: NextPage = () => {
+ const session = useSession()
+ const supabase = useSupabaseClient()
+
+ return (
+
+ {!session ? (
+
+ ) : (
+
Account page will go here.
+ )}
)
}
+
+export default Home
```
### Account page
After a user is signed in we can allow them to edit their profile details and manage their account.
-Let's create a new component for that called `Account.js`.
+
+
-```jsx title="components/Account.js"
+Let's create a new component for that called `Account.js` within a `components` folder.
+
+```tsx title="components/Account.js"
import { useState, useEffect } from 'react'
-import { supabase } from '../utils/supabaseClient'
+import { useUser, useSupabaseClient } from '@supabase/auth-helpers-react'
export default function Account({ session }) {
+ const supabase = useSupabaseClient()
+ const user = useUser()
const [loading, setLoading] = useState(true)
const [username, setUsername] = useState(null)
const [website, setWebsite] = useState(null)
@@ -278,27 +362,9 @@ export default function Account({ session }) {
getProfile()
}, [session])
- async function getCurrentUser() {
- const {
- data: { session },
- error,
- } = await supabase.auth.getSession()
-
- if (error) {
- throw error
- }
-
- if (!session?.user) {
- throw new Error('User not logged in')
- }
-
- return session.user
- }
-
async function getProfile() {
try {
setLoading(true)
- const user = await getCurrentUser()
let { data, error, status } = await supabase
.from('profiles')
@@ -316,7 +382,8 @@ export default function Account({ session }) {
setAvatarUrl(data.avatar_url)
}
} catch (error) {
- alert(error.message)
+ alert('Error loading user data!')
+ console.log(error)
} finally {
setLoading(false)
}
@@ -325,23 +392,21 @@ export default function Account({ session }) {
async function updateProfile({ username, website, avatar_url }) {
try {
setLoading(true)
- const user = await getCurrentUser()
const updates = {
id: user.id,
username,
website,
avatar_url,
- updated_at: new Date(),
+ updated_at: new Date().toISOString(),
}
let { error } = await supabase.from('profiles').upsert(updates)
-
- if (error) {
- throw error
- }
+ if (error) throw error
+ alert('Profile updated!')
} catch (error) {
- alert(error.message)
+ alert('Error updating the data!')
+ console.log(error)
} finally {
setLoading(false)
}
@@ -354,7 +419,7 @@ export default function Account({ session }) {
)
}
+
+export default Home
```
Once that's done, run this in a terminal window:
@@ -462,8 +640,6 @@ npm run dev
And then open the browser to [localhost:3000](http://localhost:3000) and you should see the completed app.
-
-
## Bonus: Profile photos
Every Supabase project is configured with [Storage](/docs/guides/storage) for managing large files like
@@ -471,14 +647,23 @@ photos and videos.
### Create an upload widget
-Let's create an avatar for the user so that they can upload a profile photo.
-We can start by creating a new component:
+Let's create an avatar widget for the user so that they can upload a profile photo. We can start by creating a new component:
+
+
+
```jsx title="components/Avatar.js"
-import { useEffect, useState } from 'react'
-import { supabase } from '../utils/supabaseClient'
+import React, { useEffect, useState } from 'react'
+import { useSupabaseClient } from '@supabase/auth-helpers-react'
-export default function Avatar({ url, size, onUpload }) {
+export default function Avatar({ uid, url, size, onUpload }) {
+ const supabase = useSupabaseClient()
const [avatarUrl, setAvatarUrl] = useState(null)
const [uploading, setUploading] = useState(false)
@@ -497,11 +682,11 @@ export default function Avatar({ url, size, onUpload }) {
const url = URL.createObjectURL(data)
setAvatarUrl(url)
} catch (error) {
- console.log('Error downloading image: ', error.message)
+ console.log('Error downloading image: ', error)
}
}
- async function uploadAvatar(event) {
+ const uploadAvatar = async (event) => {
try {
setUploading(true)
@@ -511,12 +696,12 @@ export default function Avatar({ url, size, onUpload }) {
const file = event.target.files[0]
const fileExt = file.name.split('.').pop()
- const fileName = `${Math.random()}.${fileExt}`
+ const fileName = `${uid}.${fileExt}`
const filePath = `${fileName}`
let { error: uploadError } = await supabase.storage
.from('avatars')
- .upload(filePath, file)
+ .upload(filePath, file, { upsert: true })
if (uploadError) {
throw uploadError
@@ -524,7 +709,8 @@ export default function Avatar({ url, size, onUpload }) {
onUpload(filePath)
} catch (error) {
- alert(error.message)
+ alert('Error uploading avatar!')
+ console.log(error)
} finally {
setUploading(false)
}
@@ -566,6 +752,120 @@ export default function Avatar({ url, size, onUpload }) {
}
```
+
+
+
+```tsx title="components/Avatar.tsx"
+import React, { useEffect, useState } from 'react'
+import { useSupabaseClient } from '@supabase/auth-helpers-react'
+import { Database } from '../utils/database.types'
+type Profiles = Database['public']['Tables']['profiles']['Row']
+
+export default function Avatar({
+ uid,
+ url,
+ size,
+ onUpload,
+}: {
+ uid: string
+ url: Profiles['avatar_url']
+ size: number
+ onUpload: (url: string) => void
+}) {
+ const supabase = useSupabaseClient()
+ const [avatarUrl, setAvatarUrl] = useState(null)
+ const [uploading, setUploading] = useState(false)
+
+ useEffect(() => {
+ if (url) downloadImage(url)
+ }, [url])
+
+ async function downloadImage(path: string) {
+ try {
+ const { data, error } = await supabase.storage
+ .from('avatars')
+ .download(path)
+ if (error) {
+ throw error
+ }
+ const url = URL.createObjectURL(data)
+ setAvatarUrl(url)
+ } catch (error) {
+ console.log('Error downloading image: ', error)
+ }
+ }
+
+ const uploadAvatar: React.ChangeEventHandler = async (
+ event
+ ) => {
+ try {
+ setUploading(true)
+
+ if (!event.target.files || event.target.files.length === 0) {
+ throw new Error('You must select an image to upload.')
+ }
+
+ const file = event.target.files[0]
+ const fileExt = file.name.split('.').pop()
+ const fileName = `${uid}.${fileExt}`
+ const filePath = `${fileName}`
+
+ let { error: uploadError } = await supabase.storage
+ .from('avatars')
+ .upload(filePath, file, { upsert: true })
+
+ if (uploadError) {
+ throw uploadError
+ }
+
+ onUpload(filePath)
+ } catch (error) {
+ alert('Error uploading avatar!')
+ console.log(error)
+ } finally {
+ setUploading(false)
+ }
+ }
+
+ return (
+
+ {avatarUrl ? (
+
+ ) : (
+
+ )}
+
+
+
+
+
+ )
+}
+```
+
+
+
+
### Add the new widget
And then we can add the widget to the Account page:
@@ -580,6 +880,7 @@ return (
{/* Add to the body */}
{
@@ -596,5 +897,8 @@ return (
At this stage you have a fully functional application!
+- See the complete [example on GitHub](https://github.com/supabase/supabase/tree/master/examples/user-management/nextjs-ts-user-management) and deploy it to Vercel.
+- Explore the [Auth Helpers for Next.js](https://supabase.com/docs/guides/auth/auth-helpers/nextjs).
+- Explore the [pre-built Auth UI for React](https://supabase.com/docs/guides/auth/auth-helpers/auth-ui).
- Got a question? [Ask here](https://github.com/supabase/supabase/discussions).
- Sign in: [app.supabase.com](https://app.supabase.com)
diff --git a/apps/reference/docs/guides/with-solidjs.mdx b/apps/reference/docs/guides/with-solidjs.mdx
index da23c294236..e601c98aee8 100644
--- a/apps/reference/docs/guides/with-solidjs.mdx
+++ b/apps/reference/docs/guides/with-solidjs.mdx
@@ -271,9 +271,9 @@ interface Props {
const Account: Component = ({ session }) => {
const [loading, setLoading] = createSignal(true)
- const [username, setUsername] = (createSignal < string) | (null > null)
- const [website, setWebsite] = (createSignal < string) | (null > null)
- const [avatarUrl, setAvatarUrl] = (createSignal < string) | (null > null)
+ const [username, setUsername] = createSignal(null)
+ const [website, setWebsite] = createSignal(null)
+ const [avatarUrl, setAvatarUrl] = createSignal(null)
createEffect(() => {
getProfile()
diff --git a/apps/reference/docs/guides/with-vue-3.mdx b/apps/reference/docs/guides/with-vue-3.mdx
index 06b7f9e0617..49ce6b3739b 100644
--- a/apps/reference/docs/guides/with-vue-3.mdx
+++ b/apps/reference/docs/guides/with-vue-3.mdx
@@ -24,7 +24,7 @@ By the end of this guide you'll have an app which allows users to login and upda
### GitHub
-Whenever you get stuck at any point, take a look at [this repo](https://github.com/zernonia/supabase-vue-3).
+Whenever you get stuck at any point, take a look at [this repo](https://github.com/supabase/examples/tree/main/supabase-js-v2/user-management/vue3-user-management).
## Project set up
@@ -182,102 +182,141 @@ const supabaseAnonKey = import.meta.env.VITE_SUPABASE_ANON_KEY
export const supabase = createClient(supabaseUrl, supabaseAnonKey)
```
-And one optional step is to update the CSS file `src/assets/main.css` to make the app look nice.
-You can find the full contents of this file [here](https://raw.githubusercontent.com/supabase/examples/main/supabase-js-v2/user-management/react-user-management/src/index.css).
-
-```javascript title="src/main.js"
-import { createApp } from 'vue'
-import App from './App.vue'
-import './assets/main.css'
-
-createApp(App).mount('#app')
-```
+Optionally, update [src/style.css](https://raw.githubusercontent.com/supabase/examples/main/supabase-js-v2/user-management/vue3-user-management/src/style.css) to style the app.
### Set up a Login component
Let's set up a Vue component to manage logins and sign ups. We'll use Magic Links, so users can sign in with their email without using passwords.
```html title="/src/components/Auth.vue"
+
+
-
-
-```
-
-### User store
-
-To access the user information in other places, we use a reactive store. Create a new file called `store.js` and utilize Vue 3 `reactive` functionalities.
-
-```javascript title="src/store.js"
-import { reactive } from 'vue'
-
-export const store = reactive({
- user: {},
-})
```
### Account page
After a user is signed in we can allow them to edit their profile details and manage their account.
-Let's create a new component for that called `Profile.vue`.
+Let's create a new component for that called `Account.vue`.
+
+```html title="src/components/Account.vue"
+
-```html title="src/components/Profile.vue"
-
-
```
### Launch!
@@ -403,37 +346,31 @@ Let's create a new component for that called `Profile.vue`.
Now that we have all the components in place, let's update `App.vue`:
```html title="src/App.vue"
+
+
-
+
-
-
```
Once that's done, run this in a terminal window:
@@ -442,7 +379,7 @@ Once that's done, run this in a terminal window:
npm run dev
```
-And then open the browser to [localhost:3000](http://localhost:3000) and you should see the completed app.
+And then open the browser to [localhost:5173](http://localhost:5173) and you should see the completed app.

@@ -455,132 +392,96 @@ Every Supabase project is configured with [Storage](/docs/guides/storage) for ma
Let's create an avatar for the user so that they can upload a profile photo. We can start by creating a new component:
```html title="src/components/Avatar.vue"
+
+
-
-
+
+
-
+
-
+
-
-
```
### Add the new widget
And then we can add the widget to the Account page:
-```html title="src/Profile.vue"
+```html title="src/components/Account.vue"
+
+
-
-
```
## Next steps
diff --git a/apps/reference/docusaurus.config.js b/apps/reference/docusaurus.config.js
index ba1093b6fb0..56e2df43582 100644
--- a/apps/reference/docusaurus.config.js
+++ b/apps/reference/docusaurus.config.js
@@ -14,7 +14,7 @@ const config = {
url: 'https://supabase.com',
baseUrl: baseUrl,
onBrokenLinks: 'throw',
- onBrokenMarkdownLinks: 'warn',
+ onBrokenMarkdownLinks: 'throw',
favicon: '/favicon.ico',
themes: ['docusaurus-theme-search-typesense'],
diff --git a/apps/reference/nav/_referenceSidebars.js b/apps/reference/nav/_referenceSidebars.js
index e0150208708..dc9252ce16b 100644
--- a/apps/reference/nav/_referenceSidebars.js
+++ b/apps/reference/nav/_referenceSidebars.js
@@ -4,7 +4,7 @@ const sidebars = {
type: 'category',
label: 'Overview',
collapsed: true,
- items: ['about', 'architecture', 'guides/examples'],
+ items: ['about', 'guides/features', 'architecture', 'guides/examples'],
},
{
type: 'category',
@@ -80,6 +80,7 @@ const sidebars = {
'guides/auth/row-level-security',
'guides/auth/managing-user-data',
'guides/auth/auth-captcha',
+ 'guides/auth/server-side-rendering',
],
},
{
@@ -215,22 +216,51 @@ const sidebars = {
label: 'Integrations',
collapsed: true,
items: [
- 'guides/integrations/appsmith',
- 'guides/integrations/auth0',
- 'guides/integrations/authsignal',
- 'guides/integrations/clerk',
- 'guides/integrations/dashibase',
- 'guides/integrations/directus',
- 'guides/integrations/draftbit',
- 'guides/integrations/pgmustard',
- 'guides/integrations/plasmic',
- 'guides/integrations/polyscale',
- 'guides/integrations/prisma',
- 'guides/integrations/sequin',
- 'guides/integrations/snaplet',
- 'guides/integrations/stytch',
- 'guides/integrations/supertokens',
- 'guides/integrations/vercel',
+ 'guides/integrations/integrations',
+ {
+ type: 'category',
+ label: 'Auth',
+ collapsed: true,
+ items: [
+ 'guides/integrations/auth0',
+ 'guides/integrations/authsignal',
+ 'guides/integrations/clerk',
+ 'guides/integrations/keyri',
+ 'guides/integrations/stytch',
+ 'guides/integrations/supertokens',
+ ],
+ },
+ {
+ type: 'category',
+ label: 'Caching / Offline-first',
+ collapsed: true,
+ items: ['guides/integrations/polyscale'],
+ },
+ {
+ type: 'category',
+ label: 'Developer Tools',
+ collapsed: true,
+ items: [
+ 'guides/integrations/pgmustard',
+ 'guides/integrations/prisma',
+ 'guides/integrations/sequin',
+ 'guides/integrations/snaplet',
+ 'guides/integrations/vercel',
+ ],
+ },
+ {
+ type: 'category',
+ label: 'Low-code',
+ collapsed: true,
+ items: [
+ 'guides/integrations/appsmith',
+ 'guides/integrations/dashibase',
+ 'guides/integrations/dhiwise',
+ 'guides/integrations/directus',
+ 'guides/integrations/draftbit',
+ 'guides/integrations/plasmic',
+ ],
+ },
],
},
],
diff --git a/apps/reference/static/img/guides/integrations/dhiwise/auth.gif b/apps/reference/static/img/guides/integrations/dhiwise/auth.gif
new file mode 100644
index 00000000000..db05bb42fca
Binary files /dev/null and b/apps/reference/static/img/guides/integrations/dhiwise/auth.gif differ
diff --git a/apps/reference/static/img/guides/integrations/dhiwise/authKeys.png b/apps/reference/static/img/guides/integrations/dhiwise/authKeys.png
new file mode 100644
index 00000000000..1ac402f5d9b
Binary files /dev/null and b/apps/reference/static/img/guides/integrations/dhiwise/authKeys.png differ
diff --git a/apps/reference/static/img/guides/integrations/dhiwise/create.png b/apps/reference/static/img/guides/integrations/dhiwise/create.png
new file mode 100644
index 00000000000..bcb06e5e5ee
Binary files /dev/null and b/apps/reference/static/img/guides/integrations/dhiwise/create.png differ
diff --git a/apps/reference/static/img/guides/integrations/dhiwise/newProj.png b/apps/reference/static/img/guides/integrations/dhiwise/newProj.png
new file mode 100644
index 00000000000..e3f5d8db355
Binary files /dev/null and b/apps/reference/static/img/guides/integrations/dhiwise/newProj.png differ
diff --git a/apps/reference/static/img/guides/integrations/dhiwise/select.png b/apps/reference/static/img/guides/integrations/dhiwise/select.png
new file mode 100644
index 00000000000..3de535da47e
Binary files /dev/null and b/apps/reference/static/img/guides/integrations/dhiwise/select.png differ
diff --git a/apps/www/README.md b/apps/www/README.md
index ab4de38784c..5505fe5a8a0 100644
--- a/apps/www/README.md
+++ b/apps/www/README.md
@@ -16,7 +16,6 @@ cd supabase
npm install
npm run dev
-
# visit website
http://localhost:3000
```
diff --git a/apps/www/_blog/2022-10-14-postgres-full-text-search-vs-the-rest.mdx b/apps/www/_blog/2022-10-14-postgres-full-text-search-vs-the-rest.mdx
index d14a3b671cb..f96545c783a 100644
--- a/apps/www/_blog/2022-10-14-postgres-full-text-search-vs-the-rest.mdx
+++ b/apps/www/_blog/2022-10-14-postgres-full-text-search-vs-the-rest.mdx
@@ -206,7 +206,7 @@ We'll focus on the end-user-centric meaning of performance here (query speed).
Postgres is capable of loading CSVs, but since we'll be using other search engines as well, let's convert to format that's much easier to use and process - [Newline Delimited JSON](https://dataprotocols.org/ndjson/).
-After a few lines of code and one `[csv2ndjson.mjs` script](https://github.com/VADOSWARE/fts-benchmark/blob/main/src/util/csv2ndjson.mjs) later, we have a `movies.ndjson.json` full of JSON documents that we can easily ingest into any search engine (or other database for that matter!).
+After a few lines of code and one [`csv2ndjson.mjs` script](https://github.com/VADOSWARE/fts-benchmark/blob/main/src/util/csv2ndjson.mjs) later, we have a `movies.ndjson.json` full of JSON documents that we can easily ingest into any search engine (or other database for that matter!).
### Inserting the data
diff --git a/apps/www/components/CaseStudies/benchmark.tsx b/apps/www/components/CaseStudies/benchmark.tsx
index 630e7b6e7cf..1e2a218bf1a 100644
--- a/apps/www/components/CaseStudies/benchmark.tsx
+++ b/apps/www/components/CaseStudies/benchmark.tsx
@@ -31,11 +31,6 @@ const Benchmark = () => {
- You can download the latest DPA document through our{' '}
- security portal, or by
- submitting your email here.
-
+
You can download our latest DPA document by submitting your email here.
{formSubmitted ? (
diff --git a/apps/www/pages/legal/soc2.tsx b/apps/www/pages/legal/soc2.tsx
index c58ebe4dfef..f5fc2a80fac 100644
--- a/apps/www/pages/legal/soc2.tsx
+++ b/apps/www/pages/legal/soc2.tsx
@@ -18,11 +18,7 @@ const SOC2 = () => {
getting certified for SOC2 Type 2 and HIPAA next.
-
- You can request for our latest SOC 2 document either through our{' '}
- security portal, or by submitting
- your request here.
-
+
You can request for our latest SOC 2 document by submitting your request here.
diff --git a/apps/www/pages/security.mdx b/apps/www/pages/security.mdx
index 43867d08290..19fc0f6fdeb 100644
--- a/apps/www/pages/security.mdx
+++ b/apps/www/pages/security.mdx
@@ -52,7 +52,7 @@ export const Section = ({ children, icon, img }) => (
### SOC 2
-Supabase is SOC2 Type 1 compliant. Enterprise customers can request a copy of our SOC2 through our [Security Portal](https://security.supabase.com).
+Supabase is SOC2 Type 1 compliant. Enterprise customers can request a copy of our SOC2 [here](https://supabase.com/legal/soc2).
@@ -126,8 +126,7 @@ In addition to internal security reviews, we use various tools to scan our code
Security Portal
-Access Supabase’s security and compliance documents on our Security Portal, such as
-penetration testing and audit reports.
+Access more of Supabase’s security information on our Security Portal, such as penetration testing and audit reports.