import { createFileRoute, Outlet } from '@tanstack/react-router' import { ClerkProvider } from '@clerk/clerk-react' import { ExternalLink, Key } from 'lucide-react' import { Alert, AlertDescription, AlertTitle } from '@/components/ui/alert' import { Separator } from '@/components/ui/separator' import { SidebarTrigger } from '@/components/ui/sidebar' import { AuthenticatedLayout } from '@/components/layout/authenticated-layout' import { Main } from '@/components/layout/main' import { ThemeSwitch } from '@/components/theme-switch' export const Route = createFileRoute('/clerk')({ component: RouteComponent, }) // Import your Publishable Key const PUBLISHABLE_KEY = import.meta.env.VITE_CLERK_PUBLISHABLE_KEY function RouteComponent() { if (!PUBLISHABLE_KEY) { return } return ( ) } function MissingClerkPubKey() { const codeBlock = 'bg-foreground/10 rounded-sm py-0.5 px-1 text-xs text-foreground font-bold' return (
No Publishable Key Found!

You need to generate a publishable key from Clerk and put it inside the .env file.

Set your Clerk API key

  1. In the{' '} Clerk {' '} Dashboard, navigate to the API keys page.
  2. In the Quick Copy section, copy your Clerk Publishable Key.
  3. Rename .env.example to{' '} .env
  4. Paste your key into your .env{' '} file.

The final result should resemble the following:

.env
                
                  
                    VITE_CLERK_PUBLISHABLE_KEY=YOUR_PUBLISHABLE_KEY
                  
                
              
Clerk Integration is Optional

The Clerk integration lives entirely inside{' '} src/routes/clerk. If you plan to use Clerk as your auth service, you might want to place{' '} ClerkProvider at the root route.

However, if you don't plan to use Clerk, you can safely remove this directory and related dependency_{' '} @clerk/clerk-react.

This setup is modular by design and won't affect the rest of the application.

) }