The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.
TypeScript aialternativeauthdatabasedenoembeddingsexamplefirebasenextjsoauth2pgvectorpostgispostgrespostgresqlpostgrestrealtimesupabasevectorswebsockets
docs(quickstarts): add rls policy step (#28196)
Charis985ed134560d
diff --git a/apps/docs/components/MDX/partials.tsx b/apps/docs/components/MDX/partials.tsxindex 7b10795e752..f7a6e738c0f 100644--- a/apps/docs/components/MDX/partials.tsx+++ b/apps/docs/components/MDX/partials.tsx@@ -9,6 +9,7 @@ import KotlinProjectSetup from './kotlin_project_setup.mdx'import MigrationWarnings from './migration_warnings.mdx'import OAuthPkceFlow from './oauth_pkce_flow.mdx'import ProjectSetup from './project_setup.mdx'+import QuickstartDbSetup from './quickstart_db_setup.mdx'import QuickstartIntro from './quickstart_intro.mdx'import SocialProviderSettingsSupabase from './social_provider_settings_supabase.mdx'import SocialProviderSetup from './social_provider_setup.mdx'@@ -23,6 +24,7 @@ export {MigrationWarnings,ProjectSetup,OAuthPkceFlow,+ QuickstartDbSetup,QuickstartIntro,SocialProviderSettingsSupabase,SocialProviderSetup,diff --git a/apps/docs/components/MDX/quickstart_db_setup.mdx b/apps/docs/components/MDX/quickstart_db_setup.mdxnew file mode 100644index 00000000000..429787a8b68--- /dev/null+++ b/apps/docs/components/MDX/quickstart_db_setup.mdx@@ -0,0 +1,46 @@+<StepHikeCompact.Details title="Create a Supabase project">++Go to [database.new](https://database.new) and create a new Supabase project.++When your project is up and running, go to the [Table Editor](https://supabase.com/dashboard/project/_/editor), create a new table and insert some data.++Alternatively, you can run the following snippet in your project's [SQL Editor](https://supabase.com/dashboard/project/_/sql/new). This will create a `countries` table with some sample data.++</StepHikeCompact.Details>++<StepHikeCompact.Code>++ ```sql SQL_EDITOR+ -- Create the table+ create table countries (+ id bigint primary key generated always as identity,+ name text not null+ );+ -- Insert some sample data into the table+ insert into countries (name)+ values+ ('Canada'),+ ('United States'),+ ('Mexico');++ alter table countries enable row level security;+ ```++</StepHikeCompact.Code>++<StepHikeCompact.Details>++Make the data in your table publicly readable by adding an RLS policy:++</StepHikeCompact.Details>++<StepHikeCompact.Code>++ ```sql SQL_EDITOR+ create policy "public can read countries"+ on public.countries+ for select to anon+ using (true);+ ```++</StepHikeCompact.Code>diff --git a/apps/docs/content/guides/getting-started/quickstarts/flutter.mdx b/apps/docs/content/guides/getting-started/quickstarts/flutter.mdxindex de0e8ddb7bd..c9ca79c5b34 100644--- a/apps/docs/content/guides/getting-started/quickstarts/flutter.mdx+++ b/apps/docs/content/guides/getting-started/quickstarts/flutter.mdx@@ -8,29 +8,8 @@ hideToc: true<StepHikeCompact><StepHikeCompact.Step step={1}>- <StepHikeCompact.Details title="Set up a Supabase project with sample data">-- [Create a new project](https://supabase.com/dashboard) in the Supabase Dashboard.-- After your project is ready, create a table in your Supabase database using the [SQL Editor](https://supabase.com/dashboard/project/_/sql) in the Dashboard. Use the following SQL statement to create a `countries` table with some sample data.-- </StepHikeCompact.Details>-- <StepHikeCompact.Code>-- ```sql SQL_EDITOR- -- Create the table- CREATE TABLE countries (- id SERIAL PRIMARY KEY,- name VARCHAR(255) NOT NULL- );- -- Insert some sample data into the table- INSERT INTO countries (name) VALUES ('United States');- INSERT INTO countries (name) VALUES ('Canada');- INSERT INTO countries (name) VALUES ('Mexico');- ````-- </StepHikeCompact.Code>++ <QuickstartDbSetup /></StepHikeCompact.Step>diff --git a/apps/docs/content/guides/getting-started/quickstarts/ios-swiftui.mdx b/apps/docs/content/guides/getting-started/quickstarts/ios-swiftui.mdxindex 7a7199d3f78..3563c9b5d29 100644--- a/apps/docs/content/guides/getting-started/quickstarts/ios-swiftui.mdx+++ b/apps/docs/content/guides/getting-started/quickstarts/ios-swiftui.mdx@@ -8,29 +8,8 @@ hideToc: true<StepHikeCompact><StepHikeCompact.Step step={1}>- <StepHikeCompact.Details title="Set up a Supabase project with sample data">-- [Create a new project](https://supabase.com/dashboard) in the Supabase Dashboard.-- After your project is ready, create a table in your Supabase database using the [SQL Editor](https://supabase.com/dashboard/project/_/sql) in the Dashboard. Use the following SQL statement to create a `countries` table with some sample data.-- </StepHikeCompact.Details>-- <StepHikeCompact.Code>-- ```sql SQL_EDITOR- -- Create the table- CREATE TABLE countries (- id SERIAL PRIMARY KEY,- name VARCHAR(255) NOT NULL- );- -- Insert some sample data into the table- INSERT INTO countries (name) VALUES ('United States');- INSERT INTO countries (name) VALUES ('Canada');- INSERT INTO countries (name) VALUES ('Mexico');- ````-- </StepHikeCompact.Code>++ <QuickstartDbSetup /></StepHikeCompact.Step>diff --git a/apps/docs/content/guides/getting-started/quickstarts/kotlin.mdx b/apps/docs/content/guides/getting-started/quickstarts/kotlin.mdxindex d0d1066fb22..45998483259 100644--- a/apps/docs/content/guides/getting-started/quickstarts/kotlin.mdx+++ b/apps/docs/content/guides/getting-started/quickstarts/kotlin.mdx@@ -8,29 +8,8 @@ hideToc: true<StepHikeCompact><StepHikeCompact.Step step={1}>- <StepHikeCompact.Details title="Set up a Supabase project">-- [Create a new project](https://app.supabase.com) in the Supabase Dashboard.-- After your project is ready, create a table in your Supabase database using the [SQL Editor](https://app.supabase.com/project/_/sql) in the Dashboard. Use the following SQL statement to create all tables.-- </StepHikeCompact.Details>-- <StepHikeCompact.Code>-- ```sql SQL_EDITOR- -- Create the table- CREATE TABLE countries (- id SERIAL PRIMARY KEY,- name VARCHAR(255) NOT NULL- );- -- Insert some sample data into the table- INSERT INTO countries (name) VALUES ('United States');- INSERT INTO countries (name) VALUES ('Canada');- INSERT INTO countries (name) VALUES ('Mexico');- ```-- </StepHikeCompact.Code>++ <QuickstartDbSetup /></StepHikeCompact.Step>diff --git a/apps/docs/content/guides/getting-started/quickstarts/nextjs.mdx b/apps/docs/content/guides/getting-started/quickstarts/nextjs.mdxindex 394e8d0ed2a..83917c4fc10 100644--- a/apps/docs/content/guides/getting-started/quickstarts/nextjs.mdx+++ b/apps/docs/content/guides/getting-started/quickstarts/nextjs.mdx@@ -8,32 +8,52 @@ hideToc: true<StepHikeCompact><StepHikeCompact.Step step={1}>- <StepHikeCompact.Details title="Set up a Supabase project">++ <StepHikeCompact.Details title="Create a Supabase project">- Head over to [database.new](https://database.new) and create a new Supabase project.+ Go to [database.new](https://database.new) and create a new Supabase project.- When your project is up and running, navigate to the [Table Editor](https://supabase.com/dashboard/project/_/editor), create a new table and insert some data.+ When your project is up and running, go to the [Table Editor](https://supabase.com/dashboard/project/_/editor), create a new table and insert some data.- Alternatively, you can run the following snippet in your project's [SQL Editor](https://supabase.com/dashboard/project/_/sql/new). This will create a `notes` table with some sample data.+ Alternatively, you can run the following snippet in your project's [SQL Editor](https://supabase.com/dashboard/project/_/sql/new). This will create a `notes` table with some sample data.</StepHikeCompact.Details><StepHikeCompact.Code>- ```sql SQL_EDITOR+ ```sql SQL_EDITOR-- Create the tablecreate table notes (- id serial primary key,- title text+ id bigint primary key generated always as identity,+ title text not null);- -- Insert some sample data+ -- Insert some sample data into the tableinsert into notes (title)values('Today I created a Supabase project.'),('I added some data and queried it from Next.js.'),('It was awesome!');- ````++ alter table notes enable row level security;+ ```++ </StepHikeCompact.Code>++ <StepHikeCompact.Details>++ Make the data in your table publicly readable by adding an RLS policy:++ </StepHikeCompact.Details>++ <StepHikeCompact.Code>++ ```sql SQL_EDITOR+ create policy "public can read notes"+ on public.notes+ for select to anon+ using (true);+ ```</StepHikeCompact.Code>diff --git a/apps/docs/content/guides/getting-started/quickstarts/nuxtjs.mdx b/apps/docs/content/guides/getting-started/quickstarts/nuxtjs.mdxindex 152d9ab5846..cbb726b72fb 100644--- a/apps/docs/content/guides/getting-started/quickstarts/nuxtjs.mdx+++ b/apps/docs/content/guides/getting-started/quickstarts/nuxtjs.mdx@@ -8,30 +8,8 @@ hideToc: true<StepHikeCompact><StepHikeCompact.Step step={1}>- <StepHikeCompact.Details title="Set up a Supabase project with sample data">-- [Create a new project](https://supabase.com/dashboard) in the Supabase Dashboard.-- After your project is ready, create a table in your Supabase database using the [SQL Editor](https://supabase.com/dashboard/project/_/sql) in the Dashboard. Use the following SQL statement to create a `countries` table with some sample data.-- </StepHikeCompact.Details>-- <StepHikeCompact.Code>-- ```sql Editor- -- Create the table- create table countries (- id serial primary key,- name varchar(255) not null- );-- -- Insert some sample data into the table- insert into countries (name) values ('United States');- insert into countries (name) values ('Canada');- insert into countries (name) values ('Mexico');- ````-- </StepHikeCompact.Code>++ <QuickstartDbSetup /></StepHikeCompact.Step>diff --git a/apps/docs/content/guides/getting-started/quickstarts/reactjs.mdx b/apps/docs/content/guides/getting-started/quickstarts/reactjs.mdxindex d8d185ce0f1..dfebf4a9fe8 100644--- a/apps/docs/content/guides/getting-started/quickstarts/reactjs.mdx+++ b/apps/docs/content/guides/getting-started/quickstarts/reactjs.mdx@@ -8,29 +8,8 @@ hideToc: true<StepHikeCompact><StepHikeCompact.Step step={1}>- <StepHikeCompact.Details title="Set up a Supabase project with sample data">-- [Create a new project](https://supabase.com/dashboard) in the Supabase Dashboard.-- After your project is ready, create a table in your Supabase database using the [SQL Editor](https://supabase.com/dashboard/project/_/sql) in the Dashboard. Use the following SQL statement to create a `countries` table with some sample data.-- </StepHikeCompact.Details>-- <StepHikeCompact.Code>-- ```sql SQL_EDITOR- -- Create the table- CREATE TABLE countries (- id SERIAL PRIMARY KEY,- name VARCHAR(255) NOT NULL- );- -- Insert some sample data into the table- INSERT INTO countries (name) VALUES ('United States');- INSERT INTO countries (name) VALUES ('Canada');- INSERT INTO countries (name) VALUES ('Mexico');- ````-- </StepHikeCompact.Code>++ <QuickstartDbSetup /></StepHikeCompact.Step>diff --git a/apps/docs/content/guides/getting-started/quickstarts/refine.mdx b/apps/docs/content/guides/getting-started/quickstarts/refine.mdxindex 2938726359c..b039f19a5cb 100644--- a/apps/docs/content/guides/getting-started/quickstarts/refine.mdx+++ b/apps/docs/content/guides/getting-started/quickstarts/refine.mdx@@ -8,29 +8,8 @@ hideToc: true<StepHikeCompact><StepHikeCompact.Step step={1}>- <StepHikeCompact.Details title="Set up a Supabase project with sample data">-- [Create a new project](https://app.supabase.com) in the Supabase Dashboard.-- After your project is ready, create a table in your Supabase database using the [SQL Editor](https://app.supabase.com/project/_/sql) in the Dashboard. Use the following SQL statement to create a `countries` table with some sample data.-- </StepHikeCompact.Details>-- <StepHikeCompact.Code>-- ```sql SQL_EDITOR- -- Create the table- CREATE TABLE countries (- id SERIAL PRIMARY KEY,- name VARCHAR(255) NOT NULL- );- -- Insert some sample data into the table- INSERT INTO countries (name) VALUES ('United States');- INSERT INTO countries (name) VALUES ('Canada');- INSERT INTO countries (name) VALUES ('Mexico');- ````-- </StepHikeCompact.Code>++ <QuickstartDbSetup /></StepHikeCompact.Step>diff --git a/apps/docs/content/guides/getting-started/quickstarts/solidjs.mdx b/apps/docs/content/guides/getting-started/quickstarts/solidjs.mdxindex 7299f094012..f5c13f9f771 100644--- a/apps/docs/content/guides/getting-started/quickstarts/solidjs.mdx+++ b/apps/docs/content/guides/getting-started/quickstarts/solidjs.mdx@@ -8,29 +8,8 @@ hideToc: true<StepHikeCompact><StepHikeCompact.Step step={1}>- <StepHikeCompact.Details title="Set up a Supabase project with sample data">-- [Create a new project](https://supabase.com/dashboard) in the Supabase Dashboard.-- After your project is ready, create a table in your Supabase database using the [SQL Editor](https://supabase.com/dashboard/project/_/sql) in the Dashboard. Use the following SQL statement to create a `countries` table with some sample data.-- </StepHikeCompact.Details>-- <StepHikeCompact.Code>-- ```sql SQL_EDITOR- -- Create the table- CREATE TABLE countries (- id SERIAL PRIMARY KEY,- name VARCHAR(255) NOT NULL- );- -- Insert some sample data into the table- INSERT INTO countries (name) VALUES ('United States');- INSERT INTO countries (name) VALUES ('Canada');- INSERT INTO countries (name) VALUES ('Mexico');- ````-- </StepHikeCompact.Code>++ <QuickstartDbSetup /></StepHikeCompact.Step>diff --git a/apps/docs/content/guides/getting-started/quickstarts/sveltekit.mdx b/apps/docs/content/guides/getting-started/quickstarts/sveltekit.mdxindex 2082280150e..833df3d0817 100644--- a/apps/docs/content/guides/getting-started/quickstarts/sveltekit.mdx+++ b/apps/docs/content/guides/getting-started/quickstarts/sveltekit.mdx@@ -8,29 +8,8 @@ hideToc: true<StepHikeCompact><StepHikeCompact.Step step={1}>- <StepHikeCompact.Details title="Set up a Supabase project with sample data">-- [Create a new project](https://supabase.com/dashboard) in the Supabase Dashboard.-- After your project is ready, create a table in your Supabase database using the [SQL Editor](https://supabase.com/dashboard/project/_/sql) in the Dashboard. Use the following SQL statement to create a `countries` table with some sample data.-- </StepHikeCompact.Details>-- <StepHikeCompact.Code>-- ```sql SQL_EDITOR- -- Create the table- CREATE TABLE countries (- id SERIAL PRIMARY KEY,- name VARCHAR(255) NOT NULL- );- -- Insert some sample data into the table- INSERT INTO countries (name) VALUES ('United States');- INSERT INTO countries (name) VALUES ('Canada');- INSERT INTO countries (name) VALUES ('Mexico');- ````-- </StepHikeCompact.Code>++ <QuickstartDbSetup /></StepHikeCompact.Step>diff --git a/apps/docs/content/guides/getting-started/quickstarts/vue.mdx b/apps/docs/content/guides/getting-started/quickstarts/vue.mdxindex d9e5e9a2381..4d7443dd468 100644--- a/apps/docs/content/guides/getting-started/quickstarts/vue.mdx+++ b/apps/docs/content/guides/getting-started/quickstarts/vue.mdx@@ -8,29 +8,8 @@ hideToc: true<StepHikeCompact><StepHikeCompact.Step step={1}>- <StepHikeCompact.Details title="Set up a Supabase project with sample data">-- [Create a new project](https://supabase.com/dashboard) in the Supabase Dashboard.-- After your project is ready, create a table in your Supabase database using the [SQL Editor](https://supabase.com/dashboard/project/_/sql) in the Dashboard. Use the following SQL statement to create a `countries` table with some sample data.-- </StepHikeCompact.Details>-- <StepHikeCompact.Code>-- ```sql SQL_EDITOR- -- Create the table- CREATE TABLE countries (- id SERIAL PRIMARY KEY,- name VARCHAR(255) NOT NULL- );- -- Insert some sample data into the table- INSERT INTO countries (name) VALUES ('United States');- INSERT INTO countries (name) VALUES ('Canada');- INSERT INTO countries (name) VALUES ('Mexico');- ````-- </StepHikeCompact.Code>++ <QuickstartDbSetup /></StepHikeCompact.Step>diff --git a/apps/docs/features/docs/MdxBase.shared.tsx b/apps/docs/features/docs/MdxBase.shared.tsxindex e8adc4606cb..1ae939c5b8a 100644--- a/apps/docs/features/docs/MdxBase.shared.tsx+++ b/apps/docs/features/docs/MdxBase.shared.tsx@@ -22,6 +22,7 @@ import {MigrationWarnings,ProjectSetup,OAuthPkceFlow,+ QuickstartDbSetup,QuickstartIntro,SocialProviderSettingsSupabase,SocialProviderSetup,@@ -67,6 +68,7 @@ const components = {OAuthPkceFlow,ProjectConfigVariables,ProjectSetup,+ QuickstartDbSetup,QuickstartIntro,RealtimeLimitsEstimator,RegionsList,