A TanStack Start example demonstrating authentication with Auth.js (NextAuth.js).
To start a new project based on this example, run:
npx gitpick TanStack/router/tree/main/examples/react/start-basic-authjs start-basic-authjsThis 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 .envEdit .env and add your authentication provider credentials.
From your terminal:
pnpm install
pnpm devThis starts your app in development mode, rebuilding assets on file changes.
To build the app for production:
pnpm buildThis 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