
Thoughts on RethinkDB and GraphQL - rayshan
https://github.com/rethinkdb/rethinkdb/issues/3711
======
antirez
Apart from GraphQL itself, two things are pretty impressive about this thread.
1) Impressive community to have such an informed set of comments in a matter
of a few days. Congrats. 2) People have to talk like that in a very hard to
follow way since we used to have better ways (NNTP, mailing lists) but now
they are gone in favor of worse systems.

~~~
rgbrgb
Anything specific you find hard to follow here?

~~~
antirez
The commenters are great, so they provide a discussion that makes sense, but
is a wall of comments one after the other. It is possibly the most primitive
way to interact, compared to something like Reddit comments with collassable
threads, votes, and so forth.

~~~
egor83
> something like Reddit comments with collassable threads

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...](https://chrome.google.com/webstore/detail/hckr-
news/mnlaodleonmmfkdhfofamacceeikgecp/)

Then there is "HN Enhancement Suite" with more users and more functionality:

[https://chrome.google.com/webstore/detail/hacker-news-
enhanc...](https://chrome.google.com/webstore/detail/hacker-news-
enhancement-s/bappiabcodbpphnojdiaddhnilfnjmpm/)

~~~
jmgrosen
I believe he meant the GitHub thread, though those are still useful extensions
(for Chrome users...).

------
jondubois
I read somewhere that they're trying to add realtime support to GraphQL, but
the problem which GraphQL solves is only an issue if you use HTTP as a
transport.

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.

~~~
possibleNoob
This is interesting. Do you have an example or perhaps a library i can look
more into? Would this work with phoenix channels?

~~~
jondubois
I made this sample using SocketCluster (I'm the main author):
[https://github.com/socketcluster/sc-sample-
inventory](https://github.com/socketcluster/sc-sample-inventory) \- I wrote a
basic realtime CRUD module/layer using SC's internal in-memory storage:
[https://github.com/SocketCluster/sc-sample-
inventory/blob/ma...](https://github.com/SocketCluster/sc-sample-
inventory/blob/master/sc_modules/realtime-rest.js).

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](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).

------
msvan
As someone who is currently experimenting with RethinkDB and GraphQL for a
personal protect, I have been impressed with both technologies and they have
been rather straight-forward to integrate with my React frontend, even without
the blessing of official support. I expect the productivity gains could be
huge when working on bigger apps. It's a refreshing perspective compared to
the RESTful single-page app I maintain at my dayjob.

~~~
schrockn
That sounds awesome. Are you developing this on github? I'd be curious to see
what your integration looks like.

------
rspeer
Baking Facebook's graph representation into a database sounds like the worst
kind of database bloat. Worse than when Riak decided they needed "MapReduce"
on their feature checklist, then warned developers to "Use MapReduce
sparingly" because it kills your availability.

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.

~~~
phpnode
GraphQL is almost totally unrelated to graphs, it's a way to compose API
requests in a manner that fits modern web / mobile usage patterns better than
REST. GraphQL has _nothing_ to do with the actual representation of the data.
I think the name has led to a lot of misconceptions.

~~~
schrockn
Hi I'm Nick Schrock and I actually came up with the name. Graph in this
context means social graph or more generally the conceptual graph of data in
your application, which you can query. It doesn't mean that it is a formalized
graph database in any sort of way, nor does it seek to be.

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.

~~~
lobster_johnson
Ironically, the "query language" part also misses the mark, and I think that
part confuses people more (as in that RethinkDB discussion).

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.

------
TheAceOfHearts
I've been playing around with GraphQL and Relay recently. Initially I was
using PostgreSQL, but I was using an ORM which made implementing pagination
annoying.

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.

[0]
[https://github.com/arangodb/arangodb/issues/1468](https://github.com/arangodb/arangodb/issues/1468)

