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

@yaebal/sklad

v0.1.0

Published

yaebal sklad — the shared storage contract and zero-dependency adapters: memory (ttl/lru/clone), redis, sqlite, cloudflare kv, json file.

Downloads

360

Readme

@yaebal/sklad

the storage layer of the yaebal ecosystem: one StorageAdapter<T> contract shared by @yaebal/session, @yaebal/scenes, @yaebal/i18n, @yaebal/media-cache and @yaebal/morda, plus ready-made adapters — in-memory (ttl / lru / clone), redis, sqlite, cloudflare kv and a json file. every adapter takes an already-constructed client and types it structurally, so this package has zero dependencies and never dictates a driver version.

install

pnpm add @yaebal/sklad

the contract

interface StorageAdapter<T> {
	get(key: string): T | undefined | Promise<T | undefined>;
	set(key: string, value: T): unknown | Promise<unknown>;
	delete(key: string): unknown | Promise<unknown>;
	has?(key: string): boolean | Promise<boolean>;      // optional capability
	touch?(key: string): unknown | Promise<unknown>;    // optional: refresh ttl without rewriting
}

touch is how sliding expiry works: when an adapter advertises it, @yaebal/session calls it on reads that didn't change the value, so a session stays alive as long as the chat is active.

adapters

memory (default everywhere)

import { MemoryStorage } from "@yaebal/sklad";

const storage = new MemoryStorage<MySession>({
	ttl: 30 * 60_000, // expire 30min after the last write/touch (lazy, checked on read)
	max: 10_000,      // lru cap
});

values are structured-cloned on set/get by default, giving the same isolation a serializing adapter (redis, sqlite) gives — dev and prod behave identically. pass { clone: false } to share references instead (cheaper, but any mutation of a live object is instantly "persisted").

redis

import { redisStorage } from "@yaebal/sklad";
import Redis from "ioredis"; // or `createClient` from "redis" — both fit structurally

const storage = redisStorage<MySession>(new Redis(), {
	prefix: "bot:session:",
	ttl: 24 * 60 * 60_000, // EXPIRE, refreshed on every write and touch
});

sqlite

import { DatabaseSync } from "node:sqlite"; // or better-sqlite3 — both fit structurally
import { sqliteStorage } from "@yaebal/sklad";

const storage = sqliteStorage<MySession>(new DatabaseSync("bot.db"), { table: "sessions" });

cloudflare kv

import { kvStorage } from "@yaebal/sklad";

const storage = kvStorage<MySession>(env.SESSIONS, { ttl: 24 * 60 * 60_000 });

kv has no cheap ttl refresh, so expiry is per-write (no touch).

json file

import { fileStorage } from "@yaebal/sklad/file";

const storage = fileStorage<MySession>("./data/sessions.json", { pretty: true });

one json document, atomic writes (tmp + rename), operations serialized through an internal queue. the zero-infrastructure choice for small bots; one process per file.

options shared by persistent adapters

  • ttl — milliseconds everywhere; adapters convert to their native unit.
  • serializer — swap JSON for e.g. superjson: { stringify, parse } (redis / sqlite / kv).
  • prefix — key namespace (redis / kv).

part of yaebal — a type-safe, runtime-agnostic Telegram Bot API framework. MIT.