Skip to content

Commit d60718a

Browse files
authored
Merge pull request #5 from clerk/rob/tanstack-rc
2 parents a606276 + 1ba4784 commit d60718a

File tree

7 files changed

+38
-30
lines changed

7 files changed

+38
-30
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,10 @@ Clerk is a developer-first authentication and user management solution. It provi
3232
After following the [Clerk TanStack Start quickstart](https://clerk.com/docs/quickstarts/tanstack-start?utm_source=DevRel&utm_medium=docs&utm_campaign=templates&utm_content=08-05-2023&utm_term=clerk-tanstack-start-quickstart), you will have learned how to:
3333

3434
- Create a new TanStack Start application
35-
- Install `@clerk/tanstack-start@beta`
35+
- Install `@clerk/tanstack-react-start`
3636
- Set up your environment keys
37+
- Add `clerkMiddleware()` to your app
3738
- Wrap your Root Component with `<ClerkProvider />`
38-
- Configure `clerkHandler()` in the server handler entrypoint
3939
- Use Clerk components to protect your content
4040
- Embed the `<SignInButton />` and `<SignOutButton />`
4141
- Deploy your application

package.json

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -11,26 +11,28 @@
1111
"lint": "eslint . --report-unused-disable-directives --max-warnings 0"
1212
},
1313
"dependencies": {
14-
"@clerk/tanstack-react-start": "^0.23.0",
15-
"@tanstack/react-router": "^1.131.28",
16-
"@tanstack/react-router-devtools": "^1.131.28",
17-
"@tanstack/react-start": "^1.131.28",
14+
"@clerk/tanstack-react-start": "^0.26.0",
15+
"@tanstack/react-router": "^1.132.47",
16+
"@tanstack/react-router-devtools": "^1.133.1",
17+
"@tanstack/react-start": "^1.132.56",
1818
"react": "^19.1.0",
19-
"react-dom": "^19.1.0"
19+
"react-dom": "^19.1.0",
20+
"srvx": "0.8.15"
2021
},
2122
"devDependencies": {
2223
"@eslint/compat": "^1.3.1",
2324
"@eslint/js": "^9.31.0",
24-
"@typescript-eslint/parser": "^8.37.0",
25+
"@types/node": "^24.0.14",
26+
"@types/react": "^19.1.8",
27+
"@types/react-dom": "^19.1.6",
2528
"@typescript-eslint/eslint-plugin": "^8.37.0",
29+
"@typescript-eslint/parser": "^8.37.0",
30+
"@vitejs/plugin-react": "^4.3.4",
31+
"autoprefixer": "^10.4.21",
2632
"eslint": "^9.31.0",
2733
"eslint-plugin-react": "^7.37.5",
2834
"eslint-plugin-react-hooks": "^5.2.0",
2935
"eslint-plugin-react-refresh": "^0.4.20",
30-
"@types/node": "^24.0.14",
31-
"@types/react": "^19.1.8",
32-
"@types/react-dom": "^19.1.6",
33-
"autoprefixer": "^10.4.21",
3436
"prettier": "^3.6.2",
3537
"typescript": "^5.8.3",
3638
"typescript-eslint": "^8.37.0",

src/routeTree.gen.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,3 +57,13 @@ const rootRouteChildren: RootRouteChildren = {
5757
export const routeTree = rootRouteImport
5858
._addFileChildren(rootRouteChildren)
5959
._addFileTypes<FileRouteTypes>()
60+
61+
import type { getRouter } from './router.tsx'
62+
import type { startInstance } from './start.ts'
63+
declare module '@tanstack/react-start' {
64+
interface Register {
65+
ssr: true
66+
router: Awaited<ReturnType<typeof getRouter>>
67+
config: Awaited<ReturnType<typeof startInstance.getOptions>>
68+
}
69+
}

src/router.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
import { createRouter as createTanStackRouter } from '@tanstack/react-router'
1+
import { createRouter } from '@tanstack/react-router'
22
import { routeTree } from './routeTree.gen'
33

4-
export function createRouter() {
5-
const router = createTanStackRouter({
4+
export function getRouter() {
5+
const router = createRouter({
66
routeTree,
77
defaultPreload: 'intent',
88
defaultErrorComponent: (err) => <p>{err.error.stack}</p>,
@@ -15,6 +15,6 @@ export function createRouter() {
1515

1616
declare module '@tanstack/react-router' {
1717
interface Register {
18-
router: ReturnType<typeof createRouter>
18+
router: ReturnType<typeof getRouter>
1919
}
2020
}

src/server.ts

Lines changed: 0 additions & 14 deletions
This file was deleted.

src/start.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
import { clerkMiddleware } from '@clerk/tanstack-react-start/server';
2+
import { createStart } from '@tanstack/react-start';
3+
4+
export const startInstance = createStart(() => {
5+
return {
6+
requestMiddleware: [clerkMiddleware()],
7+
};
8+
});

vite.config.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { tanstackStart } from '@tanstack/react-start/plugin/vite'
22
import { defineConfig } from 'vite'
33
import tsConfigPaths from 'vite-tsconfig-paths'
4+
import viteReact from '@vitejs/plugin-react'
45

56
export default defineConfig({
67
server: {
@@ -11,5 +12,6 @@ export default defineConfig({
1112
projects: ['./tsconfig.json'],
1213
}),
1314
tanstackStart(),
15+
viteReact(),
1416
],
1517
})

0 commit comments

Comments
 (0)