Skip to main content

Vue Start

TanStack Start provides full support for Vue 3, enabling you to build type-safe, full-stack applications with Vue’s Composition API.

Overview

Vue Start combines:
  • Vue 3 - Progressive JavaScript framework with Composition API
  • 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 Composable

Use useServerFn to call server functions from components with automatic redirect handling:

Components

StartClient

The root client component for Vue applications:

StartServer

The root server component for SSR:

Routing

File-Based Routes

Organize routes in the src/routes directory:

Root Route

Dynamic Routes

Composition API

Refs and Reactive

Vue’s reactivity works seamlessly with server functions:

Computed Properties

Data Loading

Deferred Loading

Forms

Progressive Enhancement

Form Validation

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 Composition API

Prefer <script setup> for cleaner code:

Suspense for Loading States

Use Suspense for async components:

Combine with Vue Query

Use Vue Query for advanced data fetching:

Single File Components

Leverage Vue’s SFC format:

API Reference

Vue-Specific Exports

All exports from @tanstack/vue-start:

Differences from React

  1. Refs instead of State: Use ref instead of useState
  2. Composition API: Use composables instead of hooks
  3. Template Syntax: Use Vue’s template syntax with directives
  4. Reactivity System: Vue’s reactivity is based on Proxies