Open History to see the last commit
1# TanStack Start - Auth.js Example
2β
3A TanStack Start example demonstrating authentication with Auth.js (NextAuth.js).
4β
5- [TanStack Router Docs](https://tanstack.com/router)
6- [Auth.js Documentation](https://authjs.dev/)
7β
8## Start a new project based on this example
9β
10To start a new project based on this example, run:
11β
12```sh
13npx gitpick TanStack/router/tree/main/examples/react/start-basic-authjs start-basic-authjs
14```
15β
16## Setup
17β
18This example requires environment variables for Auth.js configuration. Copy the `.env.example` file to `.env` and fill in your authentication provider credentials:
19β
20```sh
21cp .env.example .env
22```
23β
24Edit `.env` and add your authentication provider credentials.
25β
26## Getting Started
27β
28From your terminal:
29β
30```sh
31pnpm install
32pnpm dev
33```
34β
35This starts your app in development mode, rebuilding assets on file changes.
36β
37## Build
38β
39To build the app for production:
40β
41```sh
42pnpm build
43```
44β
45## Authentication Configuration
46β
47This example demonstrates how to integrate Auth.js with TanStack Start. Check the source code for examples of:
48β
49- Configuring authentication providers
50- Protecting routes with authentication
51- Accessing session data in server functions