SvelteKit remote functions guidance. Use for command(), query(), form() patterns in .remote.ts files.
File naming: *.remote.ts for remote function files
Which function? One-time action → command() | Repeated reads →
query() | Forms → form()
// actions.remote.ts
import { command } from '$app/server';
import * as v from 'valibot';
export const delete_user = command(v.object({ id: v.string() }), async ({ id }) => {
await db.users.delete(id);
return { success: true };
});
// Call from client: await delete_user({ id: '123' });
getRequestEvent() available for cookies/headers access<svelte:boundary> + {@const await} (no flicker)query().refresh() - updates without flicker