{"id":22487629,"url":"https://github.com/bitfinexcom/grenache","last_synced_at":"2026-02-08T18:03:42.517Z","repository":{"id":141634130,"uuid":"55350848","full_name":"bitfinexcom/grenache","owner":"bitfinexcom","description":"DHT based high-performance microservices framework, by Bitfinex","archived":false,"fork":false,"pushed_at":"2018-06-08T07:52:35.000Z","size":455,"stargazers_count":220,"open_issues_count":5,"forks_count":20,"subscribers_count":20,"default_branch":"master","last_synced_at":"2025-02-03T09:18:30.211Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://www.bitfinex.com/","language":null,"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/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}},"created_at":"2016-04-03T14:38:02.000Z","updated_at":"2025-02-02T19:02:15.000Z","dependencies_parsed_at":"2023-03-13T10:30:26.957Z","dependency_job_id":null,"html_url":"https://github.com/bitfinexcom/grenache","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/bitfinexcom%2Fgrenache","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bitfinexcom%2Fgrenache/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bitfinexcom%2Fgrenache/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bitfinexcom%2Fgrenache/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bitfinexcom","download_url":"https://codeload.github.com/bitfinexcom/grenache/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246112642,"owners_count":20725300,"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-06T17:16:58.705Z","updated_at":"2026-02-08T18:03:42.486Z","avatar_url":"https://github.com/bitfinexcom.png","language":null,"funding_links":[],"categories":["Frameworks / Runtimes","Others"],"sub_categories":[],"readme":"\u003cimg alt=\"Grenache Logo\" width=\"50%\" src=\"logos/logo-full-rect-black.png\" /\u003e\n\nGrenache is a DHT based high-performance microservices framework by Bitfinex.\nIt's decentralised and optimized for performance. Because it's simple, it's easy\nto understand and to set up.\n\nGrenache uses Distributed Hashtables, known from Bittorrent, to build a network between peers.\nIt's based on [Kademlia](https://en.wikipedia.org/wiki/Kademlia).\n\nPeers can send each other commands (RPC), and they can also store values in the DHT.\nPub/Sub is also possible.\n\nThe [Grenache Ecosystem](#implementations) supports Ruby and Node.js. There are multiple transports available: HTTP (plain \u0026 TLS), Websocket (plain \u0026 TLS), ZeroMQ.\n\n## Contents\n\n - [Features](#features)\n - [Implementations](#implementations)\n - [Grape Network Composition](#grape-network-composition)\n - [Grenache in Action: a RPC example](#grenache-in-action-a-rpc-example)\n - [Articles](#articles)\n - [Background](#background)\n - [Contribute](#contribute)\n - [Contacts](#contacts)\n\n## Features\n\n* Decentralised / Distributed architecture\n* Easy Bootstrap\n* Indefinite scalability and shapes\n* High-Performance\n\n## Implementations\n\n### Grape (the core)\n\n* https://github.com/bitfinexcom/grenache-grape\n\n### Peer Implementations\n\nTransports:\n* WebSocket transport: super-fast, great for Internet\n* HTTP transport: great for Internet\n* ZeroMQ transport: super-fast, perfect for internal networks\n\nPatterns:\n* PUT/GET: put/get data to/from the DHT\n* RPC: simple and efficient RPC pattern\n* PUB/SUB: (Work In Progress)\n\nNote: At the moment there is no interoperability between WebSocket and ZeroMQ implementations. A Proxy implementation will come later.\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* https://github.com/bitfinexcom/grenache-nodejs-ws-tls: WebSocket based Grape microservices with TLS support\n* https://github.com/bitfinexcom/grenache-nodejs-link: HTTP based connections to the DHT\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#### CLI Clients\n* https://github.com/bitfinexcom/grenache-cli: Command Line Interface for Grape microservices\n\n\n## Grape Network Composition\n\n### 1. The Grape: Grenache Discovery Node\n\nGrenache-Grape builds the Grenache Network. It offers multiple DHT interaction APIs for Clients: service discovery and DHT data storage.\n\n**Features**\n\n* Announce a Service\n* Lookup a Service\n* Push data to DHT\n\n### 2. Clients: Grenache Client implementations on specific Transports\n\nGrenache supports WebSocket, HTTP (plain / TLS) and ZeroMQ as transport protocols.\n\n**Features**\n\n* Offer / Publish a Service: create and announce a service on the DHT\n* Request / Subscribe to Service: find a service throught the DHT and connect to it\n* Store and retrieve data in the DHT\n\n\n## Grenache in Action: a RPC example\n\nWithin a Grenache network, connected peers can interact in different ways with each other.\nThey can store and retrieve data in the DHT. They can also work in a Pub/Sub pattern. Or they can work in RPC mode, with different workers and clients.\n\n\u003cimg alt=\"DHT with 2 workers and one client\" src=\"doc/RPC-Step-0.png\" width=\"60%\" /\u003e\n\nIn the diagram above we see three Grape nodes forming the DHT network. We have two workers connected. There is also another peer which will act as client.\n\nOur workers announce their service to the DHT:\n\n\u003cimg alt=\"Step 1: worker announces service\" src=\"doc/RPC-Step-1.png\" width=\"60%\" /\u003e\n\nNow peers can make use of the service and send commands to a service. They send their remote command to the DHT.\n\n\u003cimg alt=\"Step 2: worker announces service\" src=\"doc/RPC-Step-2.png\" width=\"60%\" /\u003e\n\nThe DHT looks up any peers that announce the service. In our case the two workers. The client receives the IP of the two workers.\n\n\u003cimg alt=\"Step 3: worker announces service\" src=\"doc/RPC-Step-3.png\" width=\"60%\" /\u003e\n\nFinally the client connects to both workers, who are executing the command and send back the result to the client.\n\n\u003cimg alt=\"Step 4: worker announces service\" src=\"doc/RPC-Step-4.png\" width=\"60%\" /\u003e\n\n## Articles\n\n * http://blog.bitfinex.com/tutorial/bitfinex-loves-microservices-grenache/\n * https://medium.com/bitfinex/introducing-svc-js-a-framework-for-grenache-7119f2d7769e\n * http://blog.bitfinex.com/tutorial/grenache-cli-command-line-interface/\n\n## Background\n\n* [Distributed Hash Table](http://www.bittorrent.org/beps/bep_0005.html) introduction\n* [Kademlia on Wikipedia](https://en.wikipedia.org/wiki/Kademlia)\n* [Kademlia: A Peer-to-Peer Information System Based on the XOR Metric](http://www.ic.unicamp.br/~bit/ensino/mo809_1s13/papers/P2P/Kademlia-%20A%20Peer-to-Peer%20Information%20System%20Based%20on%20the%20XOR%20Metric%20.pdf)\n\n## Contribute\n\nAny contribution in form of question, issue, idea and pull requests is well accepted\n\n## Contacts\n* [Paolo Ardoino](https://github.com/prdn)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbitfinexcom%2Fgrenache","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbitfinexcom%2Fgrenache","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbitfinexcom%2Fgrenache/lists"}