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

pomegranate-db

v1.1.0

Published

Reactive offline-first database with sync support

Readme


⚡️ Instant Launch

Lazy-loaded — only fetch data when you need it. Your app starts fast no matter how much data you have.

📈 Highly Scalable

Handle hundreds to tens of thousands of records with consistent performance.

🔄 Offline-First

Built-in sync protocol with push/pull reconciliation. Works offline, syncs when connected.

⚛️ Optimized for React

Reactive hooks keep your UI in sync automatically. Zero boilerplate subscriptions.

🔌 Pluggable Adapters

LokiJS, Expo SQLite, op-sqlite, or JSI C++. Swap storage backends without changing app code.

🔐 Encryption at Rest

Optional AES-GCM encryption or SQLCipher via op-sqlite. Protect user data on-device.


Why PomegranateDB?

  • Schema-first: Define your models declaratively with full type inference
  • Reactive queries: UI updates automatically when data changes — via hooks or observables
  • Offline-first sync: Built-in pull/push protocol that works offline and reconciles on reconnect
  • Pluggable adapters: Choose the right storage backend for your app — LokiJS (in-memory), Expo SQLite, op-sqlite, or our own JSI C++ adapter
  • TypeScript-native: The whole codebase is idiomatic TypeScript. Types flow from schema to model to query to component

Quick Example

import { m, Model, Database, LokiAdapter } from 'pomegranate-db';

// 1. Define your schema
const PostSchema = m.model('posts', {
  title: m.text(),
  body: m.text(),
  status: m.text(),
  createdAt: m.date('created_at').readonly(),
});

// 2. Create a model class
class Post extends Model<typeof PostSchema> {
  static schema = PostSchema;
}

// 3. Initialize the database
const db = new Database({
  adapter: new LokiAdapter({ databaseName: 'myapp' }),
  models: [Post],
});

await db.initialize();

// 4. Write data
await db.write(async () => {
  await db.get(Post).create({
    title: 'Hello World',
    body: 'My first post',
    status: 'draft',
  });
});

// 5. Query data
const posts = await db.get(Post)
  .query()
  .where('status', 'draft')
  .fetch();

React Integration

import { DatabaseProvider, useLiveQuery } from 'pomegranate-db';

function App() {
  return (
    <DatabaseProvider value={db}>
      <PostList />
    </DatabaseProvider>
  );
}

function PostList() {
  const { results: posts, isLoading } = useLiveQuery(Post, (q) =>
    q.where('status', 'eq', 'published').orderBy('created_at', 'desc'),
  );

  if (isLoading) return <Text>Loading...</Text>;

  return posts.map((post) => (
    <Text key={post.id}>{post.title}</Text>
  ));
}

Installation

npm install pomegranate-db

Install adapter-specific peers only when you use those entry points:

  • pomegranate-db -> react
  • pomegranate-db/expo -> react, expo-sqlite
  • pomegranate-db/encryption -> no extra peers, uses Web Crypto
  • pomegranate-db/encryption/node -> Node.js only
  • pomegranate-db/encryption/react-native -> React Native / Expo Web Crypto runtime
  • pomegranate-db/op-sqlite -> @op-engineering/op-sqlite
  • pomegranate-db/native-sqlite -> React Native app with the bundled native module

Entry Points

PomegranateDB ships a small set of explicit subpath exports for common setups:

import { Database, LokiAdapter } from 'pomegranate-db'
import { createExpoSQLiteDriver } from 'pomegranate-db/expo'
import { EncryptingAdapter } from 'pomegranate-db/encryption'
import { nodeCryptoProvider } from 'pomegranate-db/encryption/node'
import { createOpSQLiteDriver } from 'pomegranate-db/op-sqlite'
import { createNativeSQLiteDriver } from 'pomegranate-db/native-sqlite'

The root package intentionally excludes encryption exports so Expo Snack can install pomegranate-db without resolving Node's crypto module. Import encryption through the explicit ./encryption, ./encryption/node, or ./encryption/react-native subpaths instead.

Migrations

Manual migrations are supported across Loki and SQLite adapters with these step types:

  • createTable
  • addColumn
  • destroyTable
  • sql

Use sql for targeted backfills such as setting a new column value on existing rows. Schema diff generation is not automated yet, so migration steps are still authored manually.

Next Steps

License

MIT