A Convex client for Svelte that brings React's Convex hooks to Svelte. Built to match the features and developer experience of the React implementation.
I want Svelte to have the same Convex features and hooks that React enjoys. The official convex-svelte package is slow to update and missing functionality that React developers take for granted. This is my attempt to bridge that gap and give Svelte developers feature parity.
createQuery with conditional skipcreateCursorPagination with conditional skipcreateMutation implementation + Optimistic UpdatecreateAction implementationcreateQueryCreates a reactive query that automatically updates when data changes. Supports conditional skipping and client-side caching.
// Basic usage - no arguments needed
const allTodos = createQuery(api.todos.list);
// With arguments
const todoById = createQuery(api.todos.get, () => ({
args: { id: '123' }
}));
// Conditional skip
const skippedTodos = createQuery(api.todos.list, () => ({
args: shouldSkip ? 'skip' : undefined
}));
createMutationCreates a mutation function with built-in error handling and optimistic updates support.
// Basic mutation
const createTodo = createMutation(api.todos.create);
// With optimistic updates
const updateTodo = createMutation(api.todos.update, {
// Optimistic update logic
});
// Usage in event handlers
<button onclick={() => createTodo({ text: "New todo" })}>
Create Todo
</button>
Under active development. Breaking changes likely as I figure things out. Maintained by 1 person.
MIT