You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/guides/development/deployment/production.mdx
+67-37Lines changed: 67 additions & 37 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -47,16 +47,29 @@ If you're using a CSP, follow the instructions in the [CSP guide](/docs/guides/s
47
47
48
48
## Configure your domain
49
49
50
-
Production deployments use either a custom domain or a Vercel-provided `*.vercel.app` domain. Pick the section below that matches your setup.
50
+
Production deployments use either a custom domain or a Vercel-provided `*.vercel.app` domain.
51
+
52
+
On `*.vercel.app` instances, core auth emails are delivered through Clerk's shared `accounts.dev` email infrastructure. Custom domains support more features:
If you're using a custom domain, you'll need to be able to add DNS records on it. Clerk uses DNS records to provide session management and emails verified from your domain.
55
71
56
-
To see what DNS records you need, navigate to the [**Domains**](https://dashboard.clerk.com/~/domains) page in the Clerk Dashboard.
57
-
58
-
> [!NOTE]
59
-
> It can take up to 48hrs for DNS records to fully propagate.
72
+
To see what DNS records you need, navigate to the [**Domains**](https://dashboard.clerk.com/~/domains) page in the Clerk Dashboard. After you add them, propagation can take up to 48 hours.
60
73
61
74
> [!TIP]
62
75
> If you're unable to add a CNAME record for the Frontend API, you can use a proxy instead. See [Proxying the Clerk Frontend API](/docs/guides/dashboard/dns-domains/proxy-fapi) for more information.
@@ -65,6 +78,9 @@ To see what DNS records you need, navigate to the [**Domains**](https://dashboar
65
78
66
79
Production instances can use a Vercel-provided `*.vercel.app` domain. This setup is designed for Vercel apps and doesn't require you to add Clerk DNS records manually. Instead, Clerk routes browser auth traffic through your Vercel app using the `https://<your-app>.vercel.app/__clerk` proxy path.
67
80
81
+
> [!NOTE]
82
+
> This setup requires a Clerk SDK release with Vercel auto-proxy support: `@clerk/nextjs` 7.2.8+, `@clerk/clerk-js` 6.7.8+, or `@clerk/backend` 3.4.2+.
83
+
68
84
If you're using a Next.js proxy, ensure the matcher includes Clerk's proxy path:
69
85
70
86
```ts {{ filename: 'proxy.ts' }}
@@ -81,47 +97,61 @@ export const config = {
81
97
82
98
After you update your proxy's matcher, in the Clerk Dashboard, return to the [**Domains**](https://dashboard.clerk.com/~/domains) page and select **Verify proxy** to confirm that Clerk can reach the `__clerk` proxy path. Keep `/__clerk/(.*)` as a separate matcher entry, even if you already have a broad matcher, because Clerk also loads browser assets from `/__clerk/npm/...`. Without the explicit matcher, a static-asset exclusion can skip those requests and authentication can fail.
83
99
84
-
When using this setup:
100
+
Sign-up, sign-in, social OAuth callbacks, email-code verification, password verification, `auth()`, and `getToken()` all use the same auto-proxy path on your app domain.
85
101
86
-
- Use production Clerk API keys (`pk_live_` and `sk_live_`).
87
-
- Use a Clerk SDK release with Vercel auto-proxy support: `@clerk/nextjs` 7.2.8+, `@clerk/clerk-js` 6.7.8+, or `@clerk/backend` 3.4.2+.
102
+
#### Authentication on the app domain
88
103
89
-
Sign-up, sign-in, social OAuth callbacks, email-code verification, password verification, `auth()`, and `getToken()` all use the same auto-proxy path on your appdomain.
104
+
Production `*.vercel.app` instances have the hosted Account Portal disabled by default. The built-in Clerk components render in modal mode on your app's own domain, so they work without additional configuration:
90
105
91
-
Core auth emails are delivered through Clerk's shared `accounts.dev` email infrastructure, so custom domains are still recommended when you need full branded production behavior:
106
+
-`<SignIn />` and `<SignUp />` render on the page where you place them.
107
+
-`<UserButton />` opens `<UserProfile />` in a modal on the app domain.
108
+
-`<OrganizationSwitcher />` opens `<CreateOrganization />` and `<OrganizationProfile />` in modals on the app domain.
109
+
-`<SignOutButton />` and `clerk.signOut()` redirect to `/` by default.
If you need to opt out of modal mode or use programmatic redirects, the configuration depends on the mechanism.
104
112
105
-
#### Authentication on the app domain
113
+
##### Components in navigation mode
114
+
115
+
To make `<UserButton />` or `<OrganizationSwitcher />` navigate to dedicated pages instead of opening modals, pass navigation-mode props on the component instance and host the corresponding flow as a page.
116
+
117
+
For `<UserButton />`:
118
+
119
+
```tsx {{ prettier: false }}
120
+
// Open <UserProfile /> as a page at /user-profile instead of a modal
`<OrganizationSwitcher />` uses the same pattern across its two flows. Render `<CreateOrganization />` and `<OrganizationProfile />` on the matching pages:
106
128
107
-
Production `*.vercel.app` instances have the hosted Account Portal disabled by default. The built-in Clerk components render in modal mode on your app's own domain, so they work without additional configuration.
129
+
```tsx {{ prettier: false }}
130
+
// Open <CreateOrganization /> and <OrganizationProfile /> as pages instead of modals
131
+
<OrganizationSwitcher
132
+
createOrganizationMode="navigation"
133
+
createOrganizationUrl="/create-organization"
134
+
organizationProfileMode="navigation"
135
+
organizationProfileUrl="/organization"
136
+
/>
137
+
```
108
138
109
-
| Component | Behavior on `*.vercel.app`|
110
-
| - | - |
111
-
|`<SignIn />`, `<SignUp />`| Render on the app domain. |
112
-
|`<UserButton />`| Opens `<UserProfile />` in a modal on the app domain. |
113
-
|`<OrganizationSwitcher />`| Opens `<CreateOrganization />` and `<OrganizationProfile />` in modals on the app domain. |
114
-
|`<SignOutButton>`, `clerk.signOut()`| Redirect to `/` by default. |
139
+
##### Standalone redirect helpers
115
140
116
-
Programmatic redirect helpers and `navigation`-mode components read URLs from the instance's display config, which on a `*.vercel.app` instance point to the disabled Account Portal subdomain. To use them, host the corresponding flow on your app and pass the URL explicitly:
141
+
`clerk.redirectToUserProfile()`, `clerk.redirectToCreateOrganization()`, and `clerk.redirectToOrganizationProfile()` resolve to URLs in the instance's display config, which on a `*.vercel.app` instance points to the disabled Account Portal subdomain. They can't be overridden via `<ClerkProvider>` or component props. For these flows on `*.vercel.app`, use the navigation-mode component pattern above instead of calling the helpers directly.
0 commit comments