MCPcopy
hub / github.com/pubkey/rxdb

github.com/pubkey/rxdb @17.3.0 sqlite

repository ↗ · DeepWiki ↗ · release 17.3.0 ↗
2,251 symbols 8,406 edges 653 files 159 documented · 7%
README

JavaScript Database

A fast, local-first, reactive Database for JavaScript Applications

<a href="https://github.com/pubkey/rxdb/releases"><img src="https://img.shields.io/github/v/release/pubkey/rxdb?color=%23ff00a0&include_prereleases&label=version&sort=semver&style=flat-square"></a>
&nbsp;
<a href="https://rxdb.info/tutorials/typescript.html"><img src="https://img.shields.io/npm/types/rxdb?style=flat-square"></a>
&nbsp;
<a href="https://github.com/pubkey/rxdb/blob/master/LICENSE.txt"><img src="https://img.shields.io/github/license/pubkey/rxdb?style=flat-square"></a>
&nbsp;
<a href="https://github.com/pubkey/rxdb/stargazers"><img src="https://img.shields.io/github/stars/pubkey/rxdb?color=f6f8fa&style=flat-square"></a>
&nbsp;
<a href="https://www.npmjs.com/package/rxdb"><img src="https://img.shields.io/npm/dm/rxdb?color=c63a3b&style=flat-square"></a>







  <a href="https://rxdb.info/chat"><img src="https://img.shields.io/discord/969553741705539624?label=discord&style=flat-square&color=5a66f6"></a>
  &nbsp;
<a href="https://twitter.com/intent/follow?screen_name=rxdbjs"><img src="https://img.shields.io/badge/twitter-%40rxdbjs-1DA1F2?style=flat-square"></a>
  &nbsp;
<a href="https://www.linkedin.com/company/rxdb"><img src="https://img.shields.io/badge/linkedin-%40rxdb-0e76a8?style=flat-square"></a>
&nbsp;
<a href="https://rxdb.info/newsletter"><img src="https://img.shields.io/badge/newsletter-subscribe-e05b29?style=flat-square"></a>

  What is RxDB?

RxDB (short for Reactive Database) is a local-first, NoSQL-database for JavaScript Applications. Reactive means that you can not only query the current state, but subscribe to all state changes like the result of a query or even a single field of a document. This is great for UI-based realtime applications in a way that makes it easy to develop and also has great performance benefits.

Use the quickstart, read the documentation or explore the example projects.

RxDB on Youtube

  Used by many

RxDB is a proven technology used by thousands of developers worldwide. With its flexibility, RxDB is used in a diverse range of apps and services.

(add yours)

  Multiplayer realtime applications

realtime.gif

  Replicate with your existing infrastructure

RxDB provides an easy to implement, battle-tested Sync Engine for realtime replication with your existing infrastructure.

You do not have to use a specific cloud or backend database. The protocol works by implementing three simple HTTP endpoints. There are also production-ready plugins to easily replicate with GraphQL, CouchDB, Websocket, WebRTC (P2P), Supabase, Firestore, NATS or Google Drive.

  Flexible storage layer

RxDB is based on a storage interface that enables you to swap out the underlying storage engine. This increases code reuse because the same database code can be used in different JavaScript environments by just switching out the storage settings.

You can use RxDB on top of LocalStorage, IndexedDB, OPFS, LokiJS, Dexie.js, in-memory, SQLite, in a WebWorker thread and even on top of FoundationDB and DenoKV.

No matter what kind of runtime you have, as long as it runs JavaScript, it can run RxDB:

Browsers Node.js React Native Capacitor NativeScript Flutter or as an Electron Database

All the features that you need

Since its beginning in 2018, RxDB has gained a huge set of features and plugins which makes it a flexible full solution regardless of which type of application you are building. Every feature that you need now or might need in the future is already there.

Logging Attachments ORM Conflict Handling Middleware Signals State Backup Replication Server Storages Local Documents Schema Validation Compression Migration Encryption CRDT Population

  Quick start

Install

npm install rxdb rxjs --save

Store data

import { 
  createRxDatabase
} from 'rxdb/plugins/core';

/**
 * For browsers, we use the localstorage based storage.
 * In other JavaScript runtimes, we can use different storages:
 * @link https://rxdb.info/rx-storage.html
 */
import { getRxStorageLocalstorage } from 'rxdb/plugins/storage-localstorage';

