The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.
TypeScript aialternativeauthdatabasedenoembeddingsexamplefirebasenextjsoauth2pgvectorpostgispostgrespostgresqlpostgrestrealtimesupabasevectorswebsockets
add initializing to supabase v1
Jonathan Summers-Muirdd4001f8ecb6
diff --git a/apps/docs/docs/ref/javascript/v1/initializinggg.mdx b/apps/docs/docs/ref/javascript/v1/initializinggg.mdxdeleted file mode 100644index a4dc650a969..00000000000--- a/apps/docs/docs/ref/javascript/v1/initializinggg.mdx+++ /dev/null@@ -1,130 +0,0 @@-----title: 'Initializing'------You can initialize a new Supabase client using the `createClient()` method.--The Supabase client is your entrypoint to the rest of the Supabase functionality-and is the easiest way to interact with everything we offer within the Supabase ecosystem.--## Parameters--<ul className="method-list-group">--<li className="method-list-item">- <h4 className="method-list-item-label">- <span className="method-list-item-label-name">- supabaseUrl- </span>- <span className="method-list-item-label-badge required">- required- </span>- <span className="method-list-item-validation">- <code>string</code>- </span>- </h4>- <div className="method-list-item-description">--The unique Supabase URL which is supplied when you create a new project in your project dashboard.-- </div>--</li>--<li className="method-list-item">- <h4 className="method-list-item-label">- <span className="method-list-item-label-name">- supabaseKey- </span>- <span className="method-list-item-label-badge required">- required- </span>- <span className="method-list-item-validation">- <code>string</code>- </span>- </h4>- <div className="method-list-item-description">--The unique Supabase Key which is supplied when you create a new project in your project dashboard.-- </div>--</li>--<li className="method-list-item">- <h4 className="method-list-item-label">- <span className="method-list-item-label-name">- options- </span>- <span className="method-list-item-label-badge false">- optional- </span>- <span className="method-list-item-validation">- <code>SupabaseClientOptions</code>- </span>- </h4>- <div className="method-list-item-description">--No description provided.-- </div>--</li>--</ul>--## Examples--### createClient()--```js-import { createClient } from '@supabase/supabase-js'--// Create a single supabase client for interacting with your database-const supabase = createClient('https://xyzcompany.supabase.co', 'public-anon-key')-```--### With additional parameters--```js-import { createClient } from '@supabase/supabase-js'--const options = {- schema: 'public',- headers: { 'x-my-custom-header': 'my-app-name' },- autoRefreshToken: true,- persistSession: true,- detectSessionInUrl: true,-}-const supabase = createClient('https://xyzcompany.supabase.co', 'public-anon-key', options)-```--### API schemas--```js-import { createClient } from '@supabase/supabase-js'--// Provide a custom schema. Defaults to "public".-const supabase = createClient('https://xyzcompany.supabase.co', 'public-anon-key', {- schema: 'other_schema',-})-```--By default the API server points to the `public` schema. You can enable other database schemas within the Dashboard.-Go to `Settings > API > Schema` and add the schema which you want to expose to the API. You also need to grant `USAGE` on your new schema with the grants you desire, such as `SELECT, INSERT, UPDATE, DELETE`.--Note: each client connection can only access a single schema, so the code above can access the `other_schema` schema but cannot access the `public` schema.--### Custom `fetch` implementation--```js-import { createClient } from '@supabase/supabase-js'--const supabase = createClient('https://xyzcompany.supabase.co', 'public-anon-key', {- fetch: fetch.bind(globalThis),-})-```--`supabase-js` uses the [`cross-fetch`](https://www.npmjs.com/package/cross-fetch) library to make HTTP requests,-but an alternative `fetch` implementation can be provided as an option.-This is most useful in environments where `cross-fetch` is not compatible (for instance Cloudflare Workers).diff --git a/spec/supabase_js_v1.yml b/spec/supabase_js_v1.ymlindex c61976c9743..16593d0f202 100644--- a/spec/supabase_js_v1.yml+++ b/spec/supabase_js_v1.yml@@ -16,6 +16,68 @@ info:version: '0.0.1'functions:+ - id: initializing+ title: 'Initializing'+ $ref: '@supabase/supabase-js.index.SupabaseClient.constructor'+ examples:+ - id: create-client+ name: Create Client+ code: |+ ```js+ import { createClient } from '@supabase/supabase-js'++ // Create a single supabase client for interacting with your database+ const supabase = createClient('https://xyzcompany.supabase.co', 'public-anon-key')+ ```+ - id: with-additional-parameters+ name: With Additional Parameters+ code: |+ ```js+ import { createClient } from '@supabase/supabase-js'++ const options = {+ schema: 'public',+ headers: { 'x-my-custom-header': 'my-app-name' },+ autoRefreshToken: true,+ persistSession: true,+ detectSessionInUrl: true,+ }+ const supabase = createClient('https://xyzcompany.supabase.co', 'public-anon-key', options)+ ```+ - id: api-schemas+ name: API schemas+ code: |+ ```js+ import { createClient } from '@supabase/supabase-js'++ const options = {+ schema: 'public',+ headers: { 'x-my-custom-header': 'my-app-name' },+ autoRefreshToken: true,+ persistSession: true,+ detectSessionInUrl: true,+ }+ const supabase = createClient('https://xyzcompany.supabase.co', 'public-anon-key', options)+ ```+ description: |+ By default the API server points to the `public` schema. You can enable other database schemas within the Dashboard.+ Go to `Settings > API > Schema` and add the schema which you want to expose to the API. You also need to grant `USAGE` on your new schema with the grants you desire, such as `SELECT, INSERT, UPDATE, DELETE`.++ Note: each client connection can only access a single schema, so the code above can access the `other_schema` schema but cannot access the `public` schema.+ - id: custom-fetch-implementation+ name: Custom Fetch Implementation+ code: |+ ```js+ import { createClient } from '@supabase/supabase-js'++ const supabase = createClient('https://xyzcompany.supabase.co', 'public-anon-key', {+ fetch: fetch.bind(globalThis),+ })+ ```+ description: |+ `supabase-js` uses the [`cross-fetch`](https://www.npmjs.com/package/cross-fetch) library to make HTTP requests,+ but an alternative `fetch` implementation can be provided as an option.+ This is most useful in environments where `cross-fetch` is not compatible (for instance Cloudflare Workers).- id: sign-uptitle: 'signUp()'$ref: '@supabase/gotrue-js.GoTrueClient.signUp'