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

@runicjs/runic

v0.1.9

Published

A lightweight, type-safe vanilla JS state management library

Downloads

31

Readme

Runic

Runic is a vanilla JS state management library. It's primary goal is to be simple, lightweight, and fast, and have a minimal API surface area that is easy to understand and ergonomic to use.

Warning Runic is in its infancy. It's not safe to use in production at this time.

Features

  • Simple API with a plain JavaScript approach to state updates
  • Updates powered by Immer to avoid excessive boilerplate
  • Full TypeScript support with strong type inference
  • Core implementation is ~25 sloc and has no dependencies
  • Optional integrations with Immer, Mutative, and more
  • Efficient updates through granular change detection and selective re-rendering
  • Support for atomic multi-store updates to maintain data consistency
  • No Providers, no actions, no reducers, minimal boilerplate

Roadmap

  • [x] Implement createStore
  • [x] Publish a proper build to NPM (https://www.npmjs.com/package/@runicjs/runic)
  • [x] Implement mergeState
  • [x] Implement resetState
  • [x] Implement Immer integrations (updateState & updateStates)
  • [x] Write tests
  • [x] Should I renamed "merge" to "patch"? - No
  • [ ] Test initialState passed to producer in updateState, updateStates
  • [ ] Test store.destroy()
  • [ ] Implement Mutative integrations (updateState & updateStates)
  • [ ] Think about middleware
  • [ ] Come up with a solution for persistence
  • [ ] Come up with a solution for logging
  • [ ] Come up with a solution for error reporting
  • [ ] Finalize the v0 API
  • [ ] Implement remaining functionality
  • [ ] Implement TodoMVC in vanilla JS using runic

Usage

Basic Store Creation and Updates

import { createStore } from '@runicjs/runic';

// Create a store with initial state
const counterStore = createStore({ count: 0 });

// Get the current state
console.log('Current count:', counterStore.getState().count);

// Subscribe to changes
const unsubscribe = counterStore.subscribe((state) => {
  console.log('New count:', state.count);
});

// Update state (changes are made immutably via Immer)
updateState(counterStore, (state) => {
  state.count += 1;
});

// No more state updates.
unsubscribe();

// Overwrite the entire state
const storedState = JSON.parse(localStorage.getItem('counter-store'));
counterStore.setState(storedState);

// Reset the store to the initial state
resetState(counterStore);

TypeScript Support

type Todo = { id: number; text: string; done: boolean };
type Todos = Array<Todo>;

const todosStore = createStore<Todos>([]);

// Write simple functions to update your stores.
function addTodo(newTodo: Todo) {
  updateState(todosStore, (todos) => {
    todos.push(newTodo);
  });
}

addTodo({ id: 1, text: 'Learn Runic', done: false });

Multi-Store Updates

import { updateStates } from '@runicjs/runic/integrations/immer';

// Create as many stores as you want.
const userStore = createStore<User>({ credits: 100 });
const inventoryStore = createStore<Inventory>(['potion']);

// Update multiple stores at once.
updateStates([userStore, inventoryStore], ([user, inventory]) => {
  user.credits -= 50;
  inventory.push('sword');
});