Docs

Clerk environment variables

You can use environment variables to configure how your Clerk app behaves, such as where users are redirected after signing out of their account, or whether or not Clerk's telemetry should be enabled.

This page is a reference for all available Clerk environment variables.

Sign-in and sign-up redirects

Components, such as <ClerkProvider>, <UserButton>, and more, provide props for you to specify where users will be redirected. You should use environment variables instead of these props whenever possible.

See the Custom Redirects guide for more information.

VariableDescription
CLERK_SIGN_IN_URLFull URL or path to the sign in page. Use this variable to provide the target of the 'Sign In' link that's rendered in the <SignUp /> component.
CLERK_SIGN_UP_URLFull URL or path to the sign up page. Use this variable to provide the target of the 'Sign Up' link that's rendered in the <SignIn /> component.
CLERK_SIGN_IN_FORCE_REDIRECT_URLIf provided, this URL will always be redirected to after the user signs in.
CLERK_SIGN_UP_FORCE_REDIRECT_URLIf provided, this URL will always be redirected to after the user signs up.
CLERK_SIGN_IN_FALLBACK_REDIRECT_URLThe fallback URL to redirect to after the user signs in, if there's no redirect_url in the path already. Defaults to /.
CLERK_SIGN_UP_FALLBACK_REDIRECT_URLThe fallback URL to redirect to after the user signs up, if there's no redirect_url in the path already. Defaults to /.
VariableDescription
NEXT_PUBLIC_CLERK_SIGN_IN_URLFull URL or path to the sign in page. Use this variable to provide the target of the 'Sign In' link that's rendered in the <SignUp /> component.
NEXT_PUBLIC_CLERK_SIGN_UP_URLFull URL or path to the sign up page. Use this variable to provide the target of the 'Sign Up' link that's rendered in the <SignIn /> component.
NEXT_PUBLIC_CLERK_SIGN_IN_FORCE_REDIRECT_URLIf provided, this URL will always be redirected to after the user signs in.
NEXT_PUBLIC_CLERK_SIGN_UP_FORCE_REDIRECT_URLIf provided, this URL will always be redirected to after the user signs up.
NEXT_PUBLIC_CLERK_SIGN_IN_FALLBACK_REDIRECT_URLThe fallback URL to redirect to after the user signs in, if there's no redirect_url in the path already. Defaults to /.
NEXT_PUBLIC_CLERK_SIGN_UP_FALLBACK_REDIRECT_URLThe fallback URL to redirect to after the user signs up, if there's no redirect_url in the path already. Defaults to /.
VariableDescription
VITE_CLERK_SIGN_IN_URLFull URL or path to the sign in page. Use this variable to provide the target of the 'Sign In' link that's rendered in the <SignUp /> component.
VITE_CLERK_SIGN_UP_URLFull URL or path to the sign up page. Use this variable to provide the target of the 'Sign Up' link that's rendered in the <SignIn /> component.
VITE_CLERK_SIGN_IN_FORCE_REDIRECT_URLIf provided, this URL will always be redirected to after the user signs in.
VITE_CLERK_SIGN_UP_FORCE_REDIRECT_URLIf provided, this URL will always be redirected to after the user signs up.
VITE_CLERK_SIGN_IN_FALLBACK_REDIRECT_URLThe fallback URL to redirect to after the user signs in, if there's no redirect_url in the path already. Defaults to /.
VITE_CLERK_SIGN_UP_FALLBACK_REDIRECT_URLThe fallback URL to redirect to after the user signs up, if there's no redirect_url in the path already. Defaults to /.

Clerk publishable and secret keys

To access your Clerk app in your local project, you must specify your app's publishable keys for use in the frontend, and secret keys for use in the backend.

You can find these keys in the Clerk Dashboard on the API Keys page.

VariableDescription
CLERK_PUBLISHABLE_KEYYour Clerk app's publishable key. It will be prefixed with pk_test_ in development instances and pk_live_ in production instances.
CLERK_SECRET_KEYYour Clerk app's secret key, which you can find in the Clerk dashboard. It will be prefixed with sk_test_ in development instances and sk_live_ in production instances. Do not expose this on the frontend with a public environment variable.
VariableDescription
NEXT_PUBLIC_CLERK_PUBLISHABLE_KEYYour Clerk app's publishable key, which you can find in the Clerk dashboard. It will be prefixed with pk_test_ in development instances and pk_live_ in production instances.
CLERK_SECRET_KEYYour Clerk app's secret key, which you can find in the Clerk dashboard. It will be prefixed with sk_test_ in development instances and sk_live_ in production instances. Do not expose this on the frontend with a public environment variable.
VariableDescription
VITE_CLERK_PUBLISHABLE_KEYYour Clerk app's publishable key, which you can find in the Clerk dashboard. It will be prefixed with pk_test_ in development instances and pk_live_ in production instances.

API and SDK configuration

The following environment variables enable you to configure API and SDK behavior, such as what version of the SDK your project uses, what proxy URL you use to connect to Clerk's Frontend API, and more.

VariableDescription
CLERK_JS_URLSets the URL that @clerk/clerk-react should hot-load @clerk/clerk-js from. CLERK_JS does the same but is deprecated.
CLERK_JS_VERSIONSets the npm version for @clerk/clerk-js.
CLERK_API_URLSets the Clerk API URL for debugging. Defaults to "https://api.clerk.com"
CLERK_API_VERSIONSets the version of the Clerk API to use. Defaults to "v1"
CLERK_JWT_KEYSets the JWT verification key that Clerk will use to provide networkless JWT session token verification. See Networkless Token Verification to learn more.
CLERK_FAPISets the URL to your Clerk apps' Frontend API.
CLERK_PROXY_URLSets the URL for your proxy.
VariableDescription
NEXT_PUBLIC_CLERK_JS_URLSets the URL that @clerk/clerk-react should hot-load @clerk/clerk-js from. NEXT_PUBLIC_CLERK_JS does the same but is deprecated.
NEXT_PUBLIC_CLERK_JS_VERSIONSets the npm version for @clerk/clerk-js.
NEXT_PUBLIC_CLERK_API_URLSets the Clerk API URL for debugging. Defaults to "https://api.clerk.com"
NEXT_PUBLIC_CLERK_API_VERSIONSets the version of the Clerk API to use. Defaults to "v1"
CLERK_JWT_KEYSets the JWT verification key that Clerk will use to provide networkless JWT session token verification. See Networkless Token Verification to learn more.
NEXT_PUBLIC_CLERK_FAPISets the URL to your Clerk app's Frontend API.
NEXT_PUBLIC_CLERK_PROXY_URLSets the URL for your proxy.
VariableDescription
VITE_CLERK_JS_URLSets the URL that @clerk/clerk-react should hot-load @clerk/clerk-js from. VITE_CLERK_JS does the same but is deprecated.
VITE_CLERK_JS_VERSIONSets the npm version for @clerk/clerk-js.
VITE_CLERK_API_URLSets the Clerk API URL for debugging. Defaults to "https://api.clerk.com"
VITE_CLERK_API_VERSIONSets the version of the Clerk API to use. Defaults to "v1"
CLERK_JWT_KEYSets the JWT verification key that Clerk will use to provide networkless JWT session token verification. See Networkless Token Verification to learn more.
VITE_CLERK_FAPISets the URL to your Clerk apps' Frontend API.
VITE_CLERK_PROXY_URLSets the URL for your proxy.

Sattelite domains

Clerk supports sharing sessions across different domains by adding one or many satellite domains to an application. See the sattelite domains guide for more information.

VariableDescription
CLERK_DOMAINSets your satellite application's domain. Required to share sessions across multiple domains.
CLERK_IS_SATELLITEIndicates whether or not the application is a satellite application.
VariableDescription
NEXT_PUBLIC_CLERK_DOMAINSets your satellite application's domain. Required to share sessions across multiple domains.
NEXT_PUBLIC_CLERK_IS_SATELLITEIndicates whether or not the application is a satellite application.
VariableDescription
VITE_CLERK_DOMAINSets your satellite application's domain. Required to share sessions across multiple domains.
VITE_CLERK_IS_SATELLITEIndicates whether or not the application is a satellite application.

Telemetry

Clerk provides environment variables for opting out of telemetry data collection. See the telemetry documentation for more information.

VariableDescription
CLERK_TELEMETRY_DISABLEDSet this to 1 to disable Clerk's telemetry data collection.
CLERK_TELEMETRY_DEBUGSet this to 1 to prevent telemetry data from being sent to Clerk. It will be logged to the console instead.
VariableDescription
NEXT_PUBLIC_CLERK_TELEMETRY_DISABLEDSet this to 1 to disable Clerk's telemetry data collection.
NEXT_PUBLIC_CLERK_TELEMETRY_DEBUGSet this to 1 to prevent telemetry data from being sent to Clerk. It will be logged to the console instead.

If you are using @clerk/clerk-react directly, or using an SDK that doesn't have environment variable support, you can opt out by passing the telemetry prop to <ClerkProvider />. See the telemetry documentation for more information.

Feedback

What did you think of this content?