Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/start/framework/react/getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ To use a different example, replace `start-basic` with one of the slugs below.
#### Examples

- [Basic](https://github.com/TanStack/router/tree/main/examples/react/start-basic) (`start-basic`)
- [Basic + Rsbuild](https://github.com/TanStack/router/tree/main/examples/react/start-basic-rsbuild) (`start-basic-rsbuild`)
- [Basic + Auth](https://github.com/TanStack/router/tree/main/examples/react/start-basic-auth) (`start-basic-auth`)
- [Counter](https://github.com/TanStack/router/tree/main/examples/react/start-counter) (`start-counter`)
- [Basic + React Query](https://github.com/TanStack/router/tree/main/examples/react/start-basic-react-query) (`start-basic-react-query`)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"image": "mcr.microsoft.com/devcontainers/typescript-node:24"
}
19 changes: 19 additions & 0 deletions examples/react/start-basic-rsbuild/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
node_modules
package-lock.json
yarn.lock

.DS_Store
.cache
.env
.vercel
dist
/build/
/api/
/server/build
/public/build# Sentry Config File
Comment thread
SyMind marked this conversation as resolved.
.env.sentry-build-plugin
/test-results/
/playwright-report/
/blob-report/
/playwright/.cache/
.tanstack
4 changes: 4 additions & 0 deletions examples/react/start-basic-rsbuild/.prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
**/build
**/public
pnpm-lock.yaml
routeTree.gen.ts
11 changes: 11 additions & 0 deletions examples/react/start-basic-rsbuild/.vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"files.watcherExclude": {
"**/routeTree.gen.ts": true
},
"search.exclude": {
"**/routeTree.gen.ts": true
},
"files.readonlyInclude": {
"**/routeTree.gen.ts": true
}
}
36 changes: 36 additions & 0 deletions examples/react/start-basic-rsbuild/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# TanStack Start - Basic Rsbuild Example

This is the basic TanStack Start Rsbuild example, demonstrating the fundamentals of building applications with TanStack Router and TanStack Start.

- [TanStack Router Docs](https://tanstack.com/router)

It's deployed automagically with Netlify!

- [Netlify](https://netlify.com/)

## Start a new project based on this example

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

```sh
npx gitpick TanStack/router/tree/main/examples/react/start-basic-rsbuild start-basic-rsbuild
```

## Getting Started

From your terminal:

```sh
pnpm install
pnpm dev
```

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

## Build

To build the app for production:

```sh
pnpm build
```
32 changes: 32 additions & 0 deletions examples/react/start-basic-rsbuild/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{
"name": "tanstack-start-example-basic-rsbuild",
"private": true,
"sideEffects": false,
"type": "module",
"scripts": {
"dev": "rsbuild dev --port 3000",
"build": "rsbuild build && tsc --noEmit",
"preview": "rsbuild preview",
"start": "srvx --prod -s ../client dist/server/index.js"
},
"dependencies": {
"@tanstack/react-router": "workspace:*",
"@tanstack/react-router-devtools": "workspace:^",
"@tanstack/react-start": "workspace:*",
"react": "^19.2.3",
"react-dom": "^19.2.3",
"tailwind-merge": "^3.6.0",
"zod": "^4.4.3"
},
"devDependencies": {
"@rsbuild/core": "^2.0.11",
"@rsbuild/plugin-react": "^2.0.0",
"@rsbuild/plugin-tailwindcss": "^2.0.3",
"@types/node": "25.0.9",
"@types/react": "^19.2.8",
"@types/react-dom": "^19.2.3",
"srvx": "^0.11.18",
"tailwindcss": "^4.2.2",
"typescript": "^6.0.2"
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
19 changes: 19 additions & 0 deletions examples/react/start-basic-rsbuild/public/site.webmanifest
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"name": "",
"short_name": "",
Comment thread
SyMind marked this conversation as resolved.
"icons": [
{
"src": "/android-chrome-192x192.png",
"sizes": "192x192",
"type": "image/png"
},
{
"src": "/android-chrome-512x512.png",
"sizes": "512x512",
"type": "image/png"
}
],
"theme_color": "#ffffff",
"background_color": "#ffffff",
"display": "standalone"
}
17 changes: 17 additions & 0 deletions examples/react/start-basic-rsbuild/rsbuild.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import { tanstackStart } from '@tanstack/react-start/plugin/rsbuild'
import { defineConfig } from '@rsbuild/core'
import { pluginReact } from '@rsbuild/plugin-react'
import { pluginTailwindcss } from '@rsbuild/plugin-tailwindcss'

export default defineConfig({
server: {
port: 3000,
},
plugins: [
pluginTailwindcss(),
pluginReact(),
tanstackStart({
srcDirectory: 'src',
}),
],
})
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
import {
ErrorComponent,
Link,
useLocation,
useRouter,
} from '@tanstack/react-router'
import type { ErrorComponentProps } from '@tanstack/react-router'

export function DefaultCatchBoundary({ error }: ErrorComponentProps) {
const router = useRouter()
const isRoot = useLocation({
select: (location) => location.pathname === '/',
})

console.error('DefaultCatchBoundary Error:', error)

return (
<div className="min-w-0 flex-1 p-4 flex flex-col items-center justify-center gap-6">
<ErrorComponent error={error} />
<div className="flex gap-2 items-center flex-wrap">
<button
onClick={() => {
router.invalidate()
}}
className={`px-2 py-1 bg-gray-600 dark:bg-gray-700 rounded-sm text-white uppercase font-extrabold`}
>
Try Again
</button>
{isRoot ? (
<Link
to="/"
className={`px-2 py-1 bg-gray-600 dark:bg-gray-700 rounded-sm text-white uppercase font-extrabold`}
>
Home
</Link>
) : (
<Link
to="/"
className={`px-2 py-1 bg-gray-600 dark:bg-gray-700 rounded-sm text-white uppercase font-extrabold`}
onClick={(e) => {
e.preventDefault()
window.history.back()
}}
Comment thread
SyMind marked this conversation as resolved.
>
Go Back
</Link>
)}
</div>
</div>
)
}
25 changes: 25 additions & 0 deletions examples/react/start-basic-rsbuild/src/components/NotFound.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import { Link } from '@tanstack/react-router'

export function NotFound({ children }: { children?: any }) {
return (
<div className="space-y-2 p-2">
<div className="text-gray-600 dark:text-gray-400">
{children || <p>The page you are looking for does not exist.</p>}
</div>
<p className="flex items-center gap-2 flex-wrap">
<button
onClick={() => window.history.back()}
className="bg-emerald-500 text-white px-2 py-1 rounded-sm uppercase font-black text-sm"
>
Go back
</button>
<Link
to="/"
className="bg-cyan-600 text-white px-2 py-1 rounded-sm uppercase font-black text-sm"
>
Start Over
</Link>
</p>
</div>
)
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import { ErrorComponent } from '@tanstack/react-router'
import type { ErrorComponentProps } from '@tanstack/react-router'

export function PostErrorComponent({ error }: ErrorComponentProps) {
return <ErrorComponent error={error} />
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import { ErrorComponent } from '@tanstack/react-router'
import type { ErrorComponentProps } from '@tanstack/react-router'

export function UserErrorComponent({ error }: ErrorComponentProps) {
return <ErrorComponent error={error} />
}
1 change: 1 addition & 0 deletions examples/react/start-basic-rsbuild/src/env.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/// <reference types="@rsbuild/core/types" />
Loading