

Rapid Backbone Prototyping With Real Backend - catshirt
http://brainy.io/

======
catshirt
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

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

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

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

------
CGamesPlay
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?

~~~
catshirt
>> _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](http://brainy.io/#resources-
validate) [2] [http://brainy.io/#resources-fetch](http://brainy.io/#resources-
fetch)

~~~
CGamesPlay
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.

~~~
catshirt
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.

------
dmur
because capitalized section headers are so dated

~~~
VeejayRampay
Because gratuitous sarcastic negativity doesn't age a bit.

