Feat: implement clerk for authentication and gate /my via server#139
Conversation
Enable server-side protection for My HackHQ and route Clerk sign-in/sign-up through a shared auth page so the member hub can rely on configured providers. Co-authored-by: Cursor <cursoragent@cursor.com>
Tune the embedded Clerk form to match the HackHQ dark brand while keeping social buttons and email inputs readable. Co-authored-by: Cursor <cursoragent@cursor.com>
/auth/* rendered <SignIn>/<SignUp> unconditionally, but ClerkProvider is only mounted when the publishable key exists — so with no Clerk keys (the documented default) every /auth route 500'd on "useSession can only be used within <ClerkProvider>". Redirect to /my, which explains setup, when Clerk is off. auth.protect() resolves its redirect as `signInUrl || <hosted account portal>`, and signInUrl is only read from clerkMiddleware options or NEXT_PUBLIC_CLERK_SIGN_IN_URL. Setting that var in .env.example alone meant any deployment carrying just the two Clerk keys would bypass the embedded /auth screens and land on accounts.dev. Pin signInUrl/signUpUrl in proxy.ts instead and drop the four NEXT_PUBLIC_CLERK_*_URL vars, which are no longer load-bearing. Also: 404 unknown /auth segments instead of serving sign-in at every URL; link the signed-out /my backstop to /auth/sign-in rather than embedding a second path-routed <SignIn>; collect the duplicated keys check into isClerkConfigured(). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
Nice work — this is close. I pushed a fix commit on top of the branch (ada66e5) for two things I ran into while testing it locally. 1. 2. The Smaller stuff in the same commit: unknown CI is green, and lint, build and the 56 tests all pass on the updated branch. One thing I need from you before I merge: can you run a real sign-in against your Clerk dev instance on the updated branch? Signed-out Separately, a rollout note for me to sort out: this flips |
Closes #138
Summary
/mywith server-side route protection./auth/[[...auth]]page.Test plan
npm --prefix web run lint.npm --prefix web run build./myredirecting to/auth/sign-inand/auth/sign-uprendering locally.