

Show HN: Rasta.js, anonymous domainless key-value store for frontend JavaScript - pitra
http://rastajs.errorjs.com

======
lars
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).

~~~
pitra
Thanks. I should be more clear about that.

The api is defined under WHY? tab, btw.

------
bouncingsoul
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>)

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

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

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

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

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

------
amasad
There is a typo on the "FOR DUMMIES" section, "This is a key-value dat __e
__store"

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

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

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

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

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

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

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

~~~
pitra
Unminified JS: <http://rastajs.errorjs.com/rasta.js>

I am putting it on GitHub right now.

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

~~~
Udo
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).

------
maroufle
how does it work ?

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

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

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

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

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

------
pkulak
Do keys need to be globally unique?

~~~
pitra
Everything is in the same namespace.

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

------
david927
Fantastic! I needed that.

~~~
pitra
me too, that's why I made it

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

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

~~~
pitra
I provide the backend. Well, actually Heroku does

------
iamtherockstar
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".

~~~
nikcub
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>

