Skip to content

The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.

docs: update custom domain guide

Kang Ming405d396f9907
diff --git a/apps/docs/pages/guides/platform/custom-domains.mdx b/apps/docs/pages/guides/platform/custom-domains.mdx
index d885515b0e7..9d751bca152 100644
--- a/apps/docs/pages/guides/platform/custom-domains.mdx
+++ b/apps/docs/pages/guides/platform/custom-domains.mdx
@@ -71,8 +71,16 @@ The final activation step reconfigures your project to start serving traffic on
The auth service, in particular, will no longer work with the original URL (`foobarbaz.supabase.co`).
As such, it is recommended that you schedule a downtime window of 20-30 minutes, depending on the complexity of your project, to update all the services that need to know about your custom domain:
-- any client code (e.g., frontends, mobile apps)
-- any OAuth providers (e.g., google, github)
+- Any client code (e.g., frontends, mobile apps). You can initialize a new Supabase client with your custom domain, `api.example.com`. For example:
+
+ ```js
+ import { createClient } from '@supabase/supabase-js'
+
+ // Use a custom domain as the supabase URL
+ const supabase = createClient('https://api.example.com', 'public-anon-key')
+ ```
+
+- Any OAuth providers (e.g., google, github)
Additionally, update the DNS configuration for `api.example.com` to once more use a CNAME record that resolves to `foobarbaz.supabase.co`.
Finally, you can use the `activate` subcommand to reconfigure your project:
diff --git a/spec/supabase_js_v2.yml b/spec/supabase_js_v2.yml
index 7c05933ffeb..5dbac3626b7 100644
--- a/spec/supabase_js_v2.yml
+++ b/spec/supabase_js_v2.yml
@@ -34,6 +34,15 @@ functions:
// Create a single supabase client for interacting with your database
const supabase = createClient('https://xyzcompany.supabase.co', 'public-anon-key')
```
+ - id: create-client
+ name: With a custom domain
+ code: |
+ ```js
+ import { createClient } from '@supabase/supabase-js'
+
+ // Use a custom domain as the supabase URL
+ const supabase = createClient('https://my-custom-domain.com', 'public-anon-key')
+ ```
- id: with-additional-parameters
name: With additional parameters
code: |