Hacker Newsnew | past | comments | ask | show | jobs | submitlogin
Show HN: Rasta.js, anonymous domainless key-value store for frontend JavaScript (errorjs.com)
73 points by pitra on Aug 21, 2011 | hide | past | favorite | 39 comments


I looked at the code, and what this does is to make calls to a web api on the errorjs.com domain.

It sets a key using:

http://rastajs.errorjs.com/set/yourkey/yourvalue

And retrieves it using:

http://rastajs.errorjs.com/get/yourkey

It also adds a timestamp, and allows for a callback. Perhaps it should be clarified that this relies on making a web call to their server (even if that is the only way this could possibly be done).


Thanks. I should be more clear about that.

The api is defined under WHY? tab, btw.


You might want to look at http://openkeyval.org if you weren't aware of it. Exact same idea.

(HN discussion: http://news.ycombinator.com/item?id=1846088)


Unless there is something I don't understand, how can this even be slightly reliable or useful, when everyone can read any key and write or replace any key at any moment ?


I guess I could see some usefulness in a quick weekend prototyping to get a persistent app up and running.


but then why would this be better than, say, localStorage, which is local? The only purpose to this is semi-persistent cross-domain information storage. It's crazy to use an external JSON-P service to store tweetable-sized messages, when you've got megabytes locally with precisely the same key/value setup. Or, if you're handling older browsers, cookies will get you several KB.


If you want to demonstrate some cross-browser communication app? I agree, this has a very limited application scope. I am more confused as to why the author made it when he doesn't seem to have a use case for it himself.


It's not meant to be reliable.

Nor is it meant to be secure. It's a direct connection to a data store.


And also replace a value with normal, arbitrary javascript...

Still, neat idea.


Good use of Twitter's new Bootstrap framework http://twitter.github.com/bootstrap/


There is a typo on the "FOR DUMMIES" section, "This is a key-value date store"


Would it make sense for "set" to be a POST? Or does that compromise "easy"?


It would make sense in theory, but in practice you can't make POST request to a JSONP API. So that's why you have to stick to GET request.


You can make a cross domain POST with an IFRAME but would not get the response directly. Having to use parent.postMessage, the window.name hack or polling with JSONP depending on the browser. Possible then, but not so easy.


Those hacks don't work on all platform (iframe for mobile is a good example) and often require you to have very particular setting on both sites. The only way for JSONP to work well on everything is to use script tag injection which only allows you to do GET request.


This works well on iPhone and Android mobiles. And has the same level of particular settings as JSONP.


awesome! like someone else said, this is a great tool for prototyping, and likely other projects. tinydb is pretty cool as well. http://tinydb.org/


Is this OSS? If so, where is the un-minified version and repository?


Unminified JS: http://rastajs.errorjs.com/rasta.js

I am putting it on GitHub right now.


I guess I am not geek enough, but the description for this is SOOO opaque. I have no idea what this does - and I am a web developer!

Can someone explain, in simple English, what this is about and why it's good?


It's a javascript library that essentially consists of two functions (get and set) to retrieve and store some arbitrary content identified by a key string. That content is stored on the author's server though you can override the domain name and put in your own.

I think this combination of a lightweight library and free online storage could be useful for people who would like to have a static website with no functionality or storage whatsoever on their server. It could also be used in scenarios where JS code is used as glue between one or more websites and the user (for example in browser plugins).


how does it work ?


you just include a <script> tag, and then use the API.


I think he meant - physically, HOW does this work. As in, where is the data stored and how?


oh, my bad. Well, the API doesn't specify anything beyond that.

My implementation is on GitHub at https://github.com/errorjs/Rasta.js


you might be able to replace the server with just CouchDB configured to allow JSONP... Then users can just sign up at something like http://iriscouch.com to install a copy of your library on an independent server.


Ah, redis. Good man.


Do keys need to be globally unique?


Everything is in the same namespace.


It would be a heck of a lot more useful if it were namespaced, like S3's buckets. Let folks put into those buckets whatever they want, but make the buckets in your datastore unique, based on the domain, referer, etc.


Fantastic! I needed that.


me too, that's why I made it


what are you using it for? still don't really get it...


nothing yet, I just wrote it. But basically, the idea is, you no longer need a backend to store some simple data.


I provide the backend. Well, actually Heroku does


Oh... I get it. It uses your server.


Wait - doesn't this just do JSONP GET requests for getting/setting values? How is this not needing a backend?


I think there's a pretty limited use for this, but it's definitely an interesting experiment if nothing else. I found it so cute that I decided I'd implement a really simple server endpoint for this.

https://github.com/rockstar/selassie

It's not backed by anything but memory, but that's why I said "simple".


He has his own backend, written in js and also backed by redis within the package:

https://github.com/errorjs/Rasta.js/blob/master/web.js




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

Search: