{"id":15066844,"url":"https://github.com/ddoronin/rinzler","last_synced_at":"2026-01-12T02:21:16.747Z","repository":{"id":57156351,"uuid":"143633628","full_name":"ddoronin/rinzler","owner":"ddoronin","description":"🤺 Rinzler fights for the users","archived":false,"fork":false,"pushed_at":"2018-11-29T21:44:45.000Z","size":2563,"stargazers_count":4,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-10-12T22:59:12.027Z","etag":null,"topics":["binary","bson","json","mongo","protocol","typescript"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","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/ddoronin.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}},"created_at":"2018-08-05T17:27:02.000Z","updated_at":"2019-11-30T02:24:06.000Z","dependencies_parsed_at":"2022-09-01T03:40:15.405Z","dependency_job_id":null,"html_url":"https://github.com/ddoronin/rinzler","commit_stats":null,"previous_names":["ddoronin/b-flow"],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/ddoronin/rinzler","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ddoronin%2Frinzler","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ddoronin%2Frinzler/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ddoronin%2Frinzler/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ddoronin%2Frinzler/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ddoronin","download_url":"https://codeload.github.com/ddoronin/rinzler/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ddoronin%2Frinzler/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28332014,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-12T00:36:25.062Z","status":"online","status_checked_at":"2026-01-12T02:00:08.677Z","response_time":98,"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":["binary","bson","json","mongo","protocol","typescript"],"created_at":"2024-09-25T01:13:01.211Z","updated_at":"2026-01-12T02:21:16.712Z","avatar_url":"https://github.com/ddoronin.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![Build Status](https://travis-ci.org/ddoronin/rinzler.svg?branch=master)](https://travis-ci.org/ddoronin/rinzler)\n\n# Rinzler \n\nBinary over websockets:\n\n```\ndocker pull ddoronin/rinzler\n```\nIf you have a local instance of MongoDB up and running on `27017` (by default) you can use this command to run docker on `http://localhost:8080`:\n```\ndocker run --rm -it -p 8080:80 -p 27017:27017\n```\n\n## Motivation\nToday in the World of Big Data and IoT one of the key challenges is how to store data so it could be queried effeciently in many different ways. Evolution of databases toward NoSQL helped to reduce overhead of normalization. Changes in data schema are not pain any more. To achive this, for instance, Mongo is relying on schema-less tree structure stored as binary JSON (BSON).\n\nTraditionally back-end was required to parse database data (BSON for mongo), transform it into Java/C#/JavaScript or any other language objects in memory, than serialize in JSON and send it to a web browser over HTTP. All these layers of parsing, transformations and serializations take time and computational resources.\n\nWith `rinzler` it's not a case any more! Grab BSON and pass it throught as is!\n\n## Proposition\n\nClient-server communications in BSON over websockets or HTTP/2 should reduce web trafic and optimize back-end resources usage.\n\n## What is BSON?\n\nhttps://www.mongodb.com/blog/post/bson\n\u003e BSON is a binary serialization of JSON-like documents. BSON stands for “Binary JSON”, but also contains extensions that allow representation of data types that are not part of JSON. For example, BSON has a Date data type and BinData type.\n\n\u003e The key advantage over XML and JSON is efficiency (both in space and compute time), as it is a binary format.\n\n\u003e BSON can be compared to binary interchange formats, such as Protocol Buffers. BSON is more “schemaless” than Protocol Buffers – this being both an advantage in flexibility, and a slight disadvantage in space as BSON has a little overhead for fieldnames within the serialized BSON data.\n\n## Why is Mongo?\n\nMongoDB is a perfect example, because internally it's relying on BSON, every document is stored as BSON and can be passed throught in this raw binary format.\n\n## Workflow\n\n```\n┌─────────┐ REQUEST ┌─────────┐ QUERY   ┌─────────┐\n│ BROWSER │ ~~~~~~\u003e │ SERVER  │ ~~~~~~\u003e │  MONGO  │\n└─────────┘ H+BSON  └─────────┘ BSON    └─────────┘\n  ^  ^  ^                                   |\n  |  !  :                              cursor.next() != Nil\n  |  !  :                                   |\n READ BSON \u003c---------------------------  { 1010 }\n     !  :      STATUS [OK]                  |\n     !  :      BODY   [BSON]                |\n     !  :      INDEX  [0]                   |\n     !  :                                   |\n     !  :  ...    \u003c N times \u003e     ...  cursor.next() != Nil\n     !  :                                   |\n READ BSON \u003c---------------------------  { 1010 }\n        :      STATUS [OK]                  |\n        :      BODY   [BSON]                |\n        :      INDEX  [N-1]                 |\n        :                              cursor.next() == Nil\n        :                                   |\n READ BSON \u003c---------------------------  { 0000 }\n               STATUS [COMPLETED]\n               INDEX  [N]\n```\n\nToday web browsers are able to handle binary data effeciently with Typed Arrays, Buffers and WASM.\n\n`rinzler` is demonstrating two-way client-server communication over web sockets using BSON without additional layers of translation between JSON, BSON and back-end objects.\n\n## Protocol\n\nSee bytable\n\n### Client\n\n| Header      | Size          | Description |\n| ----------- | ------------- | ----------- |\n| MARKER_SIZE | UInt8         | Size of requestId to be used to trace a response.\n| MARKER      | `MARKER_SIZE` | Request Id. |\n| BODY_SIZE   | UInt32        | Size of payload.\n| BODY        | `BODY_SIZE`   | Payload in BSON.\n\n### Server\n\n| Header      | Size          | Description |\n| ----------- | ------------- | ----------- |\n| MARKER_SIZE | UInt8         | Size of requestId. |\n| MARKER      | `MARKER_SIZE` | Client requestId. |\n| STATUS      | UInt8         | Completion status. |\n| INDEX       | UInt16        | Response index. |\n| BODY_SIZE   | UInt32        | Size of BSON response. |\n| BODY        | `BODY_SIZE`   | Usually document, or error if it happened with status 1 [Error]. |\n\n### Status\n\n| UInt8 | Binary | Description |\n| ----- | -------| ----------- |\n| 0     | x0000  | Ok |\n| 1     | x0001  | Error |\n| 2     | x0010  | Completed |\n| 3     | x0011  | Completed with Errors |\n\nx0011 = x0001 | x0010\n\n\n## Docker\n\nYou can checkout the repo and build docker locally:\n```\ndocker build . -t ddoronin/rinzler\n```\n\nOr pull the latest version from docker hub:\n```\ndocker pull ddoronin/rinzler\n```\n\nAnd run it using the command:\n```\ndocker run --rm -it -p 80:80 -p 27017:27017 ddoronin/rinzler\n```\nwhere port 80 is used to serve a web server and 27017 is a default port for mongo.\n\nThese parameters could be customized using environment variables:\n\n- PORT=80\n- MONGO_URL=mongodb://host.docker.internal:27017\n\nBy default `MONGO_URL` is pointing to a mongo running on the host. In production environment this should be mongo connection string. It's recommended to keep docker ports as is, but change mapped ports if needed.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fddoronin%2Frinzler","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fddoronin%2Frinzler","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fddoronin%2Frinzler/lists"}