{"id":18552420,"url":"https://github.com/andrejewski/storeo","last_synced_at":"2025-04-09T22:31:52.926Z","repository":{"id":57371329,"uuid":"141674145","full_name":"andrejewski/storeo","owner":"andrejewski","description":"A data store with subscriptions","archived":false,"fork":false,"pushed_at":"2018-07-20T06:53:59.000Z","size":4,"stargazers_count":6,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-05T00:02:40.388Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","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/andrejewski.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-07-20T06:44:25.000Z","updated_at":"2019-04-25T15:27:54.000Z","dependencies_parsed_at":"2022-09-26T16:41:16.114Z","dependency_job_id":null,"html_url":"https://github.com/andrejewski/storeo","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andrejewski%2Fstoreo","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andrejewski%2Fstoreo/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andrejewski%2Fstoreo/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andrejewski%2Fstoreo/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/andrejewski","download_url":"https://codeload.github.com/andrejewski/storeo/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248123734,"owners_count":21051521,"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":[],"created_at":"2024-11-06T21:14:10.057Z","updated_at":"2025-04-09T22:31:52.594Z","avatar_url":"https://github.com/andrejewski.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Storeo\n\u003e A data store with subscriptions\n\n[![npm](https://img.shields.io/npm/v/storeo.svg)](https://www.npmjs.com/package/storeo)\n\nThe data store manages \"entities\" (values, objects).\nEntities can be added, removed, and updated.\nQueries can be performed on the store using predicates (filters).\nSubscriptions are notified as entities matching their predicates change.\n\n## Purpose\n\nStoreo was designed to be an in-memory store for client-side applications.\nIt can serve as both a caching layer and reconciler for data change.\n\nStoring the results of HTTP requests, we can save on future similar requests.\nUpdating the store with real-time events, we can live-update subscriptions.\nUpdating the store with user changes, we can synchronize views.\n\nStoreo also works on Node.\n\n## Example\n\n```js\nimport { createStore } from 'storeo'\n\nconst store = createStore({\n  // return a unique identifier for an \"entity\"\n  // key is toString'd for indexing\n  getEntityKey: entity =\u003e entity.id,\n\n  // update the stored entity based on new information\n  // could be a full replacement or some kind of merge\n  updateEntity: (currentEntity, incomingEntity) =\u003e incomingEntity\n})\n\nstore.add([\n  { id: 1, name: 'Cake' },\n  { id: 2, name: 'Ham' }\n])\n\n// one-shot queries\nconst entities = store.query(entity =\u003e true) // return all\n\n// live updating queries\nconst cancelSubscription = store.subscribe({\n  predicate: entity =\u003e entity.name.startsWith('C'),\n  callback (entities) {\n    /*\n    called with all matching entities when\n      - the subscription is created\n      - entries matched the predicate are added/removed/updated\n    */\n  }\n})\n\n// remove entities\nstore.remove([{ id: 1 }])\n\n// stop receiving updates\ncancelSubscription()\n```\n\n## The name\n\nStoreo has the word \"store\" in it.\nStoreo stores entities.\n\nStoreo is one letter away from \"stereo.\"\nStereos broadcast music to listeners, kind of like subscriptions.\n\nStoreo contains the word \"oreo.\"\nStoreo was designed as a reconciler between client/server data.\nThe client and server are the cookie, Storeo is the filling.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fandrejewski%2Fstoreo","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fandrejewski%2Fstoreo","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fandrejewski%2Fstoreo/lists"}