The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.
TypeScript aialternativeauthdatabasedenoembeddingsexamplefirebasenextjsoauth2pgvectorpostgispostgrespostgresqlpostgrestrealtimesupabasevectorswebsockets
Copy over guide folders and updating navigation
Joshen Lim03f02a90843f
diff --git a/apps/temp-docs/components/Navigation/Navigation.constants.ts b/apps/temp-docs/components/Navigation/Navigation.constants.tsindex f0458761cc5..ffebe26aa23 100644--- a/apps/temp-docs/components/Navigation/Navigation.constants.ts+++ b/apps/temp-docs/components/Navigation/Navigation.constants.ts@@ -161,11 +161,16 @@ export const menuItems: NavMenu = {{ name: 'Database Connections', url: '/guides/database/connecting-to-postgres', items: [] },{ name: 'Tables and Data', url: '/guides/database/tables', items: [] },{ name: 'Database Functions', url: '/guides/database/functions', items: [] },+ { name: 'Database Webhooks', url: '/guides/database/database-webhooks', items: [] },{ name: 'Full Text Search', url: '/guides/database/full-text-search', items: [] },+ { name: 'Database Testing', url: '/guides/database/testing', items: [] },{- name: 'Migrating Between Projects',- url: '/guides/platform/migrating-and-upgrading-projects',- items: [],+ name: 'Serverless APIs',+ url: undefined,+ items: [+ { name: 'Overview', url: '/guides/api', items: [] },+ { name: 'Generating Types', url: '/guides/api/generating-types', items: [] },+ ],},{name: 'Extensions',@@ -178,6 +183,16 @@ export const menuItems: NavMenu = {items: [],},{ name: 'http: RESTful Client', url: '/guides/database/extensions/http', items: [] },+ {+ name: 'pg_cron: Job Scheduling',+ url: '/guides/database/extensions/pgcron',+ items: [],+ },+ {+ name: 'pg_net: Async Networking',+ url: '/guides/database/extensions/pgnet',+ items: [],+ },{ name: 'pgTAP: Unit Testing', url: '/guides/database/extensions/pgtap', items: [] },{name: 'uuid-ossp: Unique Identifiers',@@ -213,6 +228,7 @@ export const menuItems: NavMenu = {{ name: 'Overview', url: '/guides/realtime', items: [] },{ name: 'Quickstart', url: '/guides/realtime/quickstart', items: [] },{ name: 'Postgres CDC', url: '/guides/realtime/postgres-cdc', items: [] },+ { name: 'Rate Limits', url: '/guides/realtime/rate-limits', items: [] },],},{@@ -227,10 +243,15 @@ export const menuItems: NavMenu = {items: [{ name: 'Overview', url: '/guides/hosting/platform', items: [] },{ name: 'Custom Domains', url: '/guides/platform/custom-domains', items: [] },- { name: 'Disk Space Usage', url: '/guides/platform/disk-usage', items: [] },+ { name: 'Database Usage', url: '/guides/platform/database-usage', items: [] },{ name: 'Logging', url: '/guides/platform/logs', items: [] },{ name: 'Metrics', url: '/guides/platform/metrics', items: [] },- { name: 'Performance', url: '/guides/platform/performance', items: [] },+ {+ name: 'Migrating and upgrading',+ url: '/guides/platform/migrating-and-upgrading-projects',+ items: [],+ },+ { name: 'Performance Tuning', url: '/guides/platform/performance', items: [] },{ name: 'Permissions', url: '/guides/platform/permissions', items: [] },{ name: 'Production Readiness', url: '/guides/platform/going-into-prod', items: [] },],diff --git a/apps/temp-docs/docs/guides/database/database-webhooks.mdx b/apps/temp-docs/docs/guides/database/database-webhooks.mdxnew file mode 100644index 00000000000..6828a0bbc7b--- /dev/null+++ b/apps/temp-docs/docs/guides/database/database-webhooks.mdx@@ -0,0 +1,74 @@+---+id: webhooks+title: 'Database Webhooks'+description: Trigger external payloads on database events.+---++import Tabs from '@theme/Tabs'+import TabItem from '@theme/TabItem'++Database Webhooks allow you to send real-time data from your database to another system whenever a table event occurs.+++You can hook into three table events: `INSERT`, `UPDATE`, and `DELETE`. All events are fired _after_ a database row is changed.++Database Webhooks are very similar to triggers, and that's because Database Webhooks are just a convenience wrapper around triggers+using the [pg_net](/docs/guides/database/extensions/pgnet) extension. This extension is asynchronous, and therefore will not block your database changes for long-running network requests.++This video demonstrates how you can create a new customer in Stripe each time a row is inserted into a `profiles` table:++:::note++Database Webhooks were previously known as Function Hooks.++:::++<div class="video-container">+ <iframe+ src="https://www.youtube-nocookie.com/embed/codAs9-NeHM"+ frameBorder="1"+ allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture"+ allowFullScreen+ ></iframe>+</div>++## Creating a webhook++1. Create a new [Database Webhook](https://app.supabase.com/project/_/database/hooks) in the Dashboard.+1. Give your Webhook a name.+1. Select the table you want to hook into.+1. Select one or more events (table inserts, updates, or deletes) you want to hook into.++We currently support HTTP webhooks. These are sent as a `POST` request with a JSON payload.++## Payload++The payload is automatically generated from the underlying table record:++```typescript+type InsertPayload = {+ type: 'INSERT'+ table: string+ schema: string+ record: TableRecord<T>+ old_record: null+}+type UpdatePayload = {+ type: 'UPDATE'+ table: string+ schema: string+ record: TableRecord<T>+ old_record: TableRecord<T>+}+type DeletePayload = {+ type: 'DELETE'+ table: string+ schema: string+ record: null+ old_record: TableRecord<T>+}+```++## Resources++- [pg_net](/docs/guides/database/extensions/pgnet): an async networking extension for PostgreSQLdiff --git a/apps/temp-docs/docs/guides/database/extensions/pgcron.mdx b/apps/temp-docs/docs/guides/database/extensions/pgcron.mdxnew file mode 100644index 00000000000..e7032bf9bd9--- /dev/null+++ b/apps/temp-docs/docs/guides/database/extensions/pgcron.mdx@@ -0,0 +1,99 @@+---+id: pgcron+title: 'pg_cron: Job Scheduling'+description: 'pgnet: a simple cron-based job scheduler for PostgreSQL that runs inside the database.'+---++import Tabs from '@theme/Tabs'+import TabItem from '@theme/TabItem'++The `pg_cron` extension is a simple cron-based job scheduler for PostgreSQL that runs inside the database.++## Usage++### Enable the extension++<Tabs+ defaultValue="dashboard"+ values={[+ {label: 'Dashboard', value: 'dashboard'},+ {label: 'SQL', value: 'sql'},+ ]}>++<TabItem value="dashboard">++1. Go to the [Database](https://app.supabase.com/project/_/database/tables) page in the Dashboard.+2. Click on **Extensions** in the sidebar.+3. Search for "pg_cron" and enable the extension.++</TabItem>+<TabItem value="sql">++```sql+-- Example: enable the "pg_cron" extension+create extension pg_cron with schema extensions;++-- If you're planning to use a non-superuser role to schedule jobs,+-- ensure that they are granted access to the cron schema and its underlying objects beforehand.+-- Failure to do so would result in jobs by these roles to not run at all.++grant usage on schema cron to {{DB user}};+grant all privileges on all tables in schema cron to {{DB user}};+++-- Example: disable the "pg_cron" extension+drop extension if exists pg_cron;+```++</TabItem>+</Tabs>++### Syntax++The schedule uses the standard cron syntax, in which \* means "run every time period", and a specific number means "but only at this time":++```bash+ ┌───────────── min (0 - 59)+ │ ┌────────────── hour (0 - 23)+ │ │ ┌─────────────── day of month (1 - 31)+ │ │ │ ┌──────────────── month (1 - 12)+ │ │ │ │ ┌───────────────── day of week (0 - 6) (0 to 6 are Sunday to+ │ │ │ │ │ Saturday, or use names; 7 is also Sunday)+ │ │ │ │ │+ │ │ │ │ │+ * * * * *+```++## Examples++### Delete data every week++Delete old data on Saturday at 3:30am (GMT):++```sql+select cron.schedule (+ 'webhook-every-minute', -- name of the cron job+ '* * * * *', -- every minute+ $$ delete from events where event_time < now() - interval '1 week' $$+);+```++### Run a vacuum every day++Vacuum every day at 3:00am (GMT)++```sql+SELECT cron.schedule('nightly-vacuum', '0 3 * * *', 'VACUUM');+```++### Unschedule a job++Unschedules a job called `'nightly-vacuum'`++```sql+SELECT cron.unschedule('nightly-vacuum');+```++## Resources++- [pg_cron GitHub Repository](https://github.com/citusdata/pg_cron)diff --git a/apps/temp-docs/docs/guides/database/extensions/pgnet.mdx b/apps/temp-docs/docs/guides/database/extensions/pgnet.mdxnew file mode 100644index 00000000000..341af926e44--- /dev/null+++ b/apps/temp-docs/docs/guides/database/extensions/pgnet.mdx@@ -0,0 +1,254 @@+---+id: pgnet+title: 'pg_net: Async Networking'+description: 'pg_net: an async networking extension for PostgreSQL.'+---++import Tabs from '@theme/Tabs'+import TabItem from '@theme/TabItem'++:::caution++The pg_net API is in beta. Functions signatures may change.++:::++[pg_net](https://github.com/supabase/pg_net/) is a PostgreSQL extension exposing a SQL interface for async networking with a focus on scalability and UX.++It differs from the `http` extension in that it is asynchronous by default. This makes it useful in blocking functions (like triggers).++## Usage++### Enable the extension++<Tabs+ defaultValue="dashboard"+ values={[+ {label: 'Dashboard', value: 'dashboard'},+ {label: 'SQL', value: 'sql'},+ ]}>++<TabItem value="dashboard">++1. Go to the [Database](https://app.supabase.com/project/_/database/tables) page in the Dashboard.+2. Click on **Extensions** in the sidebar.+3. Search for "pg_net" and enable the extension.++</TabItem>+<TabItem value="sql">++```sql+-- Example: enable the "pg_net" extension+create schema if not exists net;+create extension pg_net with schema net;++-- Example: disable the "plv8" extension+drop extension if exists pg_net;+drop schema net;+```++Even though the SQL code is `create extension`, this is the equivalent of "enabling the extension".+To disable an extension, call `drop extension`.++Procedural languages are automatically installed within `pg_catalog`, so you don't need to specify a schema.++</TabItem>+</Tabs>++## `http_get` {#http_get}++Creates an HTTP GET request returning the request's ID. HTTP requests are not started until the transaction is committed.++### Signature++:::caution++This is a Postgres SECURITY DEFINER function.++:::++```sql+net.http_get(+ -- url for the request+ url text,+ -- key/value pairs to be url encoded and appended to the `url`+ params jsonb default '{}'::jsonb,+ -- key/values to be included in request headers+ headers jsonb default '{}'::jsonb,+ -- WARNING: this is currently ignored, so there is no timeout+ -- the maximum number of milliseconds the request may take before being cancelled+ timeout_milliseconds int default 1000+)+ -- request_id reference+ returns bigint++ strict+ volatile+ parallel safe+ language plpgsql+```++### Usage++```sql+select net.http_get('https://news.ycombinator.com') as request_id;+request_id+----------+ 1+(1 row)+```++After triggering `http_get`, use [`http_get_result`](#http_get_result) to get the result of the request.++## `http_post` {#http_post}++Creates an HTTP POST request with a JSON body, returning the request's ID. HTTP requests are not started until the transaction is committed.++The body's character set encoding matches the database's `server_encoding` setting.++### Signature++:::caution++This is a Postgres SECURITY DEFINER function++:::++```sql+net.http_post(+ -- url for the request+ url text,+ -- body of the POST request+ body jsonb default '{}'::jsonb,+ -- key/value pairs to be url encoded and appended to the `url`+ params jsonb default '{}'::jsonb,+ -- key/values to be included in request headers+ headers jsonb default '{"Content-Type": "application/json"}'::jsonb,+ -- WARNING: this is currently ignored, so there is no timeout+ -- the maximum number of milliseconds the request may take before being cancelled+ timeout_milliseconds int default 1000+)+ -- request_id reference+ returns bigint++ volatile+ parallel safe+ language plpgsql+```++### Usage++```sql+select+ net.http_post(+ url:='https://httpbin.org/post',+ body:='{"hello": "world"}'::jsonb+ ) as request_id;+request_id+----------+ 1+(1 row)+```++After triggering `http_post`, use [`http_get_result`](#http_get_result) to get the result of the request.++## `http_collect_response` {#http_collect_response}++Given a `request_id` reference, retrieves the response.++When `async:=false` is set it is recommended that [statement_timeout](https://www.postgresql.org/docs/13/runtime-config-client.html) is set for the maximum amount of time the caller is willing to wait in case the response is slow to populate.++### Signature++:::caution++This is a Postgres SECURITY DEFINER function++:::++```sql+net.http_collect_response(+ -- request_id reference+ request_id bigint,+ -- when `true`, return immediately. when `false` wait for the request to complete before returning+ async bool default true+)+ -- http response composite wrapped in a result type+ returns net.http_response_result++ strict+ volatile+ parallel safe+```++### Usage++:::caution++`net.http_collect_response` must be in a separate transaction from the calls to `net.http_<method>`++:::++```sql+select+ net.http_post(+ url:='https://httpbin.org/post',+ body:='{"hello": "world"}'::jsonb+ ) as request_id;+request_id+----------+ 1+(1 row)++select * from net.http_collect_response(1, async:=false);+status | message | response+--------+---------+----------+SUCCESS ok (+ status_code := 200,+ headers := '{"date": ...}',+ body := '{"args": ...}'+ )::net.http_response_result+++select+ (response).body::json+from+ net.http_collect_response(request_id:=1);+ body+-------------------------------------------------------------------+ {+ "args": {},+ "data": "{\"hello\": \"world\"}",+ "files": {},+ "form": {},+ "headers": {+ "Accept": "*/*",+ "Content-Length": "18",+ "Content-Type": "application/json",+ "Host": "httpbin.org",+ "User-Agent": "pg_net/0.2",+ "X-Amzn-Trace-Id": "Root=1-61031a5c-7e1afeae69bffa8614d8e48e"+ },+ "json": {+ "hello": "world"+ },+ "origin": "135.63.38.488",+ "url": "https://httpbin.org/post"+ }+(1 row)+```++Where `response` is a composite:++```sql+status_code integer+headers jsonb+body text+```++Possible values for `net.http_response_result.status` are `('PENDING', 'SUCCESS', 'ERROR')`++## Resources++- Source code: [github.com/supabase/pg_net](https://github.com/supabase/pg_net/)+- Official Docs: [supabase.github.io/pg_net](https://supabase.github.io/pg_net/)diff --git a/apps/temp-docs/docs/guides/database/tables.mdx b/apps/temp-docs/docs/guides/database/tables.mdxindex 1f0e0857329..7f4d0e914ca 100644--- a/apps/temp-docs/docs/guides/database/tables.mdx+++ b/apps/temp-docs/docs/guides/database/tables.mdx@@ -160,7 +160,7 @@ In the example above, we have:1. created a column called `id`1. assigned the data type `bigint`1. instructed the database that this should be `generated always as identity`, which means that Postgres will automatically assign a unique number to this column.-1. Becuase it's unique, we can also use it as our `primary key`.+1. Because it's unique, we can also use it as our `primary key`.We could also use `generated by default as identity`, which would allow us to insert our own unique values.@@ -245,7 +245,7 @@ For example, if you wanted to load a CSV file into your movies table:You would [connect](../../guides/database/connecting-to-postgres#direct-connections) to your database directly and load the file with the COPY command:```bash-psql -h DATABASE_URL -p 5432 postgres -U postgres \+psql -h DATABASE_URL -p 5432 -d postgres -U postgres \-c "COPY movies FROM './movies.csv';"```diff --git a/apps/temp-docs/docs/guides/database/testing.mdx b/apps/temp-docs/docs/guides/database/testing.mdxnew file mode 100644index 00000000000..a1e2267df44--- /dev/null+++ b/apps/temp-docs/docs/guides/database/testing.mdx@@ -0,0 +1,70 @@+---+id: testing+title: Testing Your Database+description: Test your database schema, tables, functions, and policies.+---++import Tabs from '@theme/Tabs'+import TabItem from '@theme/TabItem'++You can use the Supabase CLI to test your database. To get started:++- [Install the Supabase CLI](/docs/guides/cli) on your local machine++## Creating a test++Create a tests folder inside the supabase folder:++```bash+mkdir -p ./supabase/tests/database+```++Create a new file with the `.sql` extension which will contain the test.++```bash+touch ./supabase/tests/database/hello_world.test.sql+```++## Writing tests++All `sql` files use [pgTAP](/docs/guides/database/extensions/pgtap) as the test runner.++Let's write a simple test to check that our `auth.users` table has an ID column. Open `hello_world.test.sql` and add the following code:++```sql+begin;+select plan(1); -- only one statement to run++SELECT has_column(+ 'auth',+ 'users',+ 'id',+ 'id should exist'+);++select * from finish();+rollback;+```++## Running tests++To run the test, you can use:++```bash+supabase test db+```++This will produce the following output:++```bash+$ supabase test db+supabase/tests/database/hello_world.test.sql .. ok+All tests successful.+Files=1, Tests=1, 1 wallclock secs ( 0.01 usr 0.00 sys + 0.04 cusr 0.02 csys = 0.07 CPU)+Result: PASS+```++## More resource++- [pgTAP extension](https://supabase.com/docs/guides/database/extensions/pgtap)+- Official [pgTAP documentation](https://pgtap.org/)diff --git a/apps/temp-docs/docs/guides/functions/examples.mdx b/apps/temp-docs/docs/guides/functions/examples.mdxindex 39a48de9a0b..ee64360a142 100644--- a/apps/temp-docs/docs/guides/functions/examples.mdx+++ b/apps/temp-docs/docs/guides/functions/examples.mdx@@ -28,14 +28,26 @@ const examples = [},{name: 'Building a RESTful Service API',- description: 'Learn how to use HTTP methods and paths to build a RESTful service for managing tasks.',+ description:+ 'Learn how to use HTTP methods and paths to build a RESTful service for managing tasks.',href: 'https://github.com/supabase/supabase/blob/master/examples/edge-functions/supabase/functions/restful-tasks/index.ts',},{name: 'Working with Supabase Storage',description: 'An example on reading a file from Supbase Storage.',href: 'https://github.com/supabase/supabase/blob/master/examples/edge-functions/supabase/functions/read-storage/index.ts',- }+ },+ {+ name: 'OpenGraph Image Generation',+ description:+ 'Generate Open Graph images with Deno and Supabase Edge Functions, no framework needed.',+ href: 'https://github.com/supabase/supabase/tree/master/examples/edge-functions/supabase/functions/opengraph',+ },+ {+ name: 'Get User Location',+ description: `Get user location data from user's IP address.`,+ href: 'https://github.com/supabase/supabase/tree/master/examples/edge-functions/supabase/functions/location',+ },]You can find a list of useful [Edge Function Examples](https://github.com/supabase/supabase/tree/master/examples/edge-functions) in our GitHub repository.diff --git a/apps/temp-docs/docs/guides/hosting/overview.mdx b/apps/temp-docs/docs/guides/hosting/overview.mdxindex f8f9c96a88a..6126c65e8ec 100644--- a/apps/temp-docs/docs/guides/hosting/overview.mdx+++ b/apps/temp-docs/docs/guides/hosting/overview.mdx@@ -49,7 +49,8 @@ The "middleware" is everything except Postgres, and it should work with any Post### ExtensionsSupabase requires some Postgres extensions to be enabled by default for the API and Auth system to work. You can find the extensions inside the-[schema initialization script](https://github.com/supabase/supabase/blob/master/docker/volumes/db/init/00-initial-schema.sql).+[schema migration scripts](https://github.com/supabase/postgres/tree/develop/migrations). These are mounted at `/docker-entrypoint-initdb.d`+to run automatically when starting the database container.We recommend installing all extensions into an `extensions` schema. This will keep your API clean,since all tables in the `public` schema are exposed via the API.@@ -72,7 +73,8 @@ For working with JWT and Auth functions.### RolesSupabase creates several default roles in your Postgres database. To restore defaults at any time you can run the commands inside the-[schema initialization script](https://github.com/supabase/supabase/blob/master/docker/volumes/db/init/00-initial-schema.sql).+[schema initialization scripts](https://github.com/supabase/postgres/tree/develop/migrations/db/init-scripts). Remember to change your+[role passwords](./docker#securing-your-setup) before deploying to production environments.##### `postgres`diff --git a/apps/temp-docs/docs/guides/hosting/platform.mdx b/apps/temp-docs/docs/guides/hosting/platform.mdxindex bbfe32e34f8..a8c24cba66f 100644--- a/apps/temp-docs/docs/guides/hosting/platform.mdx+++ b/apps/temp-docs/docs/guides/hosting/platform.mdx@@ -47,7 +47,7 @@ You can also assign roles to your team members with different access levels. The| **Members** || Add an Owner | ✅ | | || Remove an Owner | ✅ | | |-| Add an Adminstrator | ✅ | ✅ | |+| Add an Administrator | ✅ | ✅ | || Remove an Administrator | ✅ | ✅ | || Add a Developer | ✅ | ✅ | || Remove a Developer | ✅ | ✅ | |diff --git a/apps/temp-docs/docs/guides/integrations/keyri.mdx b/apps/temp-docs/docs/guides/integrations/keyri.mdxindex 8d4351255ff..936db47bad8 100644--- a/apps/temp-docs/docs/guides/integrations/keyri.mdx+++ b/apps/temp-docs/docs/guides/integrations/keyri.mdx@@ -1,31 +1,31 @@----+id: keyrititle: '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 (<https://app.keyri.com>). 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')-+[](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<div><iframe@@ -39,9 +39,9 @@ Next, embed KeyriQR.html in your login page as an iFrame within the desired div.></iframe></div>```-+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.-+```javascriptuseEffect(() => {window.addEventListener('message', async (evt) => {@@ -56,78 +56,84 @@ useEffect(() => {}});```-+That's it!-+# Mobile-[](http://www.youtube.com/watch?v=oGMsSKyh6tc 'Supabase & Keyri | Mobile Integration Overview')-+[](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: -+```shellexport 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 -+```shellflutter 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-++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 thingfinal response = await client.auth.signIn(email: 'email', password: 'password');-+if (response.error != null) {// Errorprint('Error: ${response.error?.message}');} else {// Successfinal session = response.data;-+// This is the payload that needs to be send through Keyrifinal 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@@ -136,8 +142,8 @@ if (response.error != null) {'{"refreshToken":"$refreshToken"}', [email]).then((authResult) => _onAuthResult(authResult)).catchError((error, stackTrace) => _onError(error));-+}--++```diff --git a/apps/temp-docs/docs/guides/integrations/polyscale.mdx b/apps/temp-docs/docs/guides/integrations/polyscale.mdxindex 412f94ff2c1..1eae5729d0f 100644--- a/apps/temp-docs/docs/guides/integrations/polyscale.mdx+++ b/apps/temp-docs/docs/guides/integrations/polyscale.mdx@@ -48,7 +48,7 @@ Your cache is now created. PolyScale automatically checks to see that your datab## Step 2: Connect to your PolyScale Cache-Using your PolyScale cache is simple -- instead of connecting to your Supabase database directly, you'll replace your orignal connection string with the PolyScale connection string in your application.+Using your PolyScale cache is simple -- instead of connecting to your Supabase database directly, you'll replace your original connection string with the PolyScale connection string in your application.For example, if your original connection string was: `postgres://postgres:[email protected]:5432`diff --git a/apps/temp-docs/docs/guides/platform/custom-domains.mdx b/apps/temp-docs/docs/guides/platform/custom-domains.mdxindex bde2c3b847f..87f831172b4 100644--- a/apps/temp-docs/docs/guides/platform/custom-domains.mdx+++ b/apps/temp-docs/docs/guides/platform/custom-domains.mdx@@ -17,13 +17,13 @@ Custom domains allow you to present a branded experience to your users. You canTo get started:-1. [Install](/docs/guides/cli) the Supabase CLI 1.10.1+.+1. [Install](/docs/guides/cli) the Supabase CLI 1.11.3+.1. [Log in](/docs/guides/cli/local-development#log-in-to-the-supabase-cli) to your Supabase account using the CLI.1. Enable the Custom Domains add-on in the Billing page of the Dashboard.## Configure a Custom Domain-This example assumes your Supabase project is `foobar` with a corresponding API URL `foobar.supabase.co` and configures a custom domain at `api.example.com`.+This example assumes your Supabase project is `foobar` with a corresponding API URL `foobarbaz.supabase.co` and configures a custom domain at `api.example.com`.### <a id="cname-configure"></a>Configure a CNAME@@ -34,7 +34,7 @@ Set up a CNAME record for `api.example.com`, resolving to `foobarbaz.supabase.coUse the `create` subcommand of the CLI to notify Supabase of your domain and retrieve TXT verification records:```bash-supabase custom-hostname create --project-ref foobar --custom-hostname api.example.com --experimental+supabase domains create --project-ref foobar --custom-hostname api.example.com --experimental```The output of the `create` command includes two TXT records[^1] you will need to set up, in order to verify your control over the domain in question,@@ -47,14 +47,14 @@ Required outstanding validation records:api.example.com TXT -> ca3-F1HvR9i938OgVwpCFwi1jTsbhe1hvT0Ic3efPY3Q```-[^1] One of the records requires you to *replace* the CNAME record set up in [the first step](#cname-configure) with a TXT record. You'll be able to restore it back to the CNAME after the verification process has been completed.+[^1] One of the records requires you to _replace_ the CNAME record set up in [the first step](#cname-configure) with a TXT record. You'll be able to restore it back to the CNAME after the verification process has been completed.### Verify your domainSet up both records as instructed, and then use the `reverify` command for the Supabase Platform to verify the records:```bash-supabase custom-hostname reverify --project-ref foobarbaz --experimental+supabase domains reverify --project-ref foobarbaz --experimental```You might need to wait a few minutes before your updated DNS records are propagated, especially if the older records were using a high TTL.@@ -72,7 +72,7 @@ Additionally, update the DNS configuration for `api.example.com` to once more usFinally, you can use the `activate` subcommand to reconfigure your project:```bash-supabase custom-hostname activate --project-ref foobarbaz --experimental+supabase domains activate --project-ref foobarbaz --experimental```## Remove a Custom Domain@@ -80,7 +80,11 @@ supabase custom-hostname activate --project-ref foobarbaz --experimentalIf you have a custom domain (`api.example.com`) set up for your Supabase project (ref `foobarbaz`, with assigned endpoints at `foobarbaz.supabase.co`), and would like to go back to using the Supabase-provisioned endpoints (`foobarbaz.supabase.co`), you can use the `delete` subcommand:```bash-supabase custom-hostname delete --project-ref foobarbaz --experimental+supabase domains delete --project-ref foobarbaz --experimental```As with the final activation stage of the process for setting up a custom domain, you'll need to update any references in your client code and OAuth providers from the custom domain to the Supabase-provisioned endpoints.++## Limitations++Edge functions do not honor the custom domain setting and they still have to be invoked via the `foobarbaz.supabase.co` domain.diff --git a/apps/temp-docs/docs/guides/platform/database-usage.mdx b/apps/temp-docs/docs/guides/platform/database-usage.mdxnew file mode 100644index 00000000000..353b8f6c734--- /dev/null+++ b/apps/temp-docs/docs/guides/platform/database-usage.mdx@@ -0,0 +1,55 @@+---+id: database-usage+title: Database usage+description: Understanding how database usage applies to your subscription.+---++Database storage refers to the _monthly average storage usage_, as reported by Postgres. This metric is reported in your project's [billing page](https://app.supabase.com/project/_/settings/billing) and is updated daily.++For an instantaneous live view of the DB storage usage, you can execute in Postgres:++```sql+select sum(pg_database_size(pg_database.datname)) / (1024 * 1024) as db_size_mb+from pg_database;+```++This value is also reported in the [database settings page](https://app.supabase.com/project/_/settings/database).++## Database storage management++Your project will be changed to read-only mode once it reaches 95% of your subscription quota, preventing further writes to your project.+In read-only mode, clients will encounter errors such as `cannot execute INSERT in a read-only transaction`.++Regular operation (read-write mode) is automatically re-enabled once database storage usage falls under 95%.++If you are on Pro or Enterprise, database storage expands automatically, however you may also encounter this error if fill the database faster than it can expand.++Supabase uses network-attached storage, which balances performance with scalability. Pro projects can store up to 1024TB.+If you intend to grow beyond this, reach out to our team to learn more about our Enterprise tier.++### Increasing available database storage++1. [Upgrade to the Pro or Enterprise plan](https://app.supabase.com/project/_/settings/billing) to increase your storage quota.++2. Delete data from your project's database to lower its disk usage. If your database is already in read-only mode, run the following command to change the transaction mode to read-write for your session:++ ```sql+ SET default_transaction_read_only = 'off';+ ```++ This allows you to delete data from within the session.++## Vacuum operations++Postgres does not immediately reclaim the physical space used by dead tuples (i.e., deleted rows) in the DB. Instead, they are internally marked as removed until a [vacuum operation](https://www.postgresql.org/docs/current/routine-vacuuming.html) is executed.+As a result, deleting data from your database may not immediately reduce the reported disk usage.++:::note+Vacuum operations can temporarily increase resource utilization, which may adversely impact the observed performance of your project until the maintenance is completed.+:::++Supabase projects have automatic vacuuming enabled, which ensures that these operations are performed regularly to keep the database healthy and performant.+However, it can be necessary to either [fine-tune](https://www.percona.com/blog/2018/08/10/tuning-autovacuum-in-postgresql-and-autovacuum-internals/)+the [autovacuum parameters](https://www.enterprisedb.com/blog/postgresql-vacuum-and-analyze-best-practice-tips),+or [manually initiate](https://www.postgresql.org/docs/current/sql-vacuum.html) vacuum operations.+For example, running a manual vacuum after deleting large amounts of data from your DB could help reduce the reported disk usage by Postgres.diff --git a/apps/temp-docs/docs/guides/platform/disk-usage.mdx b/apps/temp-docs/docs/guides/platform/disk-usage.mdxdeleted file mode 100644index 7c7854cf43b..00000000000--- a/apps/temp-docs/docs/guides/platform/disk-usage.mdx+++ /dev/null@@ -1,25 +0,0 @@-----id: disk-usage-title: Disk space usage-description: Learn how database disk space usage is reported.------Database disk space usage refers to the _monthly average disk usage_, as reported by Postgres. This metric is reported in your project's [billing page](https://app.supabase.com/project/_/settings/billing) and is updated daily.--For an instantaneous live view of the DB disk space being used by your project, you can execute in Postgres:--```sql-SELECT SUM(pg_database_size(pg_database.datname)) / (1024 * 1024) as db_size_mb FROM pg_database;-```--This value is also reported in the [database settings page](https://app.supabase.com/project/_/settings/database).--## Vacuum operations--Postgres does not immediately reclaim the physical space used by dead tuples (i.e., deleted rows) in the DB. Instead, they are internally marked as removed until a [vacuum operation](https://www.postgresql.org/docs/current/routine-vacuuming.html) is executed. As a result, deleting data from your DB may not immediately reduce the reported disk usage.--:::note-Vacuum operations can temporarily increase resource utilization, which can adversely impact the observed performance of your project until the maintenance is completed.-:::--Supabase projects have automatic vacuuming enabled, which ensures that these operations are performed regularly to keep the database healthy and performant. However, it can be necessary to either [fine-tune](https://www.percona.com/blog/2018/08/10/tuning-autovacuum-in-postgresql-and-autovacuum-internals/) [the autovacuum parameters](https://www.enterprisedb.com/blog/postgresql-vacuum-and-analyze-best-practice-tips), or [manually initiate](https://www.postgresql.org/docs/current/sql-vacuum.html) vacuum operations. For example, running a manual vacuum after deleting large amounts of data from your DB could help reduce the reported disk usage by Postgres.diff --git a/apps/temp-docs/docs/guides/database/migrating-between-projects.mdx b/apps/temp-docs/docs/guides/platform/migrating-between-projects.mdxsimilarity index 76%rename from apps/temp-docs/docs/guides/database/migrating-between-projects.mdxrename to apps/temp-docs/docs/guides/platform/migrating-between-projects.mdxindex c7a877a0462..b8e34c012c4 100644--- a/apps/temp-docs/docs/guides/database/migrating-between-projects.mdx+++ b/apps/temp-docs/docs/guides/platform/migrating-between-projects.mdx@@ -1,18 +1,31 @@----id: migrating-between-projects-title: 'Migrating Between Projects'-description: Migrate data from one project to another+id: migrating-and-upgrading-projects+title: 'Migrating and Upgrading Projects'+description: Upgrade your project to the latest version of Supabase.+sidebar_label: 'Migrating and upgrading'---+Supabase ships fast and we endeavor to add all new features to existing projects wherever possible.+In some cases, access to new features require upgrading or migrating your Supabase project.++## Upgrade your project++When you pause and restore a project, the restored database includes the latest features. This method _does_ include downtime, so be aware that your project will be inaccessible for a short period of time.++1. On the [General Settings](https://app.supabase.com/project/_/settings/general) page in the Dashboard, click **Pause project**. You will be redirected to the home screen as your project is pausing. This process can take several minutes.+1. After your project is paused, click **Restore project**. The restoration can take several minutes depending on how much data your database has. You will receive an email once the restoration is complete.++## Migrate your project+Migrating projects can be achieved using standard PostgreSQL tooling. This is particularly useful for older projects (e.g. to use a newer Postgres version).-## Before you begin+### Before you begin- Install [Postgres](https://www.postgresql.org/download/) so you can run `psql` and `pg_dump`.- Create a new [Supabase project](https://app.supabase.com).- Store the old project's database URL as `$OLD_DB_URL` and the new project's as `$NEW_DB_URL`.-## Migrate the database+### Migrate the database1. Enable [Database Webhooks](https://app.supabase.com/project/_/database/hooks) in your new project if you enabled them in your old project.2. In your new project, enable all extensions that were enabled in your old project.@@ -43,11 +56,11 @@ psql \--dbname "$NEW_DB_URL"```-## Enable publication on tables+### Enable publication on tablesReplication for Realtime is disabled for all tables in your new project. On the [Replication](https://app.supabase.com/project/_/database/replication) page in the Dashboard, select your new project and enable replication for tables that were enabled in your old project.-## Migrate Storage objects+### Migrate Storage objectsThe new project has the old project's Storage buckets, but the Storage objects need to be migrated manually. Use this script to move storage objects from one project to another. If you have more than 10k objects, we can move the objects for you. Just contact us at [[email protected]](mailto:[email protected]).diff --git a/apps/temp-docs/docs/guides/realtime/rate-limits.mdx b/apps/temp-docs/docs/guides/realtime/rate-limits.mdxnew file mode 100644index 00000000000..5b88247652a--- /dev/null+++ b/apps/temp-docs/docs/guides/realtime/rate-limits.mdx@@ -0,0 +1,74 @@+---+id: rate-limits+title: Realtime Rate Limits+description: Understanding Realtime rate limiting+sidebar_label: Rate Limits+---++Supabase Realtime is a global cluster. We've implemented some rate limits to help ensure high availability for all customers.++Rate limits are configurable per project and our cluster supports millions of concurrent connections. [Contact support](https://app.supabase.com/support/new) if these limits are causing issues.++## Limits by Plan++Limits are set on the Free and Pro plans accordingly. See our [pricing page](https://supabase.com/pricing) for more information.++Enterprise plans are billed on a usage basis. We still employ limiting on Enterprise plans. If you're on an Enterprise plan simply contact support and we'll increase your limits as needed.++Enterprise plan limits start at:++- 500 concurrent clients+- 1,000 messages per second+- 500 concurrent Channels++## System Limits++The following limits apply to all projects:++- 500 Channel joins per second+- 100 Channels per connected client++## Client-Side Limiting++Some basic WebSocket message rate limiting is implemented client-side.++For example, the [multiplayer.dev demo](/docs/guides/realtime/quickstart#cursor-positions) instantiates the Supabase client with an `eventsPerSecond` parameter.++## Rate Limiting Errors++Rate limiting errors can appear in backend logs and messages in the WebSocket connection.++:::note+Use the [Realtime Inspector](https://realtime.supabase.com/inspector/new) to reproduce an error and share those connection details with Supabase support.+:::++### Backend Logs++If your project is being rate limited, check your [Realtime logs](https://app.supabase.com/project/_/database/realtime-logs).++### WebSocket Errors++- `tenant_events`: Clients will be disconnected if your project is generating too many messages per second. `supabase-js` should reconnect automatically when the message rate decreases below your plan limit.++Some limits can cause a Channel join to be refused. Realtime will reply with one of the following WebSocket messages:++- `too_many_channels`: Too many channels currently joined for a single client.+- `too_many_connections`: Too many total concurrent connections for a project.+- `too_many_joins`: Too many Channel joins per second.++:::note+Use your browser's developer tools to find the WebSocket initiation request and view individual messages.+:::++## Payload Limits++Realtime has a message byte size limit of 1 megabyte.++## Presence Limits++Realtime Presence is a CRDT backed in-memory key value store based on Phoenix Presence. It's more expensive to update a Presence than Broadcast a message.++The following limits apply to Presence messages:++- 10 keys per object+- Message rate limit is 10% of your Realtime message rate limit