Skip to content

Support optional Clerk auth and add local preview mode#1

Open
maxwellt7 wants to merge 1 commit intomainfrom
codex/complete-ci-setup-and-feature-verification
Open

Support optional Clerk auth and add local preview mode#1
maxwellt7 wants to merge 1 commit intomainfrom
codex/complete-ci-setup-and-feature-verification

Conversation

@maxwellt7
Copy link
Copy Markdown
Owner

Motivation

  • Allow the dashboard to run in a local preview mode when Clerk environment variables are not set so the UI can build without external auth.
  • Surface a clear notice on sign-in/sign-up pages and provide a fallback user UI when auth is not configured.
  • Apply route protection only when Clerk is configured to avoid blocking local development.
  • Centralize Clerk configuration detection for use across the app.

Description

  • Added apps/dashboard/lib/clerk.ts and isClerkConfigured to detect presence of NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY and CLERK_SECRET_KEY and used it across the app.
  • Made RootLayout render a plain AppShell when Clerk is not configured and otherwise wrap the app in ClerkProvider with signInUrl/signUpUrl set.
  • Updated TabsLayout to only call auth() when Clerk is configured, default role to admin when not configured, and show a "Preview mode" badge in the header when running without Clerk.
  • Replaced the previous global middleware.ts with proxy.ts that conditionally applies clerkMiddleware only if Clerk is configured and otherwise returns NextResponse.next().
  • Added AuthConfigNotice component and updated sign-in and sign-up pages to display it when Clerk is not configured.
  • Updated UserMenu to render a simple "Local preview" pill when Clerk is not configured instead of using UserButton.
  • Added eslint.config.mjs and changed the lint script in apps/dashboard/package.json to run eslint with the new config followed by tsc --noEmit.
  • Updated turbo.json to include Clerk environment variables in globalEnv so builds consider them.

Testing

  • Ran lint and type checks via the new lint command (eslint . --config eslint.config.mjs --ext .js,.mjs and tsc --noEmit) and they completed successfully.
  • Verified the app renders the sign-in/sign-up notice and header preview badge when NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY/CLERK_SECRET_KEY are absent, and that the clerkMiddleware path is exercised when those variables are present (manual dev verification).

Codex Task

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant