start-core/server-functions

Installation
SKILL.md

Server Functions

Server functions are type-safe RPCs created with createServerFn. They run exclusively on the server but can be called from anywhere — loaders, components, hooks, event handlers, or other server functions.

CRITICAL: Server functions are RPC endpoints. They are reachable by direct POST regardless of which route renders the calling UI. Auth must be enforced inside the handler (or via middleware) — a route beforeLoad does NOT protect the RPC. See start-core/auth-server-primitives for the session/middleware pattern. CRITICAL: Loaders are ISOMORPHIC — they run on BOTH client and server. Database queries, file system access, and secret API keys MUST go inside createServerFn, NOT in loaders directly. CRITICAL: Do not use "use server" directives, getServerSideProps, or any Next.js/Remix server patterns. TanStack Start uses createServerFn exclusively.

Basic Usage

import { createServerFn } from '@tanstack/react-start'

// GET (default)
const getData = createServerFn().handler(async () => {
  return { message: 'Hello from server!' }
})
Installs
GitHub Stars
16
First Seen
start-core/server-functions — lightfastai/lightfast