Case Study:


Dendritic is a nodeJS framework for building high performance APIs that make it simple to add real time data features. Normally, APIs are developed with a pull methodology, either via RPC, REST or GraphQL. When realtime features are required, they are built as a side channel for the particular endpoint that requires the feature. Dendritic bakes in websocket-based, realtime functionality to every endpoint in the API.

The key challenge when building this functionality in as a primitive of the platform is to ensure that safety is maintained in all use cases. The most challenging of these is in ensuring race conditions are not introduced between data fetched from the RESTful endpoints and data streamed from the realtime endpoints. Dendritic achieves this with two mechanisms working in concert.

The first is to leverage the atomic changefeed functionality built into RethinkDB. This is a guarantee made by the database that no changes can be made to the underlying dataset in between the existing state of the query being provided and the change listener beginning to stream changes. This is the most common pitfall seen in side channel realtime systems in production.

The second mechanism utilises the concept of revision tokens as pioneered in CouchDB. This is a token that is changed on every update of the document. In order to make an update to a document the user must first prove they are aware of the current state of the document by providing the token. If the token does not match, ie: if another user has updated the document since the current user last fetched it, the update is rejected and the user can take action. This ensures that in scenarios where two users may make updates to the same document their changes will never be silently overwritten by the other user. This provides a dramatic increase in safety over most concurrency designs commonly seen in production.

Other innovations in Dendritic include heavy use of JSON Hyperschema to provide both validations and randomly generated test fixtures (similar to Quickcheck). The Dendritic project also incorporated a UI component library and an admin interface.

Dendritic is currently on hold while the future of RethinkDB is clarified.


[email protected]

Let's work together