Registry / database / pouchdb-adapter-capacitor-sqlite

pouchdb-adapter-capacitor-sqlite

JSON →
library1.1.2jsnpmunverified

A PouchDB adapter plugin that uses @capacitor-community/sqlite as its data store, enabling local-first, offline-capable apps built with Capacitor. Version 1.1.2 is current; it requires @capacitor-community/sqlite ^7.0.0 and ships TypeScript types. Key differentiator: bridges PouchDB's localStorage/CouchDB replication patterns with Capacitor's native SQLite for mobile, without needing WebSQL or IndexedDB. Provides a familiar PouchDB API for Capacitor apps targeting iOS and Android, with full replication support.

npm install pouchdb-adapter-capacitor-sqlite
INSTALL
IMPORT
SIG · POUCHDB-ADAPTER-CA
P
pouchdb-adapter-capacitor-sqlite
databasejavascriptv1.1.2
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

PouchAdapterCapacitorSqlite
import PouchAdapterCapacitorSqlite from 'pouchdb-adapter-capacitor-sqlite'
import { PouchAdapterCapacitorSqlite } from 'pouchdb-adapter-capacitor-sqlite'
Default export is the class; not a named export.
getAdapter
import { getAdapter } from 'pouchdb-adapter-capacitor-sqlite'
import getAdapter from 'pouchdb-adapter-capacitor-sqlite'
getAdapter is a named export; requires destructured import.
PouchDB
import PouchDB from 'pouchdb-browser'
import PouchDB from 'pouchdb-adapter-capacitor-sqlite'
PouchDB core must be installed separately; this adapter is a plugin.

Shows how to register the adapter with PouchDB and create a database using the Capacitor SQLite adapter.

import PouchDB from 'pouchdb-browser'; import PouchAdapterCapacitorSqlite from 'pouchdb-adapter-capacitor-sqlite'; import { Capacitor } from '@capacitor/core'; import { SQLite } from '@capacitor-community/sqlite'; PouchDB.plugin(PouchAdapterCapacitorSqlite); async function init() { await SQLite.init(); const db = new PouchDB('my-database', { adapter: 'capacitor-sqlite', iosDatabaseLocation: 'default', androidDatabaseLocation: 'default' }); await db.put({ _id: 'test', name: 'Hello' }); const doc = await db.get('test'); console.log(doc); } init().catch(console.error);
Debug
Known issues
breakingRequires @capacitor-community/sqlite ^7.0.0 which may have breaking changes from v6.
fix
Install @capacitor-community/sqlite@^7.0.0 and follow its migration guide.
affects: >=1.0.0
gotchaDatabase location configuration differs between iOS and Android. iOS uses 'default' or a shared container path; Android uses 'default' or absolute path.
fix
Set iosDatabaseLocation and androidDatabaseLocation explicitly in PouchDB options.
affects: >=1.0.0
deprecatedUsing 'pouchdb' (Node.js) instead of 'pouchdb-browser' may cause issues on mobile because of Buffer dependencies.
fix
Use 'pouchdb-browser' in Capacitor apps.
affects: >=1.0.0
gotchaAdapter name in PouchDB must be exactly 'capacitor-sqlite'.
fix
Pass adapter: 'capacitor-sqlite' in PouchDB constructor options.
affects: >=1.0.0
Errors
Common errors & fixes
Error: adapter 'capacitor-sqlite' is not registered
PouchDB.plugin() not called before creating the database.
fix
Call PouchDB.plugin(PouchAdapterCapacitorSqlite) before new PouchDB().
TypeError: Cannot read properties of undefined (reading 'plugin')
PouchDB is not installed or imported incorrectly.
fix
Install pouchdb-browser and import PouchDB from 'pouchdb-browser'.
Capacitor SQLite plugin not initialized
Capacitor SQLite native plugin not initialized before use.
fix
Call await SQLite.init() before creating the PouchDB instance.
Upgrade
Version history
1.1.2latest on npm
Audit
Dependencies
@capacitor-community/sqliterequiredpeer dependency for native SQLite operations on Capacitor
Agent activity
7 hits · last 30 days
node
6
Resources
pouchdb-adapter-capacitor-sqlite — npm install pouchdb-adapter-capacitor-sqlite · libregistry