apps/docs/content/guides/platform/custom-domains.mdx
Custom domains allow you to present a branded experience to your users. These are available as a paid add-on for projects on a paid plan.
There are two types of domains supported by Supabase:
api.example.com instead of the project's default domain.supabase.co for your project.You can choose either a custom domain or vanity subdomain for each project.
Custom domains change the way your project's URLs appear to your users. This is useful when:
Custom domains help you keep your APIs portable for the long term. By using a custom domain you can migrate from one Supabase project to another, or make it easier to version APIs in the future.
Follow the Custom Domains steps in the General Settings page in the Dashboard to set up a custom domain for your project.
This example assumes your Supabase project is abcdefghijklmnopqrst with a corresponding API URL abcdefghijklmnopqrst.supabase.co and configures a custom domain at api.example.com.
To get started:
api.example.com instead of example.com.You need to add a CNAME record to your domain's DNS settings to ensure your custom domain points to the Supabase project.
If your project's default domain is abcdefghijklmnopqrst.supabase.co you should:
api.example.com that resolves to abcdefghijklmnopqrst.supabase.co..Register your domain with Supabase to prove that you own it. You need to download two TXT records and add them to your DNS settings.
In the CLI, run domains create to register the domain and Supabase and get your verification records:
supabase domains create --project-ref abcdefghijklmnopqrst --custom-hostname api.example.com
A single TXT records is returned. For example:
[...]
Required outstanding validation records:
_acme-challenge.api.example.com. TXT -> ca3-F1HvR9i938OgVwpCFwi1jTsbhe1hvT0Ic3efPY3Q
Add the record to your domains' DNS settings. Make sure to trim surrounding whitespace. Use a low TTL value so you can quickly change the records if you make a mistake.
Some DNS registrars automatically append your domain name to the DNS entries being created. As such, creating a DNS record for api.example.com might instead create a record for api.example.com.example.com. In such cases, remove the domain name from the records you're creating; as an example, you would create a TXT record for api, instead of api.example.com.
Make sure you've configured all required DNS settings:
_acme-challenge.<your-custom-domain>.Use the domains reverify command to begin the verification process of your domain. You may need to run this command a few times because DNS records take a while to propagate.
supabase domains reverify --project-ref abcdefghijklmnopqrst
In the background, Supabase will check your DNS records and issue an SSL certificate. Supabase uses multiple Certificate Authorities (including Let's Encrypt, Google Trust Services and SSL.com) to ensure high availability. The specific issuer is chosen based on availability and this process can take up to 30 minutes.
Before you activate your domain, prepare your applications and integrations for the domain change:
EntityID of your project has changed, and this may cause SAML with existing identity providers to stop working.To prevent issues for your users, follow these steps:
https://abcdefghijklmnopqrst.supabase.co/auth/v1/callback andhttps://api.example.com/auth/v1/callbackhttps://api.example.com/auth/v1/... instead of https://abcdefghijklmnopqrst.supabase.co/auth/v1/sso/saml/{metadata,acs,slo}.Once you've done the necessary preparations to activate the new domain for your project, you can activate it using the domains activate CLI command.
supabase domains activate --project-ref abcdefghijklmnopqrst
When this step completes, Supabase will serve the requests from your new domain. The Supabase project domain continues to work and serve requests so you do not need to rush to change client code URLs.
If you wish to use the new domain in client code, change the URL used in your Supabase client libraries:
import { createClient } from '@supabase/supabase-js'
// Use a custom domain as the supabase URL
const supabase = createClient('https://api.example.com', 'publishable-or-anon-key')
Similarly, your Edge Functions will now be available at https://api.example.com/functions/v1/your_function_name, and your Storage objects at https://api.example.com/storage/v1/object/public/your_file_path.ext.
Removing a custom domain may cause some issues when using Supabase Auth with OAuth or SAML. You may have to reverse the changes made in the Prepare to activate your domain step above.
To remove an activated custom domain you can use the domains delete CLI command.
supabase domains delete --project-ref abcdefghijklmnopqrst
Vanity subdomains allow you to present a basic branded experience, compared to custom domains. They allow you to host your services at a custom subdomain on Supabase (e.g., my-example-brand.supabase.co) instead of the default, randomly assigned abcdefghijklmnopqrst.supabase.co.
To get started:
You can configure vanity subdomains via the CLI only.
Let's assume your Supabase project's domain is abcdefghijklmnopqrst.supabase.co and you wish to configure a vanity subdomain at my-example-brand.supabase.co.
Use the vanity-subdomains check-availability command of the CLI to check if your desired subdomain is available for use:
supabase vanity-subdomains --project-ref abcdefghijklmnopqrst check-availability --desired-subdomain my-example-brand --experimental
Before you activate your vanity subdomain, prepare your applications and integrations for the subdomain change:
EntityID of your project has changed, and this may cause SAML with existing identity providers to stop working.To prevent issues for your users, make sure you have gone through these steps:
https://abcdefghijklmnopqrst.supabase.co/auth/v1/callback andhttps://my-example-brand.supabase.co/auth/v1/callbackhttps://example-brand.supabase.co/auth/v1/... instead of https://abcdefghijklmnopqrst.supabase.co/auth/v1/sso/saml/{metadata,acs,slo}.Once you've chosen an available subdomain and have done all the necessary preparations for it, you can reconfigure your Supabase project to start using it.
Use the vanity-subdomains activate command to activate and claim your subdomain:
supabase vanity-subdomains --project-ref abcdefghijklmnopqrst activate --desired-subdomain my-example-brand --experimental
If you wish to use the new domain in client code, you can set it up like so:
import { createClient } from '@supabase/supabase-js'
// Use a custom domain as the supabase URL
const supabase = createClient('https://my-example-brand.supabase.co', 'publishable-or-anon-key')
When using Sign in with Twitter make sure your frontend code is using the subdomain only.
Removing a subdomain may cause some issues when using Supabase Auth with OAuth or SAML. You may have to reverse the changes made in the Prepare to activate the subdomain step above.
Use the vanity-subdomains delete command of the CLI to remove the subdomain my-example-brand.supabase.co from your project.
supabase vanity-subdomains delete --project-ref abcdefghijklmnopqrst --experimental
<$Show if="billing:all"> <$Partial path="billing/pricing/pricing_custom_domains.mdx" /> </$Show>