TanStack Start Best Practices
Selected guidelines for implementing TanStack Start patterns in full-stack React applications. These rules cover server functions, middleware, SSR, authentication, and deployment.
When to Apply
- Creating server functions for data mutations
- Setting up middleware for auth/logging
- Configuring SSR and hydration
- Implementing authentication flows
- Handling errors across client/server boundary
- Organizing full-stack code
- Deploying to various platforms
Available local rules
This package contains 13 rule files. Consult the official documentation for topics not covered here, matching the installed package version.
- api-routes: Create Server Routes for External Consumers
- auth-route-protection: Protect Routes with beforeLoad
- auth-session-management: Implement Secure Session Handling
- deploy-adapters: Configure the Host's Vite Plugin
- env-functions: Use Environment Functions for Configuration
- err-server-errors: Handle Server Function Errors
- file-separation: Separate Server and Client Code
- mw-request-middleware: Use Request Middleware for Cross-Cutting Concerns
- sf-create-server-fn: Use createServerFn for Server-Side Logic
- sf-input-validation: Always Validate Server Function Inputs
- ssr-hydration-safety: Prevent Hydration Mismatches
- ssr-prerender: Configure Static Prerendering and CDN Caching
- ssr-streaming: Implement Streaming SSR for Faster TTFB
How to Use
Each rule file in the rules/ directory contains:
- Explanation — Why this pattern matters
- Bad Example — Anti-pattern to avoid
- Good Example — Recommended implementation
- Context — When to apply or skip this rule
Full Reference
See individual rule files in rules/ directory for detailed guidance and code examples.