Solid Start
TanStack Start provides full support for SolidJS, enabling you to build type-safe, full-stack applications with Solid’s fine-grained reactivity.Overview
Solid Start combines:- SolidJS - Fine-grained reactive UI library
- TanStack Router - Type-safe routing with search params
- TanStack Start - Server functions and full-stack capabilities
Installation
Server Functions
Create server functions withcreateServerFn:
Using in Route Loaders
POST Mutations
useServerFn Hook
UseuseServerFn to call server functions from components with automatic redirect handling:
Components
StartClient
The root client component for Solid applications:StartServer
The root server component for SSR:Routing
File-Based Routes
Organize routes in thesrc/routes directory:
Root Route
Dynamic Routes
Reactivity
Signals in Server Functions
Solid’s signals work seamlessly with server functions:Resources
UsecreateResource for async data with Suspense:
Data Loading
Deferred Loading
Forms
Progressive Enhancement
Middleware
Authentication Middleware
Client-Only Code
Mark browser-only modules:Server-Only Code
Mark server-only modules:Error Handling
Streaming
Stream responses withRawStream:
Best Practices
Use Fine-Grained Reactivity
Leverage Solid’s fine-grained updates:Suspense for Loading States
Use Suspense boundaries:Combine with Solid Query
Use Solid Query for advanced data fetching:API Reference
Solid-Specific Exports
All exports from@tanstack/solid-start:
Differences from React
- Signals instead of State: Use
createSignalinstead ofuseState - No useEffect: Use
createEffectoronMount - Control Flow: Use
<Show>,<For>,<Switch>instead of conditional rendering - Fine-grained Reactivity: Updates are more granular and efficient
Related
- SolidJS Documentation
- TanStack Router
- TanStack Query
- React Start - React version for comparison