Skip to main content

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 with createServerFn:

Using in Route Loaders

POST Mutations

useServerFn Hook

Use useServerFn 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 the src/routes directory:

Root Route

Dynamic Routes

Reactivity

Signals in Server Functions

Solid’s signals work seamlessly with server functions:

Resources

Use createResource 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 with RawStream:

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

  1. Signals instead of State: Use createSignal instead of useState
  2. No useEffect: Use createEffect or onMount
  3. Control Flow: Use <Show>, <For>, <Switch> instead of conditional rendering
  4. Fine-grained Reactivity: Updates are more granular and efficient