Live data from Hacker News

Horizon 1.0: a realtime, open-source JavaScript back end from RethinkDB

horizon.io

21–30 of 133 posts

Re: Horizon 1.0: a realtime, open-source JavaScript back end from RethinkDB

#21
Slava, Horizon looks cool, and I'm a huge fanboy of RethinkDB. However, in the demo video you write queries client side. How do you protect against users modifying front-end JavaScript and thus the queries?

    // ex
    this.props.horizon.order('datetime', 'descending').limit(8).watch()

Re: Horizon 1.0: a realtime, open-source JavaScript back end from RethinkDB

#22

Slava, Horizon looks cool, and I'm a huge fanboy of RethinkDB. However, in the demo video you write queries client side. How do you protect against users modifying front-end JavaScript and thus the queries? // ex this.props.horizon.order('datetime', 'descending').limit(8).watch()

This is the question I always get stuck on with these "front-end only" frameworks. How do you prevent DoS attacks or scrapers downloading your whole database? What is the information security model?

Re: Horizon 1.0: a realtime, open-source JavaScript back end from RethinkDB

#23
post #19

How does this differ from Meteor?

See the FAQ http://horizon.io/faq/

For convenience, this is the section taken from it that addresses this exact question! (I imagine other people may be thinking this)

How is Horizon different from Meteor?

Horizon has philosophical and technical differences with Meteor that will result in vastly different developer experiences.

Horizon is a small layer on top of RethinkDB with a narrow, purpose-built API designed to make it very easy to get started building realtime apps without backend code. Horizon isn’t prescriptive – you can use any front-end framework without any magic/customizations, and once your app outgrows the Horizon API you can use any backend technology (e.g. Node.js, Python, Ruby) and any backend framework (e.g. Rails, Express, Koa, etc.)

By contrast, Meteor is a much more prescriptive framework. Horizon is a reasonably small component that has a very clean separation with the database and the frontend, while Meteor is a much more monolithic experience.

Another major difference is architectural – Meteor uses a LiveQuery component built by tailing MongoDB’s oplog. This approach is fundamentally limited – it’s impossible to do many operations efficiently, and even the basic functionality is extremely difficult to scale.

Horizon is built on RethinkDB, so the LiveQuery functionality is in the database. This allows for much more sophisticated streaming operations, and scalability is dramatically simpler because the database has all the necessary information to allow for a scalable feeds implementation.

Re: Horizon 1.0: a realtime, open-source JavaScript back end from RethinkDB

#24

Hey guys, Slava @ Rethink here. The team is really excited to launch Horizon -- it's based on a lot of feedback from users of very different backgrounds, and we think it will make web development dramatically easier. I've been up for about twenty-four hours, but I'll be around to answer any questions for the rest of the day.

Hi Slava! What do you guys think about the approach taken here, and what are the major differences in approach theat you took with Horizon? https://github.com/mikemintz/react-rethinkdb I've had really good luck with that whitelisting approach, so I'm wondering what the biggest wins would be from potentially switching to Horizon.

Mike's `react-rethinkdb` project is really cool, but it's based on exposing the entire ReQL language to the browser. We thought this approach wouldn't work well as an industrial-strength product -- ReQL is designed to be accessed from the backend, and exposing a full query language to the browser introduces a number of challenges. Security is really hard, learning curve is steep, there are DoS challenges, the protocol is too complex to write platform-specific extensions, etc.

On the other hand, Horizon exposes a simple API/protocol that's easy to learn and easy to secure. If you need more functionality, you can import Horizon as a Node.js module and start writing backend code that accesses RethinkDB directly. The learning curve is much easier, it provides an upgrade path for sophisticated apps, and feels like a more robust product.

(I don't mean to disparage `react-rethinkdb`, I think the project is awesome, it's just a philosophical difference in approach)

Re: Horizon 1.0: a realtime, open-source JavaScript back end from RethinkDB

#26
How does access control work? For example, if I have a database containing a table "users", and a table "files", and the files table contains a column "owner" (pointing to the users table), then how do I prevent the client-side database engine from accessing the files which do not belong to the user that is currently logged in?

Re: Horizon 1.0: a realtime, open-source JavaScript back end from RethinkDB

#27

Slava, Horizon looks cool, and I'm a huge fanboy of RethinkDB. However, in the demo video you write queries client side. How do you protect against users modifying front-end JavaScript and thus the queries? // ex this.props.horizon.order('datetime', 'descending').limit(8).watch()

You can't protect from the client modifying the JavaScript code, and that's ok. Horizon ships with a full security model (http://horizon.io/docs/permissions/) that lets you specify exactly what data each user can and cannot access, which queries they can run, etc. We're going to continue expanding the security model to include DoS protection, and any other issues that may come up.

So while the user can change JavaScript as they please, that's ok; if they try to do something they're not supposed to do, the server will just reject the query.

Re: Horizon 1.0: a realtime, open-source JavaScript back end from RethinkDB

#28
post #22

Slava, Horizon looks cool, and I'm a huge fanboy of RethinkDB. However, in the demo video you write queries client side. How do you protect against users modifying front-end JavaScript and thus the queries? // ex this.props.horizon.order('datetime', 'descending').limit(8).watch()

This is the question I always get stuck on with these "front-end only" frameworks. How do you prevent DoS attacks or scrapers downloading your whole database? What is the information security model?

I believe http://horizon.io/docs/permissions/ is the answer

Re: Horizon 1.0: a realtime, open-source JavaScript back end from RethinkDB

#29
post #26

How does access control work? For example, if I have a database containing a table "users", and a table "files", and the files table contains a column "owner" (pointing to the users table), then how do I prevent the client-side database engine from accessing the files which do not belong to the user that is currently logged in?

Check out the docs on security and permissions -- http://horizon.io/docs/permissions/. Horizon ships with a full security model that allows you to protect your data and specify exactly what each user can and cannot access and which queries they can run.

Re: Horizon 1.0: a realtime, open-source JavaScript back end from RethinkDB

#30
(Former Meteor core dev here) This is cool!

Does Horizon also solve "optimistic updates"? If so I'd love to learn more details. For comparison, Meteor keeps a local datastore that updates immediately when data is mutated and then reconciled with the real database.

Post reply on HN