Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions docs/start/framework/react/guide/server-functions.md
Original file line number Diff line number Diff line change
Expand Up @@ -270,6 +270,31 @@ export default defineConfig({
})
```

### Custom serialization adapters

You can create custom serialization adapters to handle complex types that can't be serialized by default.

Example:

```ts
// src/start.ts
import { createStart } from '@tanstack/react-start'
import { createSerializationAdapter } from '@tanstack/react-router'

const bigIntAdapter = createSerializationAdapter({
key: 'bigint',
test: (value: unknown): value is bigint => typeof value === 'bigint',
toSerializable: (bigInt) => bigInt.toString(),
fromSerializable: (value) => BigInt(value),
})

export const startInstance = createStart(() => {
return {
serializationAdapters: [bigIntAdapter],
}
})
```

---

> **Note**: Server functions use a compilation process that extracts server code from client bundles while maintaining seamless calling patterns. On the client, calls become `fetch` requests to the server.