Skip to content

Add a "Protect your pages" step (server-side auth read)#12

Open
manovotny wants to merge 2 commits into
mainfrom
manovotny/docs-11853-protect-your-pages
Open

Add a "Protect your pages" step (server-side auth read)#12
manovotny wants to merge 2 commits into
mainfrom
manovotny/docs-11853-protect-your-pages

Conversation

@manovotny

@manovotny manovotny commented Jun 16, 2026

Copy link
Copy Markdown
Contributor

Summary

Adds a /protected route to the quickstart that reads the signed-in user on the server and redirects signed-out visitors to /, plus a "Protected" nav link shown only when signed in.

Why

The quickstart currently ends at client-side UI (<SignInButton>, <UserButton>, <SignedIn>). This adds the missing half — reading the authenticated user in your own server code — and makes the model explicit:

Client components control visibility. The server controls access.

It mirrors the pattern already shipped in the TanStack React Start quickstart.

What's here

  • A /protected route using this SDK's server-side auth helper, redirecting signed-out users to / and rendering the user's ID when signed in.
  • A "Protected" link in the header, gated by <SignedIn>.

Verification

Booted with real Clerk keys: signed-out /protected redirects to /; signed-in renders the user's ID. Type-checks clean.

Part of DOCS-11853.

🤖 Generated with Claude Code

Companion PRs

Add a /protected route that reads the signed-in user on the server and
redirects signed-out visitors, plus a "Protected" nav link shown only when
signed in: client components control visibility, the server controls access.

Part of DOCS-11853.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…protect-your-pages

# Conflicts:
#	app/root.tsx
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant