Home / Companies / Clerk / Blog / Post Details
Content Deep Dive

Add Clerk authentication to a TanStack Start app with the Clerk CLI

Blog post from Clerk

Post Details
Company
Date Published
Author
Roy Anger
Word Count
5,376
Language
English
Hacker News Points
-
Summary

Clerk authentication can be integrated into a TanStack Start app by running the command `clerk init --framework tanstack-start` on an existing app, which automatically configures the <ClerkProvider> in the __root.tsx file, creates sign-in and sign-up routes, and incorporates `clerkMiddleware()` into the server's start.ts file. This integration process involves managing authentication configurations such as sign-in methods and session policies using the Clerk CLI, which also detects the framework and package manager from the app's configuration files. The setup includes installing necessary dependencies like @clerk/tanstack-react-start and updating the environment variables with Clerk's keys to ensure authentication functions properly. The walkthrough emphasizes the need to customize the landing page for user sign-in functionality and provides guidance on testing the integration with a TanStack Start app. Additionally, the Clerk CLI facilitates further configuration and inspection of the app's authentication setup, allowing developers to manage and update the authentication configuration as code, ensuring a robust setup for production use.