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

@couchbase/lite-js

v1.0.0

Published

This is the JavaScript (really TypeScript) implementation of Couchbase Lite.

Readme

Couchbase Lite for JavaScript

This is the JavaScript (really TypeScript) implementation of Couchbase Lite.

It's intended for use in web browsers, or in JavaScript-based app frameworks like React Native.

Server and CLI environments like Node.js, Deno and Bun are not officially supported, because they lack a proper implementation of the IndexedDB API. You can use CBL-JS in those environments with the help of the fake-indexeddb package, but it's not very useful because databases are not persisted to disk.

This ReadMe last updated Oct 29 2025.

1. Getting Started / Documentation

The wiki has some documents introducing the API, and describing differences from other Couchbase Lite platforms.

For an example of using the API in a web page, see examples/browser.ts. If you want to run that example yourself, see "Kicking The Tires".

Using It In Your Own Projects

Install the package "@couchbase/lite-js".

Until the public release, this isn't in a public package registry, so you'll need to do a bit more:

  1. Start Couchbase's GlobalProtect VPN
  2. Run bun install @couchbase/lite-js --registry https://proget.sc.couchbase.com/npm/cbl-npm/ (or npm install if you swing that way.)

You'll need to use that same --registry flag when updating the package, too.

2. Source Code

Code is in the src directory. The public API is declared in src/couchbase-lite.ts, which just re-exports public symbols.

Subdirectories are:

  • blip: The BLIP RPC protocol, used by the replicator
  • blob: Blob/attachment classes and support code
  • database: Database, Collection and document implementation
  • query: Query implementation
  • replicator: Replicator implementation (but not its public API)
  • util: Internal utilities

Integration Tests aka the TDK

Integration & system tests of all Couchbase Lite platforms are performed by the Test Development Kit (TDK). The glue code that integrates CBL-JS is in the servers/javascript directory.

3. Building It Yourself

Dependencies

For development you'll need to install either Bun, or node.js and npm. These directions assume bun; if you use node+npm, substitute npm for bun in command lines.

Package dependencies (will be installed by Bun):

  • General:
  • BLIP RPC:
  • Database:
    • dexie -- High-level wrapper for IndexedDB.
    • fake-indexeddb -- In-memory IndexedDB implementation (not needed in browsers)
    • sha.js -- SHA-1 digests (used instead of JS crypto because it's synchronous.)
    • buffer -- Required to use sha.js in a browser.
  • Query:
    • ohm-js -- Parser library, used for N1QL/SQL++.
    • date-fns -- For the N1QL date/time functions
    • regexp.escape -- Escapes regular expression strings. Used in implementation of LIKE.

Building

To compile the TypeScript code in ./src into minified JavaScript files in ./dist:

  1. bun install (first time only)
  2. bun run build

Running Tests

You can run the tests in a Bun or node.js environment with either bun test or bun run test. The former uses Bun's built-in test runner, the latter uses vitest.

To run the tests in real browsers, run bun run test:browser.

By default, the tests in src/query/N1QLTestSuite.test.ts will be skipped because they require about 24MB of test data from the Server N1QL test suite repo. To enable those tests in Bun/node, follow the directions in the file. (These tests cannot be run in a browser because they access the filesystem.)

4. Running The Examples

…in a web browser

See the wiki page "Kicking the Tires".

…from the command line

We have a test of replication in a server environment (Bun or node.js). Since IndexedDB is not available, it uses the "fake-indexeddb" package; this database is ephemeral, since it's only for testing purposes.

To run, first read the instructions at the top of examples/sync_collections_node.ts and set up your server (Sync Gateway or Edge Server).

Then run bun run examples/sync_collections_node.ts