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

@contfu/contfu

v0.2.1

Published

Local Runtime and Local Store library for Contfu-powered applications

Readme

@contfu/contfu

Local Runtime and Local Store library for Contfu-powered applications.

Use this package when you want to receive Sync Messages through the Connector, apply them into a local SQLite database, process Media Files, and query content locally. If your application should query a user-hosted Server over HTTP, use @contfu/client instead.

Usage

By default, @contfu/contfu stores its SQLite database at data/contfu.sqlite. Override this with the DATABASE_URL environment variable when needed.

import { connect } from "@contfu/contfu";

// Run the Local Runtime: receive Sync Messages and write the Local Store.
for await (const event of connect()) {
  console.log(event.type, event);
}

Entry points

| Import | Runtime | | ----------------------- | ------------------------------------------------------------------------------------------------------------------------------ | | @contfu/contfu | Default Local Runtime entry. Uses Bun's DB client under Bun and a Node-compatible fallback elsewhere. | | @contfu/contfu/node | Node.js Local Runtime entry that loads the Node SQLite client directly. | | @contfu/contfu/shared | Shared Local Runtime exports without the db singleton export; still intended for server-side local-store code, not browsers. |

File and media processing

@contfu/contfu runs inside the Local Runtime. During connect(), it receives item data and File references, downloads referenced files from their source URLs, stores them locally, and processes media inside the application boundary. The Cloud Service does not own file storage or media processing for this package.

You can plug in custom local or application-operated file storage and media optimization by passing fileStore and mediaOptimizer options to connect():

import { connect } from "@contfu/contfu";
import { BunFileStore } from "@contfu/bun-file-store";
import { M4kOptimizer } from "@contfu/media-optimizer";

for await (const event of connect({
  fileStore: new BunFileStore("/var/contfu/files"),
  mediaOptimizer: new M4kOptimizer(),
})) {
  // Files are downloaded, stored, and processed by the Local Runtime while Sync Messages are applied.
}

Public exports

The package barrel exports the Local Runtime surface used by embedded applications:

  • Runtime orchestration: connect, contfu, createRuntimeEventMonitor, and runtime status/event types.
  • Local Store access: db, generated table definitions, row/update types, item CRUD helpers, collection helpers, sync-index helpers, and file helpers.
  • Querying: findItems, queryItems, getItemById, QueryResultArray, filter builders such as eq, and, linksTo, and typed query helper types.
  • Media and files: FileStore, DBStore, fileStore, loadFile, convertMedia, media optimizer/config types, and file progress/content types.
  • Hooks and utilities: event hook composition helpers, generateTypes, local-store count/list helpers, deleteNulls, and detectRuntime.

@contfu/contfu/shared omits the root-only db singleton export but otherwise exposes the shared Local Runtime API used by the runtime-specific entry points.