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 🙏

© 2026 – Pkg Stats / Ryan Hefner

@sucoza/zustand-devtools-plugin

v0.1.9

Published

Zustand store inspector plugin for TanStack DevTools

Readme

Zustand DevTools Plugin

A custom plugin for TanStack DevTools that allows you to inspect and debug Zustand stores in real-time.

Features

  • 🔍 Real-time State Inspection: View the current state of all registered Zustand stores
  • 📊 Action History: Track state changes with before/after diffs
  • 🎯 Store Selection: Click on any store to inspect its state in detail
  • 🔎 Search: Filter stores by name
  • 🔄 Auto-refresh: Toggle automatic updates when state changes
  • 📝 JSON View: Expandable/collapsible JSON representation of store states

Installation

npm install @sucoza/zustand-devtools-plugin

Usage

1. Basic Setup with createDevToolsStore

The easiest way to integrate is using the createDevToolsStore wrapper:

import { create } from 'zustand';
import { createDevToolsStore } from '@sucoza/zustand-devtools-plugin';

interface UserState {
  user: User | null;
  login: (email: string) => void;
  logout: () => void;
}

// Wrap your store creation with createDevToolsStore
// The store hook type is preserved for full type safety
export const useUserStore = createDevToolsStore(
  'UserStore', // Store name for DevTools
  () => create<UserState>()((set) => ({
    user: null,
    login: (email) => {
      // Your login logic
    },
    logout: () => set({ user: null }),
  }))
);

// useUserStore is now fully typed with all UserState properties

2. Manual Registration (for existing stores)

If you have existing stores, you can register them manually:

import { useRegisterZustandStore } from '@sucoza/zustand-devtools-plugin';

// In your component
function MyComponent() {
  // Register an existing store
  useRegisterZustandStore('MyStore', useMyStore);
  
  // Your component logic...
}

3. Add the Plugin to TanStack DevTools

import { TanStackDevtools } from '@tanstack/react-devtools';
import { ZustandDevToolsPanel } from '@sucoza/zustand-devtools-plugin';

function App() {
  return (
    <>
      {/* Your app content */}
      
      <TanStackDevtools
        plugins={[
          {
            name: 'Zustand Stores',
            render: () => <ZustandDevToolsPanel />,
          },
        ]}
      />
    </>
  );
}

Advanced Usage

Using the DevTools Middleware

For more detailed action tracking, use the devtoolsMiddleware:

import { devtoolsMiddleware } from '@sucoza/zustand-devtools-plugin';

const useStore = create<State>()(
  devtoolsMiddleware((set) => ({
    // Your store configuration
  }))
);

Programmatic Access

You can also access store information programmatically:

import { zustandRegistry } from '@sucoza/zustand-devtools-plugin';

// Get all registered stores
const stores = zustandRegistry.getStores();

// Get action history
const history = zustandRegistry.getActionHistory();

// Clear action history
zustandRegistry.clearActionHistory();

Example

See the example directory for a complete working example with multiple stores:

  • User authentication store
  • Todo list store
  • Theme preferences store
  • Shopping cart store

How It Works

  1. Event Client: Uses TanStack's event system to communicate between your app and the DevTools
  2. Store Registry: Maintains a registry of all Zustand stores and subscribes to their changes
  3. DevTools Panel: React component that displays store states and action history
  4. Automatic Integration: createDevToolsStore wrapper handles all the setup automatically

API Reference

createDevToolsStore(name, storeCreator)

Creates a Zustand store with automatic DevTools registration.

useRegisterZustandStore(name, store)

React hook to register an existing store with DevTools.

devtoolsMiddleware(config)

Middleware for enhanced action tracking.

ZustandDevToolsPanel

React component for the DevTools panel UI.

License

MIT


Part of the @sucoza TanStack DevTools ecosystem.