Thoughts on RethinkDB and GraphQL
github.com
github.com
There are ways to add it here on HN with extensions. I'm using "hckr news" myself:
https://chrome.google.com/webstore/detail/hckr-news/mnlaodle...
Then there is "HN Enhancement Suite" with more users and more functionality:
https://chrome.google.com/webstore/detail/hacker-news-enhanc...
Personally, I find a linear style with mentions, quotes, and backlinks (a la Discourse) strikes the best balance for most conversations. But of course we'll never all agree.
If you use a pub/sub realtime layer on the frontend, you don't need all the complexity which GraphQL introduces - You can make each component bind itself to a pub/sub channel which publishes changes to the resource which that component is interested in. It's a lot simpler and more direct.
Yes, there are a million ways to arrange for my landing page to 'listen' for every time I make an account change. But getting auditing and analytics and read replicas all working properly has always been a very big drain on developer resources, and if done wrong can create site-wide performance problems. I can't tell you how many times someone has demanded a handful of reporting indexes on the highest (write) traffic tables and then doesn't understand how the whole app got so slow. "I want to know every second how much money we're making today and I don't care if I drive away 10% of our income to get it" sigh
What I've wanted every time I've done persistence work in the last 15 years is to be able to have one database that's a partial clone of my 'real' data but with different indexes and lifetimes, without having to re-invent the wheel to get it. I have my fingers crossed that RethinkDB will become that product.
That was just for experimenting, now I'm working on a proper version using RethinkDB with a better realtime CRUD interface. My solution doesn't rely on RethinkDB's changefeed feature though, so you should be able to implement a similar binding for any database. WORK IN PROGRESS: https://github.com/SocketCluster/sc-crud-rethink
Basically, the realtime pub/sub layer sits directly on top of the database such that any change made to the database must pass through that layer (The pub/sub layer is responsible for notifying relevant subscribers - Not the database).
Graph technologies change all the time. Almost nobody will be using GraphQL in 2020, just like almost nobody is using 2010's graph representations in 2015.
I have high hopes for RethinkDB to be a DB that does things right in the long term, so I hope things like this appear only in the form of plugins that are easily disabled by users, and easily deprecated by developers.
The plugin system will provide a sort of middleware layer alongside the database so that we don't have to bake in a lot of things that are domain specific or only relevant to particular use cases.
There's more discussion about the plugin system here: https://github.com/rethinkdb/rethinkdb/issues/4785
(Disclosure: I work at RethinkDB)
This client-server separation setup has been around for some decades, and it obviously works well. For example, there is a bunch of NoSQL databases that will accept at least some SQL syntax. That is good.
It does not have things like filtering, ordering, subqueries, etc. -- you can implement those things, but that would be just one possible implementation, specific to your data model. You wouldn't be able to point just any GraphQL client at it; the client has to know what to ask for, and how.
I understand the name causes a bit of confusion but the ship has kind of sailed on this one :-) I think people will get used to it if/when it becomes a widely known name.
GraphQL is closer to what we call a protocol; it has minimal syntax, a kind of data model, and it can only be used for declaring requests. You can't implement anything in GraphQL: absolutely all of its expressions are implementation-provided — contrast with, say, SQL, which, being an actual query language, defines operators, arithmetic expressions, mutations, etc. A defining quality of a protocol is that it's a medium through which clients can talk to multiple black-box implementations, which is exactly what GraphQL is.
I like GraphQL, but I wish you'd thought through the name before you started to publish about it. If you'd called it something like Extensible API Protocol, nobody would have batted an eyelid.
Virtually every graph database vendor now gets requests that they implement GraphQL, because from the name it sounds like it fits but in reality it's totally unrelated.
That sounds like an even sillier thing to put in a database, then.
Previously I had played around with RethinkDB, so I decided to give it a shot with GraphQL. It actually works out really nicely, you can do an almost 1:1 copy of the cursor helpers available in graphql-relay-js using ReQL.
I think the biggest pain-point for me has been having to dig in through all the source code, since there's not much documentation and examples available. Although, there's a ton of inline comments and type definition which has made it palatable.
As a related aside, I was researching what people had done and found a discussion surrounding GraphQL and ArangoDB [0], which may be of interest to other readers.