convelt Svelte Themes

Convelt

Lightweight utilities for integrating Convex with Svelte 5, featuring reactive queries, mutations with optimistic updates, and advanced patterns like conditional skipping. This is a **community version** of convex-svelte, created to improve developer experience and make working with Convex in Svelte applications more intuitive and enjoyable.

@pixelscortex/convelt

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.

Why I'm Building This

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.

Todo

  • createQuery with conditional skip
  • createCursorPagination with conditional skip
  • createMutation implementation + Optimistic Update
  • createAction implementation
  • Better Auth + Convex integration for SvelteKit
  • Composable UI helpers following shadcn/ui patterns
  • Convelte manager - subscription manager and cache manager

API Reference

createQuery

Creates 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
}));

createMutation

Creates 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>

Status

Under active development. Breaking changes likely as I figure things out. Maintained by 1 person.

License

MIT

Top categories

Loading Svelte Themes