TanStack · Function
createServerFn
createServerFn defines server-only logic that application code can call through a typed RPC boundary. It supports validation, serialization, errors, redirects, forms, and server-side capabilities such as database access.
Last updated
Syntax
createServerFn(options?).validator(validator).handler(async ({ data }) => result)In-depth API docs are only for subscribers: parameters, examples, common mistakes and interview practice.
SubscribeRelated
useServerFn()validator()handler()createCsrfMiddleware()server routesmiddlewareredirect()notFound()