Hacker Newsnew | past | comments | ask | show | jobs | submitlogin
Rapid Backbone Prototyping With Real Backend (brainy.io)
53 points by catshirt on Dec 21, 2013 | hide | past | favorite | 10 comments


hi there. plug here. i finished the published parts of this library many months ago but never really showed anyone. figured now or never.

though i hope the readme is sufficient, this essentially lets you create a Backbone client application and it will create a full REST API for you. next feature in the pipeline does the same for views, allowing you to render your application on the client or server. following feature will be pub/sub on collections and models.

questions comments concerns welcome


This sounds real useful. I'm going to try and through something together and see how rapidly I can prototype with it.


Have you looked at ArangoDB and Foxx - https://www.arangodb.org/foxx - it's quite similar to this idea if I understand correctly.


i haven't. looks like similar principal though i chose to piggyback on Backbone and MongoDB standards so there is nothing new to learn.


The model I'm currently toying with involves running "model operations" locally on my Backbone models, then sending those requests to the server, which authenticates and validates them, returning canonical model data as a result. This is important to me because I need to verify that the model actions are valid rather than simply allowing arbitrary writes from models.

I'm also looking at well known collections as queries, such that the client can define some, upload the fetch request to the server, and the server will use the underlying database to populate the collection results, subject to privacy and access.

Have you thought about what adding those features to this framework might look like?


>> The model I'm currently toying with involves running "model operations" locally on my Backbone models, then sending those requests to the server, which authenticates and validates them, returning canonical model data as a result. This is important to me because I need to verify that the model actions are valid rather than simply allowing arbitrary writes from models.

if i understand correctly, this is exactly what i attempted with Brainy. all validation is run on the client (if they fail they don't send) and again on the server (if they fail they return an error response code). check out the `validate` documentation. [1]

>> I'm also looking at well known collections as queries, such that the client can define some, upload the fetch request to the server, and the server will use the underlying database to populate the collection results, subject to privacy and access.

again, correct me if i'm wrong, but i think this is baked into Brainy on top of Backbone's fetch. [2]

[1] http://brainy.io/#resources-validate [2] http://brainy.io/#resources-fetch


Consider an "add user to thread" function. Only participating users can add other members. First, how would I do authentication/authorization with Brainy? Second, the easiest way to enforce the existing member relationship is to have a method that validates an "add user" function call and then performs the action. With a single "validate" method, you need to know the old values and the new values and compute the delta. Does Brainy support that?

As far as collections, pretend a user can only see threads for which he is a member. Can that be enforced with Brainy? It could be if the queries were well-defined methods that produced query strings and were executed on the server.

I ask about all this because I'm basically implementing it manually in my current project, and it would be neat to have something reusable at the end of these efforts.


i'm currently doing this with a session model. and i override my model save/fetch to validate the session before performing some operation.

it's not packaged because i'm hesitant to include any client-specific code (yet) and i'm not sure it's any sort of secure. if you open an issue on the project i'll remember to respond with more detail.


because capitalized section headers are so dated


Because gratuitous sarcastic negativity doesn't age a bit.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: