npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

zero-svelte-query

v0.10.0

Published

[![NPM Version](https://img.shields.io/npm/v/zero-svelte-query)](https://www.npmjs.com/package/zero-svelte-query) [![NPM Unpacked Size](https://img.shields.io/npm/unpacked-size/zero-svelte-query)](https://www.npmjs.com/package/zero-svelte-query) [![NPM Do

Readme

NPM Version NPM Unpacked Size NPM Downloads

zero-svelte-query

A Svelte library for integrating @rocicorp/zero with Svelte applications. Provides reactive query bindings and store integration for real-time data synchronization.

Features

  • ✨ Reactive query subscriptions
  • 🔄 Lightweight and minimalistic
  • ⚡️ Nice dev tools

Zero Svelte Options

stolinski/zero-svelte

This should be your go-to option. It appears to have functionality for optimal query fetching and other advanced features.

robertosnap/zero-svelte-query

This is a naively simple implementation, making it good for learning purposes or something to build upon. It's currently a createSubscriber wrapper around zero.query. The repository has some nice examples for Svelte and developer tools when creating Svelte applications.

Installation

From NPM

npm install zero-svelte-query
# or
pnpm add zero-svelte-query
# or
yarn add zero-svelte-query

Usage

See real examples in src/routes

Basic Query Example

<script lang="ts">
	import { useQuery } from 'zero-svelte-query';
	import { getZero } from '$lib/zero'; // Update to standard SvelteKit path

	const zero = getZero();
	const tags = useQuery(zero.query.tag); // Use const instead of let
</script>

{#if $tags?.current}
	{#each $tags.current as tag (tag.id)}
		<p>{tag.name}</p>
	{/each}
{/if}

Zero Store Configuration

Initialize Zero in your application setup. Here's a basic implementation example:

zero.state.svelte.ts // ... rest of existing code ...

import { schema, type Schema } from '$zero/schema';
import { Zero, type ZeroOptions } from '@rocicorp/zero';
import { get, writable } from 'svelte/store';

export const zeroStore = writable<Zero<Schema> | null>(null);

export const setZeroStore = (_options: Partial<ZeroOptions<Schema>>) => {
	const options = {
		schema,
		kvStore: "mem",
		logLevel: "debug",
		..._options,
	} as ZeroOptions<Schema>;
	zeroStore.set(new Zero(options));
}

export const getZero = () => {
	const z = get(zeroStore);
	if (!z) {
		throw new Error('Zero not initialized');
	}
	return z;
}

Then use it in for example a +layout.svelte file

setZeroStore({
    server: 'http://localhost:5949',
    auth: token || undefined,
    userID: userId || 'anon'
});

Development

Setup

# Install dependencies
pnpm install

# This will start a testcontainer with zero-cache, postgres and a vite svelte-kit application.
pnpm dev

# Run tests
pnpm test

# Run only unit tests
pnpm test:unit

# Run only e2e tests
pnpm test:e2e

Scripts

  • pnpm dev - Starts both backend and frontend development servers
  • pnpm build - Builds the package for production
  • pnpm schema - Builds the Zero schema
  • pnpm db:generate - Generates database files using Drizzle Kit

License

Apache 2.0

Contributing

Dont know yet

Learning

This library is a lightweight createSubscriber wrapper around the zero instance. You could basically just copy this file useQuery.svelte.ts and use it in your project.

Alternatives

zero-svelte (npm) offers additional caching features and more advanced query management.

Versions

| @rocicorp/zero | drizzle-zero-svelte | @rocicorp/zero spesific | |----------------|---------------------|------| | ^0.11.0 | ^ 0.1.0 | 0.11.2025011402 | | ^0.12.0 | ^ 0.2.0 | 0.12.2025012501 | | ^0.13.0 | ^ 0.3.0 | 0.13.2025013101 | | ^0.14.0 | ^ 0.4.0 | 0.14.2025020701 | | ^0.16.0 | ^ 0.5.0 | 0.16.2025022800 | | ^0.17.0 | ^ 0.6.0 | 0.17.2025031400 | | ^0.18.0 | ^ 0.7.0 | 0.18.2025042300 | | ^0.19.0 | ^ 0.8.0 | 0.19.2025050203 | | ^0.20.0 | ^ 0.9.0 | 0.20.2025052100 | | ^0.22.0 | ^ 0.10.0 | 0.22.202508020 |

Credits