Back to Router

TanStack Router - Authenticated Routes Example

examples/react/authenticated-routes/README.md

1.166.7739 B
Original Source

TanStack Router - Authenticated Routes Example

An example demonstrating authentication and protected routes.

Start a new project based on this example

To start a new project based on this example, run:

sh
npx gitpick TanStack/router/tree/main/examples/react/authenticated-routes authenticated-routes

Getting Started

Install dependencies:

sh
pnpm install

Start the development server:

sh
pnpm dev

Build

Build for production:

sh
pnpm build

About This Example

This example demonstrates:

  • Authentication flow
  • Protected routes
  • Route guards
  • Login/logout functionality
  • Redirect after authentication
  • Public vs private routes