Docs

Deploy an Astro app to production

Warning

This guide assumes that you have already installed Clerk in your application locally and are ready to deploy. If you haven't installed Clerk yet, please see our guide to installing Clerk in your Astro application first.

This guide will walk you through the steps to deploy your Astro app to production.

Deploy your Clerk app to production

Follow the guide on deploying your Clerk app to production.

Deploy to a hosting platform

To deploy to a hosting platform, it's recommended to choose one of the official adapters Astro offers. While the Node.js and Cloudflare adapters work out-of-the-box with Clerk, the Netlify and Vercel adapters have caveats. See the following sections for more information.

Netlify

Due to Netlify's caching strategies, one of Clerk's core mechanisms is unable to work as expected, resulting in infinite redirects that cause an app to fail. This also affects preview environments that use development API keys. It's recommended to use production API keys with a new domain.

Additionally, read this section about Edge middleware.

Vercel

Read this section about Edge middleware.

Issues with Edge middleware

The Netlify and Vercel adapters allow developers to convert the Astro middleware to an Edge middleware.

Currently, this is expected to not work for the following reasons:

  • Our Astro SDK populates Astro.locals.auth with a function that cannot be serialized.
  • For developers using Astro and React, SSR would not work as expected, as clerkMiddleware uses Async Local Storage, and it's stored value will not persist across the runtimes.

Feedback

What did you think of this content?

Last updated on