start-core/execution-model

Control server and client execution boundaries in TanStack Start applications.

1.4k|34|Updated Mar 7, 2024
One-click install
npx skills add https://github.com/mehdibha/dotUI --skill start-core-execution-model-mehdibha
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: start-core/execution-model
Source: https://github.com/mehdibha/dotUI/tree/main/.claude/skills/tanstack-start-execution-model
Command: npx skills add https://github.com/mehdibha/dotUI --skill start-core-execution-model-mehdibha

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? TanStack Start code is isomorphic by default, meaning it runs in both server and client bundles, which makes it easy to accidentally leak secrets into the client bundle or cause hydration mismatches. This Skill teaches how to control exactly where code executes. ## Core Features & Use Cases - Environment Boundary APIs: Use createServerFn, createServerOnlyFn, createClientOnlyFn, and createIsomorphicFn to pin code to the correct runtime. - Client-Only Rendering: Apply the ClientOnly component and useHydrated hook for browser-only components and hydration-dependent logic. - Environment Variable Safety: Enforce correct use of VITE_-prefixed public variables versus unprefixed server secrets accessed only inside server functions. - Use Case: When a route loader needs an API secret, wrap the fetch in createServerFn so the secret never ships to the client bundle. ## Quick Start Ask the assistant to refactor a TanStack Start route loader so its secret API key is accessed only inside a createServerFn handler.

Frequently Asked Questions about start-core/execution-model

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I run server-only code in TanStack Start?▼

Use createServerFn to define a server function; on the client it becomes a network request while on the server it executes directly. For utilities that must never run on the client, use createServerOnlyFn, which throws an error if called in the browser.

Are TanStack Start route loaders server-only?▼

No, route loaders are isomorphic and run on both the server during SSR and the client during navigation. Any secret access or server-only logic inside a loader must be wrapped in createServerFn to avoid leaking values into the client bundle.

How do environment variables work in TanStack Start?▼

Only VITE_-prefixed variables are exposed to the client bundle via import.meta.env. Server secrets must have no prefix and be accessed via process.env only inside createServerFn or createServerOnlyFn handlers.

How do I fix hydration mismatch errors in TanStack Start?▼

Hydration mismatches happen when server and client render different content, such as dates or random values. Use the useHydrated hook or the ClientOnly component to defer browser-specific rendering until after hydration completes.

When should I use createIsomorphicFn instead of createServerFn?▼

Use createIsomorphicFn when you need different implementations per environment, chaining .server() and .client() handlers. Use createServerFn when the logic must execute only on the server, such as database access or secret usage.