Skip to content
Source
Sign inSign up
TanStack/router
Open History to see the last commit

README.md

51 lines1.2 KB

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