The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.
TypeScript aialternativeauthdatabasedenoembeddingsexamplefirebasenextjsoauth2pgvectorpostgispostgrespostgresqlpostgrestrealtimesupabasevectorswebsockets
removes unused files
Paul Copplestone233f9813edf7
diff --git a/web/docs/guides2/arrays.mdx b/web/docs/guides2/arrays.mdxdeleted file mode 100644index f9168738b42..00000000000--- a/web/docs/guides2/arrays.mdx+++ /dev/null@@ -1,212 +0,0 @@-----id: arrays-title: "Working With Arrays"-description: How to use arrays in PostgreSQL and the Supabase API.------import Tabs from '@theme/Tabs';-import TabItem from '@theme/TabItem';--### How to use arrays in PostgreSQL and the Supabase API.--## Description--PostgreSQL supports flexible [array types](https://www.postgresql.org/docs/12/arrays.html). You can use arrays in your PostgreSQL tables in the Supabase dashboard and in the Javascript API.--## Environment--* Supabase JS Client-* Supabase (or any PostgreSQL) backend-* Supabase Dashboard (UI)---## Requirements-* Supabase account or self-hosted Supabase instance-* Javascript-based client application (Angular, React, Vue, etc.)---## Steps--### Create a table with an array column--Create a test table with a text array (an array of strings):--<Tabs-defaultValue="UI"-values={[- {label: 'UI', value: 'UI'},- {label: 'SQL', value: 'SQL'},-]}>--<TabItem value="UI">--- Table Editor-- New Table-- Create a new table named `arraytest` and save the table- - New Column- - Name the new column `textarray`- - Make it type `text`- - Check the box labelled `Define as array`- - Save the new column--</TabItem>--<TabItem value="SQL">--```sql-CREATE TABLE arraytest (id integer NOT NULL, textarray text ARRAY);-```--</TabItem>-</Tabs>------### Insert a record with an array value---<Tabs-defaultValue="UI"-values={[- {label: 'UI', value: 'UI'},- {label: 'SQL', value: 'SQL'},- {label: 'JS', value: 'JavaScript'},-]}>--<TabItem value="UI">--- Table Editor-- Select `arraytest`-- Insert Row- - In the `textarray` field input, paste:- - `["Harry", "Larry", "Moe"]`- - Save the new row---</TabItem>--<TabItem value="SQL">--```sql-INSERT INTO arraytest (id, textarray) VALUES (1, ARRAY['Harry', 'Larry', 'Moe']);-```--</TabItem>--<TabItem value="JavaScript">-To insert a record from the Javascript client:--```js-const { data, error } = await supabase-.from('arraytest')-.insert([- { id: 2, textarray: ['one', 'two', 'three', 'four'] }-]);-```--</TabItem>--</Tabs>---### View the results---<Tabs-defaultValue="UI"-values={[- {label: 'UI', value: 'UI'},- {label: 'SQL', value: 'SQL'},-]}>--<TabItem value="UI">--- Table Editor-- Select `arraytest`--Your first array data!--| id | textarray |-| --- | ---------------------------- |-| 1 | ["Harry","Larry","Moe"] |--</TabItem>-<TabItem value="SQL">--```sql-SELECT * FROM arraytest;-```--Your first array data!--| id | textarray |-| --- | ---------------------------- |-| 1 | ["Harry","Larry","Moe"] |--</TabItem>-</Tabs>---### Query Array Data--To query an array, PostgreSQL uses 1-based arrays, so be careful, since you're probably used to 0-based arrays in Javascript.--<Tabs-defaultValue="UI"-values={[- {label: 'SQL', value: 'SQL'},- {label: 'JS', value: 'JavaScript'},-]}>--<TabItem value="SQL">--To select the first item from the array and get the total length of the array:--```js-SELECT textarray[1], array_length(textarray, 1) FROM arraytest;-```--returns:--| textarray | array_length |-| --------- | ------------ |-| Harry | 3 |--</TabItem>-<TabItem value="JavaScript">--This returns the entire array field:--```js-const { data, error } = await supabase-.from('arraytest')-.select('textarray[]');-console.log(JSON.stringify(data,null,2));-```--returns:--```js-[- {- "textarray": ["Harry", "Larry", "Moe"]- }-]-```---</TabItem>--</Tabs>--## Resources--* [Supabase JS Client](https://github.com/supabase/supabase-js)-* [Supabase Account - Free Tier OK](https://supabase.io)-* [PostgreSQL Arrays](https://www.postgresql.org/docs/12/arrays.html)----diff --git a/web/docs/guides2/auth-facebook.mdx b/web/docs/guides2/auth-facebook.mdxdeleted file mode 100644index 0f756cdf3c3..00000000000--- a/web/docs/guides2/auth-facebook.mdx+++ /dev/null@@ -1,116 +0,0 @@-----id: auth-facebook-title: "Facebook Login"-description: Setting up Facebook Login------import Tabs from '@theme/Tabs';-import TabItem from '@theme/TabItem';--### Setting up Facebook Login--## Description--Adding a Facebook Login button to your application is easy if you follow these steps.--The setup process consists of three parts:--* Create and configure a Facebook Application on the [Facebook Devalopers Site](https://developers.facebook.com)-* Add your Facebook keys to your [Supabase Project](https://supabase.io)-* Add the login code to your [Supabase JS Client App](https://github.com/supabase/supabase-js)--## Environment--* [Supabase JS Client](https://github.com/supabase/supabase-js)-* [Supabase Dashboard (UI)](https://supabase.io)-* [Facebook Developers Dashboard](https://developers.facebook.com/)--## Requirements-* Supabase account (Free Tier OK)-* Any existing Supabase Project-* Javascript-based client application (Angular, React, Vue, etc.)--## Steps--### Create a Facebook Developer Account--First, you'll need a Developer Account at [https://developers.facebook.com](https://developers.facebook.com).--### Create a Facebook App--Once logged into *"Facebook for Developers"*:--- Click on "My Apps" at the top right.-- Click "Create App" near the top right.-- Select your app type and click "Continue".-- Fill in your app information, then click "Create App".-- This should bring you to the screen: "Add Products to Your App". (Alternatively you can click on "Add Product" in the left sidebar to get to this screen.)--### Set up FaceBook Login for your Facebook App--From the "Add Products to your App" screen:--- Click "Setup" under "Facebook Login"-- Skip the Quickstart screen, instead, in the left sidebar, click "Settings" under "Facebook Login"-- Enter your callback URI under "Valid OAuth Redirect URIs" on the "Facebook Login Settings" page- - Your OAuth Redirect URI looks like this:- - https://xxxxxxxxxxxxxxxx.supabase.co/auth/v1/callback- - where https://xxxxxxxxxxxxxxxx.supabase.co is your Supabase Project API URL- - Go to your [Supasebase Project Dashboard](https://supabase.io)- - Click on the "Settings" icon at the bottom of the left sidebar- - Click on "API" in the list- - Under Config / URL you'll find your API URL, you can click "Copy" to copy it to the clipboard- - Now just add "/auth/v1/callback" to the end of that to get your full "OAuth Redirect URI"- - Enter this in the "Valid OAuth Redirect URIs" box- - Click "Save Changes" at the bottom right--### Copy your Facebook App ID and Secret--- Click "Settings / Basic" in the left sidebar-- Copy your App ID from the top of the "Basic Settings" page-- Under "App Secret" click "Show" then copy your secret-- Make sure all required fields are completed on this screen.--### Enter your Facebook App ID and Secret into your Supabase Project--- Go to your [Supasebase Project Dashboard](https://supabase.io)-- In the left sidebar, click the "Authentication" icon (near the top)-- Click "Settings" from the list to go to the "Authentication Settings" page-- Enter the final (hosted) URL of your app under "Site URL" (this is important)-- Under "External OAuth Providers" turn "Facebook Enabled" to ON-- Enter your "Facebook client ID" and "Facebook secret" saved in the previous step-- Click "Save"--### Add login code to your client app--The JavaScript client code is documented here: [Supabase OAuth Client Code](https://supabase.io/docs/reference/javascript/auth-signin#sign-in-using-third-party-providers)--```js-const { user, session, error } = await supabase.auth.signIn({- provider: 'facebook'-})-```--Just put this code in a function and create a button or a link or any other UI element to call the function.--```js-function signInWithFacebook() {- const { user, session, error } = await supabase.auth.signIn({- provider: 'facebook'- });-}-```--To log out:--```js-function signout() {- const { error } = await supabase.auth.signOut();-}-```--## Resources--* [Supabase Account - Free Tier OK](https://supabase.io)-* [Supabase JS Client](https://github.com/supabase/supabase-js)-* [Facebook Developers Dashboard](https://developers.facebook.com/)\ No newline at end of filediff --git a/web/docs/guides2/json.mdx b/web/docs/guides2/json.mdxdeleted file mode 100644index fab21f38202..00000000000--- a/web/docs/guides2/json.mdx+++ /dev/null@@ -1,383 +0,0 @@-----id: json-title: "Working With JSON Data"-description: How to use JSON Data in PostgreSQL and the Supabase Javascript API.------import Tabs from '@theme/Tabs';-import TabItem from '@theme/TabItem';--### How to use JSON Data in PostgreSQL and the Supabase Javascript API.--## Description--PostgreSQL supports [JSON functions and operators](https://www.postgresql.org/docs/12/functions-json.html) that can give you nearly unlimited flexiblity when storing data inside a database column. In this document you'll learn how to:--* create database columns that store JSON data-* insert JSON data into a database-* query JSON data stored in a database--PostgreSQL supports two types of JSON columns: JSON and JSONB. The recommended type is JSONB, so that's what we'll be using throughout this document.--> The json data type stores an exact copy of the input text, which processing functions must reparse on each execution; while jsonb data is stored in a decomposed binary format that makes it slightly slower to input due to added conversion overhead, but significantly faster to process, since no reparsing is needed. jsonb also supports indexing, which can be a significant advantage.--From: [PostgreSQL JSON types](https://www.postgresql.org/docs/12/datatype-json.html)--## Environment--* Supabase JS Client-* Supabase (or any PostgreSQL) backend-* Supabase Dashboard (UI)---## Requirements-* Supabase account or self-hosted Supabase instance-* Javascript-based client application (Angular, React, Vue, etc.)---## Steps--### Create a table with a JSON column.--<Tabs-defaultValue="UI"-values={[- {label: 'UI', value: 'UI'},- {label: 'SQL', value: 'SQL'},-]}>-<TabItem value="UI">--- Table Editor-- New Table-- Create a new table named `game_log`- - include primary key `id`, type `UUID`, default value `Automatically generate UUID`- - Save the new table- - New Column- - Name the new column `game_data`- - Make it type `JSONB`- - Save the new column- - Add the other columns used by this demo- - game_date type DATE- - home_team type TEXT- - visiting_team type TEXT--</TabItem>-<TabItem value="SQL">--```sql-CREATE TABLE game_log (- id UUID DEFAULT uuid_generate_v4() NOT NULL,- game_date DATE,- home_team TEXT,- visiting_team TEXT,- game_data JSONB-);-```--</TabItem>--</Tabs>--### Insert data into the table:--<Tabs-defaultValue="UI"-values={[- {label: 'UI', value: 'UI'},- {label: 'SQL', value: 'SQL'},- {label: 'JS', value: 'JavaScript'},-]}>-<TabItem value="UI">--- Table Editor-- Select `game_log`-- Insert Row- - game_date: 2021-06-02- - home_team: 'Chicago Cubs'- - visiting_team: 'San Diego Padres'- - game_data: [COPY AND PASTE THE JSON BLOCK]-- ```js- {- "winning_pitcher": "Alzolay",- "losing_pitcher": "Johnson",- "final_score": {- "visitors": {"runs": 1, "hits": 5, "errors": 2},- "home": {"runs": 6, "hits": 9, "errors": 0}- },- "innings": {- "visitors": [0,0,0,1,0,0,0,0,0],- "home": [0,0,0,1,2,0,3,0]}- }- ```-- - Save the new row--</TabItem>--<TabItem value="SQL">--```sql-INSERT into game_log (game_date, home_team, visiting_team, game_data)-values (-'2021-06-02',-'Chicago Cubs',-'San Diego Padres',-'{"winning_pitcher": "Alzolay",- "losing_pitcher": "Johnson",- "final_score": {- "visitors": {"runs": 1, "hits": 5, "errors": 2},- "home": {"runs": 6, "hits": 9, "errors": 0}- },- "innings": {- "visitors": [0,0,0,1,0,0,0,0,0],- "home": [0,0,0,1,2,0,3,0]}- }'-);-```--</TabItem>-<TabItem value="JavaScript">--```js-const { data, error } = await supabase-.from('game_log')-.insert([{- game_date: '2021-06-02',- home_team: 'Chicago Cubs',- visiting_team: 'San Diego Padres',- game_data: {- "winning_pitcher": "Alzolay",- "losing_pitcher": "Johnson",- "final_score": {- "visitors": {"runs": 1, "hits": 5, "errors": 2},- "home": {"runs": 6, "hits": 9, "errors": 0}- },- "innings": {- "visitors": [0,0,0,1,0,0,0,0,0],- "home": [0,0,0,1,2,0,3,0]- }- }-}]);-```--</TabItem>-</Tabs>----### View the data:--<Tabs-defaultValue="SQL"-values={[- {label: 'SQL', value: 'SQL'},- {label: 'JS', value: 'JavaScript'},-]}>-<TabItem value="SQL">--```sql-SELECT * FROM game_log;-```--Resuls:--| id | game_date | home_team | visiting_team | game_data |-| ------------------------------------ | ------------------------ | ------------ | ---------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |-| 24550f27-28d2-46f3-b577-aeede4614018 | 2021-06-02T00:00:00.000Z | Chicago Cubs | San Diego Padres | {"innings":{"home":[0,0,0,1,2,0,3,0],"visitors":[0,0,0,1,0,0,0,0,0]},"final_score":{"home":{"hits":9,"runs":6,"errors":0},"visitors":{"hits":5,"runs":1,"errors":2}},"losing_pitcher":"Johnson","winning_pitcher":"Alzolay"} |--</TabItem>-<TabItem value="JavaScript">--```js-const { data, error } = await supabase-.from('game_log')-.select('*');-console.log(JSON.stringify(data,null,2));-```--Results:--```js-[- {- "id": "a4c577bc-4343-440d-8f8b-9fef0af225cc",- "game_date": "2021-06-02",- "home_team": "Chicago Cubs",- "visiting_team": "San Diego Padres",- "game_data": {- "innings": {- "home": [0,0,0,1,2,0,3,0],- "visitors": [0,0,0,1,0,0,0,0,0]- },- "final_score": {- "home": {"hits": 9, "runs": 6, "errors": 0},- "visitors": {"hits": 5, "runs": 1, "errors": 2}- },- "losing_pitcher": "Johnson",- "winning_pitcher": "Alzolay"- }- }-]-```--</TabItem>-</Tabs>--### Select the winning pitcher from the JSONB field:--<Tabs-defaultValue="SQL"-values={[- {label: 'SQL', value: 'SQL'},- {label: 'JS', value: 'JavaScript'},-]}>-<TabItem value="SQL">--```sql-SELECT game_data -> 'winning_pitcher' AS winning_pitcher FROM game_log;-```--Resuls:--| winning_pitcher |-| --------------- |-| Alzolay |--</TabItem>-<TabItem value="JavaScript">--```js-const { data, error } = await supabase-.from('game_log')-.select('game_data->winning_pitcher');-console.log(JSON.stringify(data,null,2));-```--Results:--```js-[- {- "winning_pitcher": "Alzolay"- }-]-```--</TabItem>-</Tabs>---### Get the final scores:--<Tabs-defaultValue="SQL"-values={[- {label: 'SQL', value: 'SQL'},- {label: 'JS', value: 'JavaScript'},-]}>-<TabItem value="SQL">--```sql-SELECT- visiting_team,- game_data -> 'final_score' -> 'visitors' -> 'runs' as visitors_runs,- home_team,- game_data -> 'final_score' -> 'home' -> 'runs' as home_runs-FROM game_log;-```--Results:--| visiting_team | visitors_runs | home_team | home_runs |-| ---------------- | ------------- | ------------ | --------- |-| San Diego Padres | 1 | Chicago Cubs | 6 |--</TabItem>-<TabItem value="JavaScript">--```js-const { data, error } = await supabase-.from('game_log')-.select('visiting_team, visitors_runs:game_data->final_score->visitors->runs, home_team, home_runs:game_data->final_score->home->runs');-console.log(JSON.stringify(data,null,2));-```--Results:--```js-[- {- "visiting_team": "San Diego Padres",- "visitors_runs": 1,- "home_team": "Chicago Cubs",- "home_runs": 6- }-]-```--</TabItem>-</Tabs>----### How many runs did the home team score in the 7th inning?-(Note that data is stored in a zero-based array, so to get data from the 7th inning, we use a 6.)--<Tabs-defaultValue="SQL"-values={[- {label: 'SQL', value: 'SQL'},- {label: 'JS', value: 'JavaScript'},-]}>-<TabItem value="SQL">--```sql-SELECT home_team,-game_data -> 'innings' -> 'home' -> 6 as seventh_inning-FROM game_log;-```--Results:--| home_team | seventh_inning |-| ------------ | -------------- |-| Chicago Cubs | 3 |--</TabItem>-<TabItem value="JavaScript">--```js-const { data, error } = await this.supabase-.from('game_log')-.select('home_team, seventh_inning_runs:game_data->innings->home->6');-console.log(JSON.stringify(data,null,2));-```--Results:--```js-[- {- "home_team": "Chicago Cubs",- "seventh_inning_runs": 3- }-]-```--</TabItem>-</Tabs>---#### Data Types-One last thing to note: the -> operator return JSONB data. If you want TEXT/STRING data returned, you need to use the ->> operator.--- game_data -> 'winning_pitcher' (this returns a JSON object)-- game_data ->> 'winning_pitcher' (this returns STRING/TEXT data)--## Resources--* [Supabase Account - Free Tier OK](https://supabase.io)-* [Supabase JS Client](https://github.com/supabase/supabase-js)-* [PostgreSQL: JSON Functions and Operators](https://www.postgresql.org/docs/12/functions-json.html)-* [PostgreSQL JSON types](https://www.postgresql.org/docs/12/datatype-json.html)diff --git a/web/docs/guides2/password-reset.mdx b/web/docs/guides2/password-reset.mdxdeleted file mode 100644index 277fbf06df5..00000000000--- a/web/docs/guides2/password-reset.mdx+++ /dev/null@@ -1,57 +0,0 @@-----id: password-reset-title: "Reset Database Password"-description: How to change your PostgreSQL database password.------import Tabs from '@theme/Tabs';-import TabItem from '@theme/TabItem';--### How to change your PostgreSQL database password.--## Description--Your PostgreSQL database is the core of your Supabase project, so it's important to make sure it has a strong, secure password at all times. Changing the password is easy -- just make sure you choose a password that:--* is very secure-* does not contain of the following symbols: **: / ? # ] [ @ ! $ & ' ( ) * + , ; =**--These special symbols can conflict with connection string URLs or cause other problems, so it's best to avoid them. You can still make a secure password using a longer string or a randomized set of upper and lowercase letters and digits.--## Environment-* Any PostgreSQL database-* Any Supabase project--## Steps--Issue the following statement in a SQL editor:--From the [Supabase Dashboard](https://supabase.io):-- Home-- Select a Project-- SQL-- New Query--<Tabs-defaultValue="SQL"-values={[- {label: 'SQL', value: 'SQL'},-]}>--<TabItem value="SQL">--```sql-ALTER USER postgres WITH PASSWORD 'new_password';-```--</TabItem>-</Tabs>---Be sure to remember your password or store it in a secure place.--## Resources--* [Supabase Account - Free Tier OK](https://supabase.io)-* [PostgreSQL ALTER USER Documentation](https://www.postgresql.org/docs/12/sql-alteruser.html)-