// create a database
const db = await createRxDatabase({
    name: 'heroesdb', // the name of the database
    storage: getRxStorageLocalstorage()
});

// add collections with a schema
await db.addCollections({
  heroes: {
    schema: {
      version: 0,
      primaryKey: 'name',
      type: 'object',
      properties: {
        name: {
          type: 'string',
          maxLength: 100
        },
        healthpoints: {
          type: 'number'
        }
      },
      required: ['name', 'healthpoints']
    }
  }
});

// insert a document
await db.heroes.insert({
  name: 'Bob',
  healthpoints: 100
});

Query data once

const aliveHeroes = await db.heroes.find({
  selector: {
    healthpoints: {
      $gt: 0
    }
  }
}).exec(); // the exec() returns the result once

Observe a Query

await db.heroes.find({
  selector: {
    healthpoints: {
      $gt: 0
    }
  }
})
.$ // the $ returns an observable that emits each time the result set of the query changes
.subscribe(aliveHeroes => console.dir(aliveHeroes));

  Get started

Get started now by reading the docs or exploring the example-projects.

  Support and Contribute

More content

Angular Database, Frontend Database, localStorage, React Database, Browser Database, React Native Database, PWA Database, In-memory NoSQL database, JSON database, Angular IndexedDB, React IndexedDB, Optimistic UI, local database, React Native Encryption, Vue Database, jQuery Database, Vue IndexedDB, Firestore Alternative, Firebase Realtime Database Alternative, Ionic Storage


View llms.txt

Extension points exported contracts — how you extend this code

CouchChangesOnChangeEvent (Interface)
(no doc) [6 implementers]
src/types/couchdb.d.ts
SetReactivityLambda (Interface)
* Define a ReactivityLambda that maps T to Set . * This demonstrates the HKT pattern for custom reactivit
test/typings.test.ts
SideTabItem (Interface)
(no doc)
docs-src/src/components/tabs.tsx
GraphqlServer (Interface)
(no doc)
test/helper/graphql-server.ts
UpsertOptions (Interface)
(no doc)
src/rx-collection.ts
SimpleHumanDocumentType (Interface)
(no doc)
src/plugins/test-utils/schema-objects.ts
RxHeroDocumentType (Interface)
(no doc)
examples/vue/src/RxDB.d.ts
RxStorage (Interface)
(no doc) [6 implementers]
src/types/rx-storage.interface.d.ts

Core symbols most depended-on inside this repo

close
called by 1128
test/helper/graphql-server.ts
randomToken
called by 853
src/plugins/utils/utils-string.ts
exec
called by 743
src/rx-query.ts
insert
called by 472
src/rx-collection.ts
find
called by 445
src/rx-collection.ts
findOne
called by 424
src/rx-collection.ts
addCollections
called by 384
src/rx-database.ts
all
called by 338
src/plugins/storage-sqlite/sqlite-storage-instance.ts

Shape

Function 1,614
Method 432
Class 125
Interface 80

Languages

TypeScript100%
Java1%

Modules by API surface

src/plugins/test-utils/schema-objects.ts49 symbols
src/rx-collection.ts43 symbols
src/rx-query.ts37 symbols
src/rx-document.ts37 symbols
src/rx-database.ts36 symbols
src/rx-storage-helper.ts29 symbols
src/types/rx-document.d.ts27 symbols
src/plugins/query-builder/mquery/nosql-query-builder.ts23 symbols
src/plugins/local-documents/rx-local-document.ts23 symbols
src/plugins/storage-remote/rx-storage-remote.ts22 symbols
src/plugins/storage-localstorage/rx-storage-instance-localstorage.ts22 symbols
src/plugins/pipeline/flagged-functions.ts22 symbols

Dependencies from manifests, versioned

@angular-devkit/build-angular21.2.12 · 1×
@angular/animations21.2.14 · 1×
@angular/build21.2.12 · 1×
@angular/cdk21.2.12 · 1×
@angular/cli21.2.12 · 1×
@angular/common21.2.14 · 1×
@angular/compiler21.2.14 · 1×
@angular/compiler-cli21.2.14 · 1×
@angular/core21.2.14 · 1×
@angular/forms21.2.14 · 1×
@angular/http7.2.12 · 1×
@angular/language-service21.2.14 · 1×

Datastores touched

(mongodb)Database · 1 repos
(mysql)Database · 1 repos

For agents

$ claude mcp add rxdb \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact