node package manager


rx-pouchdb Join the chat at

NPM build status Coverage Status Dependency Status

thin RXJS abstraction layer for pouchDB with read and write RXJS operators.


a live version of this example can be viewed here in the browser console, or by cloning this repository and running the following commands from a terminal:

npm install
npm run example

the files of this example are available in this repository.

import newRxPouchDb, { DocId, VersionedDoc } from 'rx-pouchdb/dist'
import debug = require('debug')
const PouchDB = require('pouchdb-browser') // no valid type definitions for TS2
debug.enable('example:*,rx-pouchdb:*') // rx-pouchdb uses `debug`
const db = new PouchDB('sids')
const sids = newRxPouchDb(db, {
  read: { include_docs: true }
const docs = [{
  _id: 'hubbard-rob_monty-on-the-run',
  title: 'Monty on the Run',
  author: 'Rob Hubbard',
  release: '1985'
}, [{
  _id: 'hubbard-rob_sanxion',
  title: 'Sanxion',
  author: 'Rob Hubbard',
  release: '1986'
}, {
  _id: 'tel-jeroen_ikari-union',
  title: 'Ikari Union',
  author: 'Jeroen Tel',
  release: '1987'
function getId <D extends VersionedDoc>(doc: D): DocId
function getId <D extends VersionedDoc>(doc: D[]|D) {
  return Array.isArray(doc) ? : <DocId>{ _id: doc._id }
const refs =
// write docs to vault
const write$ = sids.write(docs)
// read docs from vault
const read$ =
// search Rob Hubbard tunes
const search$ =[{
  startkey: 'hubbard-',
  endkey: 'hubbard-\uffff'
.then(() => read$.forEach(debug('example:read:')))
.then(() => search$.forEach(debug('example:search:')))
.then(() => db.destroy())

API v1.0 experimental

ES5 and Typescript compatible. Coded in Typescript 2.

run the unit tests in your browser.


see the contribution guidelines


Copyright 2017 Stéphane M. Catala

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and Limitations under the License.