{"id":15013489,"url":"https://github.com/apendua/ddp-redux","last_synced_at":"2025-10-26T01:03:35.783Z","repository":{"id":78566910,"uuid":"99374254","full_name":"apendua/ddp-redux","owner":"apendua","description":"A set of utilities for building DDP clients in a declarative way","archived":false,"fork":false,"pushed_at":"2018-06-04T13:44:01.000Z","size":681,"stargazers_count":10,"open_issues_count":15,"forks_count":1,"subscribers_count":4,"default_branch":"develop","last_synced_at":"2025-06-26T21:40:39.905Z","etag":null,"topics":["ddp","meteor","react","react-redux","redux"],"latest_commit_sha":null,"homepage":"","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/apendua.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,"governance":null}},"created_at":"2017-08-04T19:35:34.000Z","updated_at":"2023-10-13T22:48:14.000Z","dependencies_parsed_at":"2023-05-06T09:15:23.676Z","dependency_job_id":null,"html_url":"https://github.com/apendua/ddp-redux","commit_stats":{"total_commits":149,"total_committers":1,"mean_commits":149.0,"dds":0.0,"last_synced_commit":"412b4e38de09d398ad7bcc964f920f6fcf907396"},"previous_names":["apendua/ddp"],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/apendua/ddp-redux","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/apendua%2Fddp-redux","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/apendua%2Fddp-redux/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/apendua%2Fddp-redux/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/apendua%2Fddp-redux/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/apendua","download_url":"https://codeload.github.com/apendua/ddp-redux/tar.gz/refs/heads/develop","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/apendua%2Fddp-redux/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":266342809,"owners_count":23914262,"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","status":"online","status_checked_at":"2025-07-21T11:47:31.412Z","response_time":64,"last_error":null,"robots_txt_status":null,"robots_txt_updated_at":null,"robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["ddp","meteor","react","react-redux","redux"],"created_at":"2024-09-24T19:44:21.014Z","updated_at":"2025-10-26T01:03:35.720Z","avatar_url":"https://github.com/apendua.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ddp\n\n[![Build Status][travis-svg]][travis-url]\n\n`ddp-redux` is a brand new ddp client that will allow you to fetch resources from your ddp server\nin a completely declarative way. Subscriptions/ methods (queries) parameters are evaluated by\nselectors and all you need to do is to extract collection data from the redux store.\nThis approach was highly inspired by [apollo-client][apollo-client-url], but the DDP protocol\nis the first class citizen in our case.\n\nAn example is worth a thousand words\n```javascript\nimport ddp from 'ddp-connector';\n\nconst TodoList = ddp({\n  subscriptions: (state, props) =\u003e [{\n    name: 'api.collections.TodoLists.details',\n    params: [{\n      listId: props.listId,\n    }],\n  }, {\n    name: 'api.collections.Todos.all',\n    params: [{\n      listId: props.listId,\n    }],\n  }],\n  selectors: ({ from, prop }) =\u003e ({\n    todoList: from('TodoLists').select.one('listId'),\n    todos: from('Todos').select.where(\n      createSelector(\n        prop('listId'),\n        listId =\u003e todo =\u003e todo.listId === listId,\n      ),\n    ),\n  }),\n})(({ todoList, todos }) =\u003e (\n  \u003cdiv\u003e\n    \u003ch1\u003e{todoList.name}\u003c/h1\u003e\n    \u003cul\u003e\n      {todos.map(todo =\u003e (\u003cli key={todo._id}\u003e{todo.title}\u003c/li\u003e))}\n    \u003c/ul\u003e\n  \u003c/div\u003e\n))\n```\nMost typical DDP \"commands\" are accessible by simply dispatching a redux action, e.g.\n```javascript\nimport { callMethod } from 'ddp-redux';\n\n// ...\n\nstore.dispatch(\n  callMethod(\n    'myTestMethod',\n    param1,\n    param2,\n    param3,\n  ))\n  .then(/* ... */)\n  .catch(/* ... */)\n);\n```\n\n## Disclaimer\n\nThe project is still in a pretty early stage and it does not have proper documentation yet,\nas some parts of the api are very likely to change, e.g. documents selectors.\n\n## Running example app\n\nAssuming yoy have `tmux@2.x` installed you only need to run\n```\ncd example\n./start.sh\n```\nIf you want to play with the code and need to ensure that the libraries\nare rebuilding automatically use\n```\n./start-develop.sh\n```\n\n## Installation\n\n```\nnpm install --save ddp-redux ddp-connector\n```\nIf you don't have them already please install the following peer dependencies\n```\nnpm install --save react redux react-redux\n```\n\n## Minimal configuration\n\n```javascript\nimport { createStore, combineReducers, applyMiddleware } from 'redux';\nimport React from 'react';\nimport ReactDOM from 'react-dom';\nimport { Provider } from 'react-redux';\nimport DDPClient from 'ddp-redux';\n\nconst ddpClient = new DDPClient({\n  endpoint: 'ws://localhost:3000/websocket',\n  SocketConstructor: WebSocket,\n});\n\nconst reducer = combineReducers({\n  ddp: DDPClient.reducer(),\n});\n\nconst store = createStore(\n  reducer,\n  {},\n  applyMiddleware(\n    ddpClient.middleware(),\n  ),\n);\n\nReactDOM.render(\n  \u003cProvider store={store}\u003e\n    // ...\n  \u003c/Provider\u003e\n  document.getElementById('root'),\n);\n```\n\n## Features\n\n- [x] Supports Meteor standard authentication methods\n- [x] Meteor subscriptions\n- [x] Fetch data via meteor methods\n- [x] Aggregate data from multiple ddp connections\n- [x] Basic support for optimistic updates\n- [ ] Sync local ids generator with server\n- [ ] Out-of-the-box support for client-side joins\n- [ ] Offline first\n\n[travis-svg]: https://travis-ci.org/apendua/ddp-redux.svg?branch=develop\n[travis-url]: https://travis-ci.org/apendua/ddp-redux\n[apollo-client-url]: https://github.com/apollographql/apollo-client","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fapendua%2Fddp-redux","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fapendua%2Fddp-redux","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fapendua%2Fddp-redux/lists"}