Serialization

Server function arguments and return values are serialized so they can travel between server and client.


Configuration

Set the mode on solidStart() in vite.config.ts:

import { defineConfig } from "vite";
import { solidStart } from "@solidjs/start/config";
export default defineConfig({
plugins: [
solidStart({
serialization: { mode: "json" },
}),
],
});

Modes

  • json: deserializes with JSON.parse on the client. It avoids eval, so it fits a strict CSP. This is the default.
  • js: a smaller binary format that needs eval on the client, which a strong CSP blocks.

If your app enforces a Content Security Policy, keep json.


Server function payloads

SolidStart applies extra handling for certain payload types so file uploads and binary data can flow without being serialized by Seroval. This applies to both server function arguments and return values. SolidStart bypasses Seroval for:

  • FormData
  • URLSearchParams
  • Uint8Array
  • ArrayBuffer
  • Blob
  • File
  • string

Because these values are transferred directly, this can yield smaller payloads for these cases.


Last updated: 7/4/26, 6:33 PMEdit this pageReport an issue with this page