{"id":17333,"library":"pouchdb-http","title":"PouchDB HTTP-only Adapter","description":"PouchDB-http is a minimalist preset package designed to provide only the HTTP adapter for PouchDB. Its primary function is to allow applications to interact with a CouchDB-compatible server (like Apache CouchDB or Cloudant) without including any local storage adapters or map/reduce capabilities by default. This makes it suitable for scenarios where PouchDB is used purely as an interface to a remote database, reducing bundle size by omitting unnecessary features. The package is at version 6.0.2, which is significantly older than the current PouchDB core (8.x). As a result, its release cadence is effectively non-existent, and it lacks the continuous updates and features found in the main PouchDB project. Its key differentiator is its small footprint and specific focus on HTTP communication, but its age means it likely faces compatibility challenges with modern JavaScript environments and newer PouchDB plugins.","status":"abandoned","version":"6.0.2","language":"javascript","source_language":"en","source_url":"https://github.com/nolanlawson/pouchdb-http","tags":["javascript"],"install":[{"cmd":"npm install pouchdb-http","lang":"bash","label":"npm"},{"cmd":"yarn add pouchdb-http","lang":"bash","label":"yarn"},{"cmd":"pnpm add pouchdb-http","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"This package, at version 6.0.2, primarily uses CommonJS `require`. Direct ES module `import` syntax is not supported for this version and will result in errors.","wrong":"import PouchDB from 'pouchdb-http';","symbol":"PouchDB","correct":"const PouchDB = require('pouchdb-http');"},{"note":"Plugins are added using the `.plugin()` method on the PouchDB constructor. Ensure the plugin itself is also required via CommonJS for compatibility with this older version.","wrong":"import PouchDB from 'pouchdb-http'; PouchDB.plugin(MapReducePlugin);","symbol":"PouchDB.plugin","correct":"const PouchDB = require('pouchdb-http').plugin(require('pouchdb-mapreduce'));"}],"quickstart":{"code":"const PouchDB = require('pouchdb-http');\n\n// Initialize PouchDB with a remote CouchDB URL\nconst db = new PouchDB('http://127.0.0.1:5984/mydb');\n\n// Example: Put a document\ndb.put({\n  _id: 'mydoc',\n  title: 'Hello PouchDB HTTP',\n  date: new Date().toISOString()\n}).then((response) => {\n  console.log('Document created:', response);\n  return db.get('mydoc');\n}).then((doc) => {\n  console.log('Document retrieved:', doc);\n}).catch((err) => {\n  console.error('Error:', err);\n});","lang":"javascript","description":"Demonstrates initializing PouchDB with an HTTP endpoint and performing basic `put` and `get` operations using CommonJS syntax."},"warnings":[{"fix":"Consider migrating to the full `pouchdb` package or a more actively maintained subset if available, and explicitly disable unused adapters if bundle size is a concern.","message":"This package is at version 6.0.2, while the main PouchDB library is significantly more advanced (v8.x). It is considered abandoned and has not received updates since 2017. Using this package means foregoing bug fixes, performance improvements, and security patches present in newer PouchDB versions.","severity":"breaking","affected_versions":">=6.0.2"},{"fix":"For map/reduce, explicitly add `require('pouchdb-mapreduce')` as a plugin. For local storage, use the full `pouchdb` package or an alternative. Always use a full HTTP URL (e.g., `new PouchDB('http://localhost:5984/mydb')`).","message":"pouchdb-http only provides the HTTP adapter. It does not include local storage adapters (like IndexedDB, WebSQL, or LevelDB) or the `query()` API (map/reduce) by default. Attempts to use `PouchDB('mydb')` without an HTTP URL or to call `db.query()` will fail unless specific plugins are added.","severity":"gotcha","affected_versions":">=6.0.2"},{"fix":"Use a compatible Node.js version (e.g., Node.js 14 or older) or ensure your build setup correctly transpiles or handles CommonJS modules in an ESM context. For new projects, avoid this package entirely.","message":"Due to its age, `pouchdb-http` (v6.0.2) is not officially compatible with modern Node.js versions (e.g., Node.js 16+ or ESM-only environments). It relies heavily on CommonJS `require` syntax and may not function correctly without specific transpilation or legacy runtime settings.","severity":"breaking","affected_versions":">=6.0.2"}],"env_vars":null,"last_verified":"2026-04-22T00:00:00.000Z","next_check":"2026-07-21T00:00:00.000Z","problems":[{"fix":"Add the map/reduce plugin: `const PouchDB = require('pouchdb-http').plugin(require('pouchdb-mapreduce'));`","cause":"`pouchdb-http` does not include map/reduce (the `query` API) by default.","error":"TypeError: db.query is not a function"},{"fix":"Always initialize `pouchdb-http` with a full HTTP/HTTPS URL to a CouchDB-compatible server, e.g., `new PouchDB('http://127.0.0.1:5984/mydb')`.","cause":"Attempting to create a local PouchDB instance without a specified HTTP URL, and no local adapter is present.","error":"UnhandledPromiseRejectionWarning: TypeError: Cannot read properties of undefined (reading 'get')"},{"fix":"Use CommonJS `require` syntax: `const PouchDB = require('pouchdb-http');`","cause":"Attempting to import `pouchdb-http` using ES module syntax (e.g., `import { PouchDB } from 'pouchdb-http';`) which is not supported by this CommonJS-only package version.","error":"SyntaxError: Named export 'PouchDB' not found. The requested module 'pouchdb-http' does not provide an export named 'PouchDB'"}],"ecosystem":"npm","meta_description":null}