What problem does it solve?
Executing server-side logic directly from client components in SvelteKit often requires creating explicit API endpoints. Remote functions simplify this by providing a type-safe, RPC-like mechanism that handles serialization and validation automatically, saving you development time and reducing boilerplate.
Core Features & Use Cases
command() for Actions: Perform one-time server actions like creating, updating, or deleting data with automatic validation, ensuring data integrity.
query() for Reads: Fetch data from the server, with support for automatic batching to optimize network requests and improve performance.
form() for Progressive Forms: Integrate server-side form handling with client-side progressive enhancement, ensuring forms work robustly with or without JavaScript.
- Use Case: When you need to perform a database operation (e.g.,
delete_user), fetch specific data (get_user), or handle a form submission (login_form) directly from a Svelte component without manually setting up a +server.ts API route, this Skill streamlines your workflow.
Quick Start
I need to create a remote function in SvelteKit to delete a user by ID. Show me how to use command() with Valibot validation for the user ID.