Remote functions • Docs • Svelte
DRANK

Available since 2.27Remote functions are a tool for type-safe communication between client and server. They can be called anywhere in your app, but always run on the server, and as such can safely access server-only modules containing things like environment variables and database clients.Combined with Svelte’s experimental support for await, it allows you to load and manipulate data directly inside your components.This feature is currently experimental, meaning it is likely to contain bugs and is subject to change without notice. You must opt in by adding the kit.experimental.remoteFunctions option in your svelte.config.js:svelte.configexport default { kit: { experimental: { remoteFunctions: boolean; }; }kit: { experimental: { remoteFunctions: boolean; }experimental: { remoteFunctions: booleanremoteFunctions: true } } };OverviewRemote functions are exported from a .remote.js or .remote.ts file, and come in four flavours: query, form, command and prerende…

svelte.dev
Related Topics: