{"id":22608975,"url":"https://github.com/bitfinexcom/grenache-grape","last_synced_at":"2026-03-13T18:04:07.907Z","repository":{"id":6470372,"uuid":"55168952","full_name":"bitfinexcom/grenache-grape","owner":"bitfinexcom","description":"Grenache Grape implementation","archived":false,"fork":false,"pushed_at":"2023-03-18T08:53:26.000Z","size":360,"stargazers_count":58,"open_issues_count":7,"forks_count":24,"subscribers_count":9,"default_branch":"master","last_synced_at":"2024-12-08T15:10:16.748Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://github.com/bitfinexcom/grenache","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/bitfinexcom.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,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2016-03-31T17:13:59.000Z","updated_at":"2024-10-06T17:30:00.000Z","dependencies_parsed_at":"2024-06-19T00:15:42.103Z","dependency_job_id":"67f03218-656e-4a77-85f7-9645dd38ae6d","html_url":"https://github.com/bitfinexcom/grenache-grape","commit_stats":{"total_commits":236,"total_committers":7,"mean_commits":"33.714285714285715","dds":0.4576271186440678,"last_synced_commit":"7e57b0281e759140bc4624cd672fc3822ff95191"},"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bitfinexcom%2Fgrenache-grape","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bitfinexcom%2Fgrenache-grape/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bitfinexcom%2Fgrenache-grape/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bitfinexcom%2Fgrenache-grape/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bitfinexcom","download_url":"https://codeload.github.com/bitfinexcom/grenache-grape/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":230575851,"owners_count":18247484,"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-12-08T15:10:24.564Z","updated_at":"2026-03-13T18:04:02.857Z","avatar_url":"https://github.com/bitfinexcom.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# [Grenache](https://github.com/bitfinexcom/grenache) Grape implementation\n\n\u003cimg src=\"logo.png\" width=\"15%\" /\u003e\n\nGrenache is a micro-framework for connecting microservices. Its simple and optimized for performance.\n\nInternally, Grenache uses Distributed Hash Tables (DHT, known from Bittorrent) for Peer to Peer connections. You can find more details how Grenche internally works at the [Main Project Homepage](https://github.com/bitfinexcom/grenache).\n\nGrapes are the backbone of Grenache. They manage the DHT, the base of our virtual network.\n\n## Install\n\n```\n// Install global (run binary)\nnpm install -g grenache-grape\n```\n\n```\n// Install locally to project (programmatic approach)\nnpm install --save grenache-grape\n```\n\n## Run in Binary Mode\n\n```\ngrape --help\n\nUsage: grape --dp \u003cdht-port\u003e --aph \u003chttp-api-port\u003e --bn \u003cnodes\u003e [--b\nbind-to-address]\n\nOptions:\n  -b, --bind                 Listening host                             [string]\n  --dp, --dht_port           DHT listening port              [number] [required]\n  --dc, --dht_concurrency    DHT concurrency                            [number]\n  --dht_maxTables            DHT max tables                             [number]\n  --dht_maxValues            DHT max values                             [number]\n  --bn, --bootstrap          Bootstrap nodes                 [string] [required]\n  --aph, --api_port          HTTP api port                   [number] [required]\n  --dht_peer_maxAge, --dpa   Max age for peers in DHT                   [number]\n  --cache_maxAge             Maximum cache age                          [number]\n  --dnl, --dht_nodeLiveness  Interval in ms to check for dead nodes     [number]\n  --check_maxPayloadSize     Limit for max payload size                 [number]\n  --help                     Show help                                 [boolean]\n  --version                  Show version number                       [boolean]\n```\n\n```\n// Run 3 Grapes\ngrape -b 127.0.0.1 --dp 20001 --dc 32 --aph 30001 --bn '127.0.0.1:20002,127.0.0.1:20003'\ngrape --dp 20002 --aph 40001 --dc 32 --bn '127.0.0.1:20001,127.0.0.1:20003'\ngrape --dp 20003 --aph 50001 --dc 32 --bn '127.0.0.1:20001,127.0.0.1:20002'\n```\n\n## Integrate in your Code\n\n```\nconst Grape = require('grenache-grape').Grape\n\nconst g = new Grape({\n  // host: '127.0.0.1', // if undefined the Grape binds all interfaces\n  dht_port: 20001,\n  dht_bootstrap: [\n    '127.0.0.1:20002'\n  ],\n  api_port: 30001\n})\n\ng.start()\n```\n\n## API\n\n### Class: Grape\n\n#### new Grape(options)\n\n - `options` \u0026lt;Object\u0026gt; Options for the link\n    - `host` \u0026lt;String\u0026gt; IP to bind to. If null, Grape binds to all interfaces\n    - `dht_maxTables` \u0026lt;Number\u0026gt; Maximum number of DHT tables\n    - `dht_maxValues` \u0026lt;Number\u0026gt; Maximum number of DHT values\n    - `dht_port` \u0026lt;Number\u0026gt; Port for DHT\n    - `dht_concurrency` \u0026lt;Number\u0026gt; Concurrency for DHT\n    - `dht_bootstrap`: \u0026lt;Array\u0026gt; Bootstrap servers\n    - `dht_peer_maxAge` \u0026lt;Number\u0026gt; maxAge for DHT peers\n    - `api_port` \u0026lt;Number\u0026gt; Grenache API HTTP Port\n\n#### Event: 'ready'\n\nEmitted when the DHT is fully bootstrapped.\n\n#### Event: 'listening'\n\nEmitted when the DHT is listening.\n\n#### Event: 'peer'\n\nEmitted when a potential peer is found.\n\n#### Event: 'node'\n\nEmitted when the DHT finds a new node.\n\n\n#### Event: 'warning'\n\nEmitted when a peer announces itself in order to be stored in the DHT.\n\n\n#### Event: 'announce'\n\nEmitted when a peer announces itself in order to be stored in the DHT.\n\n\n## Implementations\n\n### Node.JS Clients\n* https://github.com/bitfinexcom/grenache-nodejs-ws: WebSocket based Grape microservices\n* https://github.com/bitfinexcom/grenache-nodejs-http: HTTP based Grape microservices\n* https://github.com/bitfinexcom/grenache-nodejs-zmq: ZeroMQ based Grape microservices\n\n\n### Ruby Clients\n* https://github.com/bitfinexcom/grenache-ruby-ws: WebSocket based Grape microservices\n* https://github.com/bitfinexcom/grenache-ruby-http: HTTP based Grape microservices\n\n\n### CLI Clients\n* https://github.com/bitfinexcom/grenache-cli: Command Line Interface for Grape microservices\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbitfinexcom%2Fgrenache-grape","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbitfinexcom%2Fgrenache-grape","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbitfinexcom%2Fgrenache-grape/lists"}