{"id":13780344,"url":"https://github.com/lwhiteley/feathers-lowdb","last_synced_at":"2025-04-22T17:22:00.251Z","repository":{"id":40712947,"uuid":"253915762","full_name":"lwhiteley/feathers-lowdb","owner":"lwhiteley","description":"feathersjs service adapter using lowdb","archived":false,"fork":false,"pushed_at":"2023-09-27T05:07:34.000Z","size":353,"stargazers_count":6,"open_issues_count":5,"forks_count":1,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-04-22T17:21:53.234Z","etag":null,"topics":["feathers-service","feathers-service-adapter","feathersjs","feathersjs-adapter","lowdb"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/lwhiteley.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":".github/contributing.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2020-04-07T21:26:11.000Z","updated_at":"2023-04-30T15:41:03.000Z","dependencies_parsed_at":"2024-01-17T00:55:15.476Z","dependency_job_id":"1f45eb19-8711-4a38-b2f0-169951b48c7c","html_url":"https://github.com/lwhiteley/feathers-lowdb","commit_stats":{"total_commits":44,"total_committers":4,"mean_commits":11.0,"dds":0.4772727272727273,"last_synced_commit":"aba0d221bdd1615c3441fd8448733ee07b924980"},"previous_names":[],"tags_count":16,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lwhiteley%2Ffeathers-lowdb","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lwhiteley%2Ffeathers-lowdb/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lwhiteley%2Ffeathers-lowdb/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lwhiteley%2Ffeathers-lowdb/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lwhiteley","download_url":"https://codeload.github.com/lwhiteley/feathers-lowdb/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250285772,"owners_count":21405305,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["feathers-service","feathers-service-adapter","feathersjs","feathersjs-adapter","lowdb"],"created_at":"2024-08-03T18:01:14.731Z","updated_at":"2025-04-22T17:22:00.224Z","avatar_url":"https://github.com/lwhiteley.png","language":"TypeScript","funding_links":[],"categories":["Plugins"],"sub_categories":["Database"],"readme":"# feathers-lowdb\n\n[![NPM version][npm-image]][npm-url]\n[![Downloads][downloads-image]][downloads-url]\n[![Test Runner](https://github.com/lwhiteley/feathers-lowdb/actions/workflows/Node18.yml/badge.svg)](https://github.com/lwhiteley/feathers-lowdb/actions/workflows/Node18.yml)\n\n[feathers-lowdb][repo-url] is a FeathersJS database adapter for [Lowdb][lowdb-repo], a small JSON and YAML database for Node, and the browser. LowDB can store data in-memory or on the filesystem which makes it useful as a persistent storage without a separate database server.\n\n```bash\n$ npm i feathers-lowdb\n```\n\n## Try it Online \n\n\n- [Quick Start with Browser client](https://stackblitz.com/fork/lowdb-qs-browser)\n- [Quick Start API Server](https://stackblitz.com/fork/lowdb-qs-api)\n- [Quick Start First App](https://stackblitz.com/fork/lowdb-qs-first-app)\n\nAdvanced\n\n- [Contributors Replit](https://replit.com/@fossprime/feathers-lowdb)\n- [Bypass hooks for semi-direct DB access](https://stackblitz.com/edit/feathers-v5-database-hookless?file=app.ts%3AL67)\n- [Swap Model via hooks or params](https://stackblitz.com/edit/feathers-v5-adapter-swapping?file=app.ts)\n\n## LowDB benefits over NeDB, SQLite and others \n\n- No External Dependencies 🫧: LowDB is a self-contained JavaScript library, whereas NeDB and SQLite require external dependencies. This makes LowDB more convenient to use, as you don't need to manage additional installations or dependencies.\n\n- Flexibility🤸‍♀️: LowDB operates directly on JSON files, allowing you to easily manipulate and access the data using standard JavaScript objects and arrays. This flexibility can be advantageous for certain use cases, such as simple data storage or prototyping.\n\n- Portability ✈️: Since LowDB is based on JSON files, it can be easily shared and moved between different platforms or systems. This makes it suitable for scenarios where data needs to be transferred or accessed across multiple environments.\n\n- Great DX 🧑‍💻: The output is aesthetically pleasing by default, making it easier for humans to read without additional tools.\n\n- Popular 💅: It is widely used, ensuring good maintenance and a large community.\n\n- Modular ☸️: It utilizes ES Modules, making it as lightweight as possible by default, which is great for frontends.\n\n- Predictable 🔮: Document updates are actually saved instead of being copied as new versions at the bottom of the file, making debugging of userland code easier.\n\n- Testable 🐑: It is suitable for testing, as the output is more predictable and less cryptic. You can load snapshots, make changes, and expect the output file to be perfectly matched.\n\n- Lean design 🐦: Indexes can be saved outside of the database or as a separate collection, rather than being appended as a strange line in your collection.\n\n## API\n\n### `yaml([options])`\n\nReturns a new database instance initialized with the given options.\n\n```js\nimport { LowDBService } from 'feathers-lowdb'\n\nexport const createModel = (app: Application) =\u003e {\n  return new LowDBService({\n    filename: 'users.yaml', // or users.json\n    id: '_id', // todo: https://github.com/feathersjs/feathers/issues/2839\n    startId: 1,\n    paginate: {\n      default: 2,\n      max: 4\n    }\n  })\n}\n```\n\n**Options:**\n\n- `filename` (_optional, default `/tmp/low-123-321.yaml`) - The full path to the file\n- `id` (_optional_, default: `'id'`) - The name of the id field property.\n- `startId` (_optional_, default: `0`) - An id number to start with that will be incremented for every new record (unless it is already set).\n- `store` (_optional_) - An object with id to item assignments to pre-initialize the data store\n- `events` (_optional_) - A list of [custom service events](https://docs.feathersjs.com/api/events.html#custom-events) sent by this service\n- `paginate` (_optional_) - A [pagination object](https://docs.feathersjs.com/api/databases/common.html#pagination) containing a `default` and `max` page size\n- `whitelist` (_DEPRECATED_) - renamed to `allow`\n- `allow` (_optional_) - A list of additional query parameters to allow\n- `multi` (_optional_) - Allow `create` with arrays and `update` and `remove` with `id` `null` to change multiple items. Can be `true` for all methods or an array of allowed methods (e.g. `[ 'remove', 'create' ]`)\n\n## Example\n\nHere is an example of a Feathers server with a `messages` LowDB service that supports pagination and persists to `messages.yaml`:\n\n```\n$ npm i @feathersjs/feathers @feathersjs/koa @feathersjs/socketio feathers-lowdb@alpha\n```\n\nIn `app.js`:\n\n```js\nimport { feathers } from '@feathersjs/feathers'\nimport {\n  koa,\n  rest,\n  bodyParser,\n  errorHandler,\n  serveStatic,\n} from '@feathersjs/koa'\nimport socketio from '@feathersjs/socketio'\nimport { LowDBService } from 'feathers-lowdb'\n\n// Creates an ExpressJS compatible Feathers application\nconst app = koa(feathers())\n\n// Use the current folder for static file hosting\napp.use(serveStatic('.'))\n// Register the error handle\napp.use(errorHandler())\n// Parse JSON request bodies\napp.use(bodyParser())\n\n// Register REST service handler\napp.configure(rest())\n// Configure Socket.io real-time APIs\napp.configure(socketio())\n// Register our messages service\napp.use(\n  '/messages',\n  new LowDBService({\n    filename: 'messages.yaml', // or messages.json\n    id: '_id', // todo: https://github.com/feathersjs/feathers/issues/2839\n    startId: 1,\n    paginate: {\n      default: 2,\n      max: 4\n    }\n  })\n);\n\n// Create a dummy Message\napp\n  .service('messages')\n  .create({\n    text: 'Message created on server',\n  })\n  .then((message) =\u003e console.log('Created message', message))\n\n\napp.listen(3030, () =\u003e {\n  console.log(`Feathers server listening`)\n})\n```\n\nRun the example with `node app` and go to [localhost:3030/messages](http://localhost:3030/messages).\n\nTry this example online: https://stackblitz.com/fork/lowdb-qs-first-app\n\n## License\n\nCopyright (c) 2023\n\nLicensed under the [MIT license](LICENSE).\n\n[npm-image]: https://img.shields.io/npm/v/feathers-lowdb.svg?style=flat-square\n[npm-url]: https://npmjs.org/package/feathers-lowdb\n[downloads-image]: http://img.shields.io/npm/dm/feathers-lowdb.svg?style=flat-square\n[downloads-url]: https://npmjs.org/package/feathers-lowdb\n[build-image]: https://github.com/lwhiteley/feathers-lowdb/workflows/test-lib/badge.svg\n[repo-url]: https://github.com/lwhiteley/feathers-lowdb\n[lowdb-repo]: https://github.com/typicode/lowdb\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flwhiteley%2Ffeathers-lowdb","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flwhiteley%2Ffeathers-lowdb","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flwhiteley%2Ffeathers-lowdb/lists"}