{"id":16901244,"url":"https://github.com/agree-able/rpc","last_synced_at":"2025-08-01T18:09:48.288Z","repository":{"id":232315693,"uuid":"784023128","full_name":"agree-able/rpc","owner":"agree-able","description":"🤝 Type-safe P2P RPC that just works.","archived":false,"fork":false,"pushed_at":"2024-12-08T01:42:46.000Z","size":27,"stargazers_count":21,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-07-19T07:11:42.446Z","etag":null,"topics":["p2p","rpc"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/agree-able.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-04-09T03:07:15.000Z","updated_at":"2025-03-30T00:52:18.000Z","dependencies_parsed_at":"2024-11-24T22:18:22.877Z","dependency_job_id":"4b8abb5d-ed1e-4032-87be-c357a271281e","html_url":"https://github.com/agree-able/rpc","commit_stats":null,"previous_names":["ryanramage/agreeable-peer"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/agree-able/rpc","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/agree-able%2Frpc","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/agree-able%2Frpc/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/agree-able%2Frpc/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/agree-able%2Frpc/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/agree-able","download_url":"https://codeload.github.com/agree-able/rpc/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/agree-able%2Frpc/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":268272940,"owners_count":24223789,"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-08-01T02:00:08.611Z","response_time":67,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","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":["p2p","rpc"],"created_at":"2024-10-13T17:57:45.796Z","updated_at":"2025-08-01T18:09:48.259Z","avatar_url":"https://github.com/agree-able.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Agreeable RPC\n\n🤝 Type-safe P2P RPC that just works. A [🍐](https://docs.pears.com) project.\n\n## Why Agreeable RPC?\n\n- **Simple API**: Build P2P services with minimal boilerplate\n- **Developer Experience**: Interactive testing UI included\n- **Trust**: Define clear contracts between peers\n- **Type Safety**: Full TypeScript/JSDoc support with runtime validation\n\n## Quick Start\n\n### 1. Install\n\n```bash\nnpm i @agree-able/contract @agreeable/rpc\n```\n\n### 2. Define Your API (agreement.mjs)\n\n```js\nimport { z, addRoute } from '@agree-able/contract'\n\n// Define your functions with Zod\nexport const AddTwo = z.function()\n  .args(z.object({\n    a: z.number(),\n    b: z.number()\n  }))\n  .returns(z.promise(z.number()))\n\n// Create the API contract\nexport default {\n  role: 'calculator',\n  version: '1.0.0',\n  routes: {\n    addTwo: addRoute(AddTwo)\n  }\n}\n```\n\n### 3. Implement the Server (server.mjs)\n\n```js\n// @ts-check\nimport { loadAgreement, host } from '@agree-able/rpc'\nimport { AddTwo } from './agreement.mjs'\n\n/** @type { z.infer\u003cAddTwo\u003e } addTwo */\nconst addTwo = async ({a, b}) =\u003e a + b\n\nhost(await loadAgreement('./agreement.mjs', import.meta.url), { addTwo })\n```\n\n### 4. Create the Client (client.mjs)\n\n```js\n// @ts-check\nimport { Caller } from '@agree-able/rpc'\nimport agreement, { AddTwo } from './agreement.mjs'\n\nconst peerKey = process.argv[2]\nconst caller = new Caller(peerKey)\n/** @type{{ \n *   addTwo: z.infer\u003cAddTwo\u003e \n * }} */\n// @ts-expect-error\nconst { addTwo } = caller.proxy(agreement)\n\n// Call remote functions\nconst result = await addTwo({ a: 1, b: 2 })\nconsole.log(result) // 3\ncaller.destroy()\n```\n\n## Running the Example\n\n1. Start the server:\n```bash\nnode server.mjs\n# Will print a public key like: 3e32bb2d191316d952ae77439f7ec00a5c4fea8a01953b84d1b4eee36173e1ca\n```\n\n2. Run the client with the server's public key:\n```bash\nnode client.mjs 3e32bb2d191316d952ae77439f7ec00a5c4fea8a01953b84d1b4eee36173e1ca\n```\n\n## Interactive Testing\n\nUse our UI tool to explore and test your APIs: [https://github.com/agree-able/ui](https://github.com/agree-able/ui)\n\n## Learn More\n\n- [Full Documentation](https://github.com/agree-able/rpc/tree/master/docs)\n- [Example](https://github.com/agree-able/rpc/tree/master/demo)\n\n## Contributing\n\nWe welcome contributions! See our [contributing guide](CONTRIBUTING.md) for details.\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fagree-able%2Frpc","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fagree-able%2Frpc","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fagree-able%2Frpc/lists"}