pouchdb-users is a PouchDB plugin designed to simulate the behavior of CouchDB's `_users` database. It handles password hashing (using PBKDF2) and ensures user document formats adhere to CouchDB's specifications. This allows developers to use any PouchDB adapter, including in-memory or LevelDB-based local storage, for persisting user accounts, thereby decoupling user management from a live CouchDB instance for basic operations. The current stable version is 1.0.6, released in June 2017. The package has seen no updates since then, indicating it is no longer actively maintained. Its key differentiator is enabling offline-first user account management within PouchDB environments without requiring a constant connection to a CouchDB `_users` database for operations like user creation and retrieval. It explicitly does *not* implement access control, focusing solely on document format and password security for user records.
npm install pouchdb-usersVerified import paths — ran on the pinned version, not inferred.
Demonstrates how to install the pouchdb-users plugin and create a new user document, showing how the password gets hashed and stored in a CouchDB-compatible format within a local PouchDB instance.
Always build your own access control layer or use a separate authentication/authorization system alongside `pouchdb-users`.
Consider migrating to more actively maintained PouchDB authentication solutions or developing custom logic for user management if long-term support is critical. Evaluate the risks of using unmaintained software carefully.
Ensure your project's module resolution for PouchDB and its plugins is configured for CommonJS, or use older Node.js versions if encountering module loading issues. Consider using a bundler like Webpack or Rollup to handle compatibility.
Ensure `const PouchDB = require('pouchdb')` is called before attempting to install the plugin, and that `PouchDB.plugin()` is used, not `db.plugin()`.Verify that `PouchDB.plugin(require('pouchdb-users'))` is called prior to `new PouchDB()` or `db = new PouchDB()`.When updating an existing user, retrieve the document first to get its `_rev`, then include `_rev` in the updated document. Alternatively, handle the conflict in your `catch` block.