0
Fork 0
mirror of https://github.com/TanStack/router.git synced 2026-11-16 19:38:07 +00:00
router/examples/react/start-basic-authjs
github-actions[bot] 67d9e69d72 ci: changeset release
History 2026-03-22 09:30:34 +00:00
..
.devcontainer docs: add devcontainer.json to all e2e/examples (#6972) 2026-03-18 15:43:14 +01:00
src chore: add source() to Tailwind v4 imports to ensure consistent hashing (#6459) 2026-01-24 01:49:12 +01:00
.env.example docs: start auth.js example (#5962) 2025-11-25 15:55:05 +01:00
.gitignore docs: start auth.js example (#5962) 2025-11-25 15:55:05 +01:00
package.json ci: changeset release 2026-03-22 09:30:34 +00:00
README.md docs(examples): standardize the READMEs for the React examples (#6014) 2025-12-07 01:39:44 +13:00
tsconfig.json docs: start auth.js example (#5962) 2025-11-25 15:55:05 +01:00
vite.config.ts docs: update examples/e2e to vite 8 (#6958) 2026-03-17 20:37:11 +01:00

TanStack Start - Auth.js Example

A TanStack Start example demonstrating authentication with Auth.js (NextAuth.js).

Start a new project based on this example

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

npx gitpick TanStack/router/tree/main/examples/react/start-basic-authjs start-basic-authjs

Setup

This example requires environment variables for Auth.js configuration. Copy the .env.example file to .env and fill in your authentication provider credentials:

cp .env.example .env

Edit .env and add your authentication provider credentials.

Getting Started

From your terminal:

pnpm install
pnpm dev

This starts your app in development mode, rebuilding assets on file changes.

Build

To build the app for production:

pnpm build

Authentication Configuration

This example demonstrates how to integrate Auth.js with TanStack Start. Check the source code for examples of:

  • Configuring authentication providers
  • Protecting routes with authentication
  • Accessing session data in server functions