Sentry Tanstack Start SDK
Full Sentry SDK setup for TanStack Start React. Use when asked to "add Sentry to TanStack Start", "install @sentry/tanstackstart-react", or configure error monitoring, tracing, session replay, logs, or user feedback in a TanStack Start React app.
- Skill ID
- getsentry/sentry-for-ai/sentry-tanstack-start-sdk
- Publisher
- getsentry
- Repository
- sentry-for-ai
- Installs
- 0
- Files
- 7
- License
- Apache-2.0
- Synced
- Sep 23, 2026
Open any RiverX project, open the Skills panel in the chat, and search for this identifier. The files are fetched from the source repository at install time.
getsentry/sentry-for-ai/sentry-tanstack-start-sdkInstalls these files- SKILL.md
- references/error-monitoring.md
- references/logging.md
- references/session-replay.md
- references/tanstackstart-features.md
- references/tracing.md
- references/user-feedback.md
What this skill tells the agent
All Skills > SDK Setup > TanStack Start React SDK
Sentry TanStack Start React SDK
Opinionated wizard that scans your TanStack Start React project and guides you through complete Sentry setup for browser and server runtimes.
Invoke This Skill When
- User asks to "add Sentry to TanStack Start" or "set up Sentry" in a TanStack Start React app
- User wants to install or configure
@sentry/tanstackstart-react - User wants error monitoring, tracing, session replay, logs, or user feedback for TanStack Start React
- User asks about
sentryTanstackStart,wrapFetchWithSentry,instrument.server.mjs, or TanStack Start middleware instrumentation
Note: This SDK is currently alpha and documented as compatible with TanStack Start 1.0 RC. Always verify against docs.sentry.io/platforms/javascript/guides/tanstackstart-react/ before implementing.Phase 1: Detect
Run these commands to understand the project before making any recommendations:
# Detect TanStack Start / Router and existing Sentry
cat package.json | grep -E '"@tanstack/react-start"|"@tanstack/react-router"|"@sentry/tanstackstart-react"'
# Check if Sentry is already present
cat package.json | grep '"@sentry/'
# Detect key files used by the TanStack Start setup
ls src/router.tsx src/start.ts src/server.ts instrument.server.mjs vite.config.ts vite.config.js 2>/dev/null
# Check whether source map upload credentials are configured
cat .env .env.local .env.sentry-build-plugin 2>/dev/null | grep "SENTRY_AUTH_TOKEN"
# Detect deployment hints in scripts
cat package.json | grep -E '"dev"|"build"|"start"|NODE_OPTIONS|--import'
# Detect logging libraries
cat package.json | grep -E '"pino"|"winston"|"loglevel"'
# Detect companion backend directories
ls ../backend ../server ../api 2>/dev/null
cat ../go.mod ../requirements.txt ../Gemfile ../pom.xml 2>/dev/null | head -3What to determine:
| Question | Impact |
|---|---|
@tanstack/react-start present? | Confirms this skill is the right setup path |
@sentry/tanstackstart-react already installed? | Skip install and go to feature tuning |
src/router.tsx exists? | Client-side Sentry.init placement |
src/start.ts exists? | Global middleware setup for server-side errors |
src/server.ts exists? | Server entry instrumentation placement |
instrument.server.mjs exists? | Runtime startup instrumentation path |
vite.config.ts exists? | Add sentryTanstackStart plugin and source maps |
SENTRY_AUTH_TOKEN configured? | Source map upload readiness |
| Backend directory found? | Trigger Phase 4 cross-link suggestion |
Phase 2: Recommend
Present a concrete recommendation based on what you found. Do not ask open-ended questions — lead with a proposal:
Recommended (core coverage):
- ✅ Error Monitoring — always; captures unhandled client and server errors
- ✅ Tracing — high-value for request and route timing across browser and server
- ✅ Session Replay — recommended for user-facing apps
Optional (enhanced observability):
- ⚡ Logs — recommend when structured log search and log-to-trace correlation are needed
- ⚡ User Feedback — recommend when product teams want in-app issue reports
Recommendation logic:
| Feature | Recommend when... |
|---|---|
| Error Monitoring | Always — non-negotiable baseline |
| Tracing | Usually yes for TanStack Start; route + fetch instrumentation gives immediate value |
| Session Replay | User-facing app, login flows, checkout flows, or hard-to-reproduce UX bugs |
| Logs | Existing logging strategy, support workflow, or trace/log correlation needs |
| User Feedback | Team wants direct user reports without leaving the app |
Propose: "I recommend Error Monitoring + Tracing + Session Replay. Want me to also enable Logs and User Feedback?"
Phase 3: Guide
Install
npm install @sentry/tanstackstart-react --saveConfigure Client-Side Sentry in src/router.tsx
Initialize Sentry inside the router factory and gate it to the browser:
import * as Sentry from "@sentry/tanstackstart-react";
import { createRouter } from "@tanstack/react-router";
export const getRouter = () => {
const router = createRouter();
if (!router.isServer) {
Sentry.init({
dsn: "___PUBLIC_DSN___",
dataCollection: {
// userInfo: false,
// httpBodies: [],
},
integrations: [
Sentry.tanstackRouterBrowserTracingIntegration(router),
Sentry.replayIntegration(),
Sentry.feedbackIntegration({
colorScheme: "system",
}),
],
enableLogs: true,
tracesSampleRate: 1.0,
replaysSessionSampleRate: 0.1,
replaysOnErrorSampleRate: 1.0,
});
}
return router;
};Configure Server-Side Sentry in instrument.server.mjs
Create instrument.server.mjs in project root:
import * as Sentry from "@sentry/tanstackstart-react";
Sentry.init({
dsn: "___PUBLIC_DSN___",
dataCollection: {
// To disable sending user data and HTTP bodies, uncomment the lines below. For more info visit:
// https://docs.sentry.io/platforms/javascript/guides/tanstackstart-react/configuration/options/#dataCollection
// userInfo: false,
// httpBodies: [],
},
enableLogs: true,
tracesSampleRate: 1.0,
});Configure Vite Plugin in vite.config.ts
sentryTanstackStart should be the last plugin:
import { defineConfig } from "vite";
import { sentryTanstackStart } from "@sentry/tanstackstart-react/vite";
import { tanstackStart } from "@tanstack/react-start/plugin/vite";
export default defineConfig({
plugins: [
tanstackStart(),
sentryTanstackStart({
org: "___ORG_SLUG___",
project: "___PROJECT_SLUG___",
authToken: process.env.SENTRY_AUTH_TOKEN,
}),
],
});If the token is stored in .env, load it with loadEnv in the Vite config before passing it to the plugin.
Instrument Server Entry Point in src/server.ts
Wrap the fetch handler with wrapFetchWithSentry:
import { wrapFetchWithSentry } from "@sentry/tanstackstart-react";
import handler, { createServerEntry } from "@tanstack/react-start/server-entry";
export default createServerEntry(
wrapFetchWithSentry({
fetch(request: Request) {
return handler.fetch(request);
},
}),
);Add Global Server Middleware in src/start.ts
These middleware capture server-side request and function errors:
import {
sentryGlobalFunctionMiddleware,
sentryGlobalRequestMiddleware,
} from "@sentry/tanstackstart-react";
import { createStart } from "@tanstack/react-start";
export const startInstance = createStart(() => {
return {
requestMiddleware: [sentryGlobalRequestMiddleware],
functionMiddleware: [sentryGlobalFunctionMiddleware],
};
});Sentry middleware should be first in each array.
Runtime Startup Patterns
Choose one runtime method:
| Runtime pattern | Use when... | Notes |
|---|---|---|
--import flag | You can control Node startup flags | Preferred for production monitoring |
Direct import in src/server.ts | Host restricts startup flags (for example serverless hosts) | Limits instrumentation to native Node APIs |
--import examples:
{
"scripts": {
"dev": "NODE_OPTIONS='--import ./instrument.server.mjs' vite dev --port 3000",
"build": "vite build && cp instrument.server.mjs .output/server",
"start": "node --import ./.output/server/instrument.server.mjs .output/server/index.mjs"
}
}Direct import fallback (top of src/server.ts):
import "../instrument.server.mjs";For Each Agreed Feature
Walk through features one at a time. Load the reference file, follow steps exactly, and verify before moving on:
More from getsentry
Use this skill in a project
Open any RiverX project, search the Skills panel for getsentry/sentry-for-ai/sentry-tanstack-start-sdk, and install it in one click.
