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

vibra

v1.0.4

Published

Vibra: A blazing fast, type-safe, and minimal state management library for TypeScript and JavaScript. Effortless reactivity, subscriptions, and memory safety in a tiny package.

Readme

Vibra

npm version

A blazing fast, type-safe, and minimal state management library for TypeScript and JavaScript. Effortless reactivity, subscriptions, and memory safety in a tiny package.

🚀 Features

  • Type-safe: Full TypeScript support out of the box
  • Minimal API: Only get, getStrict, set, and subscribe
  • Reactive: Efficient observer pattern for instant updates
  • Memory safe: Automatic cleanup of subscriptions
  • Zero dependencies: Lightweight and fast
  • Framework agnostic: Works with any JS/TS project

📦 Installation

npm install vibra
# o
bun add vibra

🛠️ Basic Usage

import vibra from 'vibra';

const counter = vibra(0);

// Subscribe to changes
const unsubscribe = counter.subscribe((value) => {
  console.log(`Counter changed to: ${value}`);
});

// Update the state
counter.set(1);

// Get current value
console.log(counter.get()); // 1

// Cleanup subscription
unsubscribe();

⚡ Advanced Usage

Complex State

const user = vibra({ name: 'Alice', age: 30 });
user.subscribe((u) => console.log(u));
user.set({ name: 'Bob', age: 25 });

Type Safety

const store = vibra<string | null>(null);
store.set('Ready!');

Strict Reads (Non-Nullable)

Use getStrict() when you want a non-nullable read. It throws if the value is null or undefined.

const store = vibra<string | null>(null);

// Throws if value is null/undefined
store.getStrict();

store.set('Ready!');
const value: string = store.getStrict(); // value is string

Multiple Subscribers

const store = vibra(0);
const unsub1 = store.subscribe(v => console.log('A', v));
const unsub2 = store.subscribe(v => console.log('B', v));
store.set(5);
// Both subscribers are notified

Subscription Options

const store = vibra(42);

// Default behavior: callback is not called on subscribe
store.subscribe(value => console.log('Changed:', value));

// With callOnSubscribe: callback is called immediately with current value
store.subscribe(
  value => console.log('Current:', value),
  { callOnSubscribe: true }
);

// Useful for initializing UI or state
const userStore = vibra({ name: 'Alice' });
userStore.subscribe(
  user => updateUI(user),
  { callOnSubscribe: true } // Update UI immediately
);

🧩 API Reference

vibra<T>(initialValue: T)

Returns a store object with:

  • get(): T — Get the current value
  • getStrict(): NonNullableDefined<T> — Get the current value strictly (throws if value is null or undefined)
  • set(value: T): void — Set a new value (notifies subscribers if changed)
  • subscribe(callback: (value: T) => void, options?: SubscribeOptions): () => void — Subscribe to changes. Returns an unsubscribe function.

SubscribeOptions

interface SubscribeOptions {
  callOnSubscribe?: boolean; // If true, callback is called immediately with current value
}

⚛️ React Integration

For React applications, we provide a dedicated package vibra-react that offers React hooks and components for seamless integration with Vibra stores. Check out the vibra-react documentation for more details.

npm install vibra-react
# or
bun add vibra-react

💡 Why Vibra?

  • Ultra-lightweight: No bloat, just state
  • Predictable: No magic, no proxies, no hidden behaviors
  • Easy to test: Simple, functional API
  • Perfect for libraries and apps: Use it anywhere you need reactivity

🤝 Contributing

Pull requests and issues are welcome! Please open an issue to discuss your idea or bug before submitting a PR.

📄 License

MIT