start-core-execution-model

Control server and client execution boundaries in TanStack Start applications.

Updated Dec 21, 2025
One-click install
npx skills add https://github.com/Angael/veles --skill start-core-execution-model-angael
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: start-core-execution-model
Source: https://github.com/Angael/veles/tree/main/.agents/skills/start-core-execution-model
Command: npx skills add https://github.com/Angael/veles --skill start-core-execution-model-angael

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? TanStack Start code is isomorphic by default, so secrets leak into client bundles and environment variables read at module scope break on edge runtimes. This Skill teaches how to place code on the correct side of the server/client boundary. ## Core Features & Use Cases - Execution Boundary APIs: Use createServerFn, createServerOnlyFn, createClientOnlyFn, and createIsomorphicFn to control where functions run. - Client-Only Rendering: Apply the ClientOnly component and useHydrated hook to avoid hydration mismatches for browser-only UI. - Environment Variable Safety: Enforce VITE_ prefix rules, per-request process.env reads, and import protection via server-only/client-only markers. - Use Case: When a route loader needs a database secret, wrap the fetch in createServerFn so the secret never reaches the client bundle and resolves correctly on Cloudflare Workers. ## Quick Start Ask the assistant to review your TanStack Start route loaders and move any secret-using code into createServerFn handlers.

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?

Wrap the logic in createServerFn, which executes directly on the server and becomes a network request when called from the client. For utility functions that must never run on the client, use createServerOnlyFn, which throws an error if invoked client-side.

Why is my process.env variable undefined in TanStack Start on Cloudflare Workers?

Edge runtimes like Cloudflare Workers inject environment variables per request, so module-level process.env reads evaluate to undefined. Read env inside a createServerFn .handler() or another per-request function instead of at module scope.

Do TanStack Start route loaders run on the server or client?

Loaders are isomorphic: they run on the server during SSR and on the client during navigation. Any secret or server-only operation inside a loader must be moved into a createServerFn call to avoid leaking into the client bundle.

How do I expose environment variables to the client in TanStack Start?

Only variables with the VITE_ prefix are exposed to the client bundle via import.meta.env. For non-prefixed server variables, pass them through a createServerFn handler and return the value to the loader or component.

How do I fix hydration mismatch errors in TanStack Start?

Render browser-dependent content only after hydration using the ClientOnly component with a fallback, or the useHydrated hook which returns false during SSR and true after hydration. This keeps server and first client render output identical.

When should I use createIsomorphicFn instead of createServerFn?

Use createIsomorphicFn when one symbol needs different implementations per environment, such as reading navigator.userAgent on the client and process.platform on the server. Use createServerFn when the logic must only ever execute on the server.