{"id":22473124,"url":"https://github.com/bas080/furver","last_synced_at":"2025-03-27T16:26:13.903Z","repository":{"id":175399305,"uuid":"651253610","full_name":"bas080/furver","owner":"bas080","description":"Convert any node module into a programmable, parallelized and bulk HTTP JSON API. ","archived":false,"fork":false,"pushed_at":"2023-09-14T00:12:44.000Z","size":488,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-03-15T11:04:54.693Z","etag":null,"topics":["bulk-api","cli","javascript","json","json-api","lisp-language","node","nodejs","rpc","rpc-client","rpc-server"],"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/bas080.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE.txt","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":"2023-06-08T21:09:00.000Z","updated_at":"2023-07-08T21:27:52.000Z","dependencies_parsed_at":"2024-12-06T12:29:30.905Z","dependency_job_id":null,"html_url":"https://github.com/bas080/furver","commit_stats":null,"previous_names":["bas080/furver"],"tags_count":34,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bas080%2Ffurver","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bas080%2Ffurver/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bas080%2Ffurver/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bas080%2Ffurver/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bas080","download_url":"https://codeload.github.com/bas080/furver/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245880965,"owners_count":20687644,"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":["bulk-api","cli","javascript","json","json-api","lisp-language","node","nodejs","rpc","rpc-client","rpc-server"],"created_at":"2024-12-06T12:19:12.958Z","updated_at":"2025-03-27T16:26:13.874Z","avatar_url":"https://github.com/bas080.png","language":"JavaScript","readme":"# Furver\n\n[DEPRECATED: I HAVE STARTED A NEW PROJECT NAMED SendScript. It is a much\nsimpler package with a more expressive dsl for client usage.][sendscript]\n\nFurver is a minimal RPC solution that uses JSON and Node.js. Turn any\nJavaScript module into a simple to use client API that is easy to learn\nwhile also expressive enough for advanced use-cases.\n\n[![NPM](https://img.shields.io/npm/v/furver?color=blue\u0026style=flat-square)](https://www.npmjs.com/package/furver)\n[![NPM Downloads](https://img.shields.io/npm/dm/furver?style=flat-square)](https://www.npmjs.com/package/furver)\n[![Standard Code Style](https://img.shields.io/badge/code_style-standard-brightgreen.svg?style=flat-square)](https://standardjs.com)\n[![License](https://img.shields.io/npm/l/furver?color=brightgreen\u0026style=flat-square)](./LICENSE)\n\n\u003cdetails\u003e\u003csummary\u003eTable of Contents\u003c/summary\u003e\n\n\u003c!-- toc --\u003e\n\n- [Features](#features)\n- [Getting Started](#getting-started)\n  * [Installation](#installation)\n  * [Define a module](#define-a-module)\n  * [Start the server](#start-the-server)\n  * [Request using curl](#request-using-curl)\n  * [Request using the furver client](#request-using-the-furver-client)\n- [Server](#server)\n- [Client](#client)\n  * [Use in your code](#use-in-your-code)\n  * [Client REPL](#client-repl)\n  * [Browser](#browser)\n- [Lisp](#lisp)\n- [CLI](#cli)\n- [Changelog](#changelog)\n- [Contributing](#contributing)\n- [License](#license)\n\n\u003c!-- tocstop --\u003e\n\n\u003c/details\u003e\n\n## Features\n\n- Low code.\n- Makes it easy to quickly iterate.\n- Supports bulk requests with an intuitive client js API.\n- Parallel operations out of the box.\n- Covers both simple and complicated use-cases.\n\n## Getting Started\n\nCovers the basic use case of defining a module, starting a server and\nperforming requests with and without the client.\n\n### Installation\n\n```bash\nnpm install furver -g\n```\n\n### Define a module\n\n```javascript\n// ./example/getting-started.mjs\n\nconst items = []\n\nexport default {\n  push (x) {\n    return items.push(x)\n  },\n  items () {\n    return items\n  },\n  ping () {\n    return 'pong'\n  }\n}\n```\n\n### Start the server\n\nPort 5000 for the following examples.\n\n```bash\nfurver server ./example/getting-started.mjs --port 5000\n```\n\nNow for the http clients.\n\n### Request using curl\n\n```bash\ncurl http://localhost:5000 -d '[\"ping\"]'\n```\n```\n\"pong\"\n```\n\nLet's add some numbers to our `items` array.\n\n```bash\ncurl http://localhost:5000 -d '[\"array\", [\"push\", 1], [\"push\", 2], [\"push\", 3], [\"items\"]]'\n```\n```\n[1,2,3,[1,2,3]]\n```\n\nAlso support requests with `GET` method:\n\n```bash\ncurl -G \"http://localhost:$PORT\" --data-urlencode body='[\"inc\", 42]'\n```\n```\n43\n```\n\n\u003e We use the `-G` and `--data-urlencode` to perform a GET request with properly\n\u003e encoded JSON in the body query param.\n\n### Request using the furver client\n\nNow let's use the furver client module and `api.push` some letters.\n\n```javascript\nimport client from './client.mjs'\n\nconst api = await client({\n  endpoint: 'http://localhost:5000'\n})\n\nconsole.log(await Promise.all([\n\n  api.push('a'),\n  api.call(['push', 'b']),\n  api.call([['ref', 'push'], 'c']),\n  api.call([api.push, 'd'])\n\n]))\n\nconsole.log(await api.items())\n```\n```\n[ 4, 5, 6, 7 ]\n[\n  1,   2,   3,   'a',\n  'b', 'c', 'd'\n]\n```\n\nThese are all equivalent ways of calling the push function in the server\nmodule. Read more about the [client](./client.md) and [lisp](./lisp.md) if you\nwant to learn more.\n\n## Server\n\nYou can start a server by pointing to a module. This can be a npm package or\nanother file on the filesystem.\n\n```bash\nnpm install ramda # A utility library.\nnpx furver server --port 3000 ramda ./example/api.mjs\n```\n\nDefining multiple modules will result in the modules being merged into a single\nAPI. The function of the most right module will take precedence when the\nmodules have conflicting function names.\n\nYou can now perform requests using a furver client.\n\n[Read more about the Furver server.](./server.md)\n\n## Client\n\nNow that we have a server running we can use the client to perform requests\nusing either the client functions or a simple JSON Lisp.\n\nHere an working example of the JavaScript client.\n\n### Use in your code\n\n```javascript\n(async function() {\n  const { default: FurverClient } = await import('./client.mjs')\n\n  // Fetches the schema and installs the schema methods on the api.\n  const api = await FurverClient({endpoint: `http://localhost:${process.env.PORT}`})\n\n  // These function calls result in a single request that is run in parallel on\n  // the server.\n  console.log(await Promise.all([\n    api.identity('hello world'),\n    api.timestamp(),\n    api.version()\n  ]))\n\n  // We can write the same query using the JSON Lisp\n  console.log(await api.call(['array', ['identity', 'hello world'], ['timestamp'], ['version']]))\n\n  // Those are many quotes, we can reduce it by using the function reference.\n  const { identity, timestamp, version, array } = api\n  console.log(await api.call([array, [identity, 'hello world'], [timestamp], [version]]))\n})()\n```\n```javascript\n[ 'hello world', 1694650272974, '1.2.1' ]\n[ 'hello world', 1694650272979, '1.2.1' ]\n[ 'hello world', 1694650272982, '1.2.1' ]\n```\n\nAll three ways are equivalent and valid ways of writing a furver Lisp program\nthat is run server-side.\n\nThis client is compatible with the browser and Node.js.\n\n### Client REPL\n\nYou can also start talking with a Furver server using the cli.\n\n```bash\nfurver repl --url http://localhost:3000\n```\n\nThis will start a prompt that takes valid JavaScript or a Lisp expression.\n\n```bash\n\u003e identity('hello')\n\"hello\"\n\u003e ['identity', 'world']\n\"world\"\n\u003e [identity, 'goodbye']\n\"goodbye\"\n```\n\n### Browser\n\nBy default the server hosts a browser friendly bundled version of the client at\n`/client.min.js`. This script registers the `furver` global variable.\n\nYou can try this client in the playground by starting a furver server and\nopening `http://localhost:3000/playground` in your browser.\n\n[Read more about the client.](./client.md)\n\n## Lisp\n\nFurver's Lisp-like language allows developers to perform complex aggregations\nand operations in a single request. It builds ontop of JSON by using arrays for\nits s-expressions.\n\n[Read more about the furver lisp.](./lisp.md)\n\n## CLI\n\nThe goal of Furver's cli is to provide you with all the tools to use, test and\ndebug Furver servers.\n\n```bash\nfurver --help\n```\n```\nfurver \u003ccommand\u003e\n\nCommands:\n  furver server \u003cmodules..\u003e  start server\n  furver repl [modules..]    start a local server or client repl\n  furver client              start client repl. Use repl --url instead\n                                                                    [deprecated]\n  furver schema [modules..]  print schema of api\n\nOptions:\n      --help     Show help                                             [boolean]\n      --version  Show version number                                   [boolean]\n      --url                                                             [string]\n      --modules  Name or path to modules                                 [array]\n  -v, --verbose                                                        [boolean]\n  -p, --port                                          [number] [default: \"8999\"]\n```\n\n[Read more about the Furver CLI.](./cli.md)\n\n## Changelog\n\nSee the [CHANGELOG.md](./CHANGELOG.md) for a list of changes over time.\n\n## Contributing\n\nWant to contribute? The [CONTRIBUTING.md](./CONTRIBUTING.md) might help you get\nstarted quicker.\n\n## License\n\nSee the [LICENSE.txt](./LICENSE.txt) file for details.\n\n[sendscript]:https://github.com/bas080/sendscript\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbas080%2Ffurver","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbas080%2Ffurver","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbas080%2Ffurver/lists"}