You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@couchdb.apache.org by Mirko Kiefer <mi...@arcor.de> on 2010/11/08 22:24:18 UTC

LivelyCouch - a framework around CouchDB and Node.js

Hi,
we are currently working on open sourcing our so called LivelyCouch 
framework which emerged out of a few projects.
Hopefully this week still we will have a website up and running 
explaining the usage of LivelyCouch in more detail.
I would just like to get some early feedback on our concepts - so I 
wrote a little summary in two parts on my blog.

The first part focuses on writing Node.js handlers:
http://mirkokiefer.com/blog/2010/11/introducing-livelycouch-part-1-writing-node-js-handler/

Part two explains the event system we built around CouchDB using Node:
http://mirkokiefer.com/blog/2010/11/introducing-livelycouch-part-2-events-and-workers/

Hope to get a lot of feedback!

Mirko

Re: LivelyCouch - a framework around CouchDB and Node.js

Posted by Paul Davis <pa...@gmail.com>.
On Mon, Nov 8, 2010 at 4:24 PM, Mirko Kiefer <mi...@arcor.de> wrote:
> Hi,
> we are currently working on open sourcing our so called LivelyCouch
> framework which emerged out of a few projects.
> Hopefully this week still we will have a website up and running explaining
> the usage of LivelyCouch in more detail.
> I would just like to get some early feedback on our concepts - so I wrote a
> little summary in two parts on my blog.
>
> The first part focuses on writing Node.js handlers:
> http://mirkokiefer.com/blog/2010/11/introducing-livelycouch-part-1-writing-node-js-handler/
>
> Part two explains the event system we built around CouchDB using Node:
> http://mirkokiefer.com/blog/2010/11/introducing-livelycouch-part-2-events-and-workers/
>
> Hope to get a lot of feedback!
>
> Mirko
>

Just a quick note, the new_externals patches have been applied to
trunk so you don't need to reference my branch on github directly.

Other than that, this looks to be like what a lot of people wanted
when I was asking for suggestions at CouchCamp. Its nice to see an
idea coming to fruition.

Re: LivelyCouch - a framework around CouchDB and Node.js

Posted by Mirko Kiefer <mi...@arcor.de>.
Hi Pete,
if you haven't spent much time with Node.js yet it might indeed be not 
obvious to see the "awesomeness" of LivelyCouch :)
Besides the advantage of being able to store and distribute your entire 
application backend in CouchDB I see the event system as the most 
exciting thing about LivelyCouch.
The idea is that you split your application in small modules called 
Workers, that have a single purpose (like in the tutorial an e-mail 
Worker or database changelistener).
Communication between Workers can only happen asynchronously by one 
Worker emitting an Event and another Worker subscribing to it.
This is just like in Node.js with the difference that Events in 
LivelyCouch are HTTP messages and therefore work across multiple 
processes or even physical machines.
Once you built all the Workers you need for your application, you can 
very flexibly wire them together with Event subscriptions without having 
to change the actual source code of your application.
Lets take the example in our tutorial where we have a Worker that emits 
an Event every time a document gets added to an "inbox" database 
(http://livelycouch.org/tutorials.html).
In the tutorial we added a subscription to that Event which triggered a 
Worker who is responsible for sending out e-mail notifications.
We could very easily add a new subscription to the same Event that 
triggers another Worker who could update the new inbox document with a 
property saying "user_notified": true.
To implement this new "feature" we don't have to modify any of our 
existing code - we simply write this new Worker and bind it to the 
existing Event.

This may still be a bit too abstract - I will work on a more hands-on 
tutorial with a realistic example.
Maybe you want to have a look at Mikeal's talk in Berlin where he 
describes a scenario where LivelyCouch would come in very handy:
http://jsconfeu.blip.tv/file/4235942/

Regards,
Mirko

On 12/7/10 9:40 PM, Peter Nolan wrote:
> It's good to see that you're coming along on your project.  I'm really glad
> that you're writing apis and tutorials as you progress (more people should
> follow your lead) please please please keep this up :p
>
> However, I am unsure of the true 'awesomeness' of your application.  I have
> only begun to read about your project so it might not just be 'obvious' to
> me.  (i still don't get why node.js is so great)   Perhaps if you could
> write simple applications that could serve a dual purpose - a simple guided
> walk through and an example of the awesomeness should achieve this.
>
> Either way, I'm glad to know you're coming along, and look forward to
> reading about your progress.
>
> -Pete
>
> On Tue, Dec 7, 2010 at 12:58 PM, Mikeal Rogers<mi...@gmail.com>wrote:
>
>> Sounds great, I'm excited to see how it all turns out.
>>
>
>

Re: LivelyCouch - a framework around CouchDB and Node.js

Posted by Peter Nolan <pe...@gmail.com>.
It's good to see that you're coming along on your project.  I'm really glad
that you're writing apis and tutorials as you progress (more people should
follow your lead) please please please keep this up :p

However, I am unsure of the true 'awesomeness' of your application.  I have
only begun to read about your project so it might not just be 'obvious' to
me.  (i still don't get why node.js is so great)   Perhaps if you could
write simple applications that could serve a dual purpose - a simple guided
walk through and an example of the awesomeness should achieve this.

Either way, I'm glad to know you're coming along, and look forward to
reading about your progress.

-Pete

On Tue, Dec 7, 2010 at 12:58 PM, Mikeal Rogers <mi...@gmail.com>wrote:

> Sounds great, I'm excited to see how it all turns out.
>



-- 
Peter Nolan

Re: LivelyCouch - a framework around CouchDB and Node.js

Posted by Mikeal Rogers <mi...@gmail.com>.
Sounds great, I'm excited to see how it all turns out.

Re: LivelyCouch - a framework around CouchDB and Node.js

Posted by Pavel Krivanek <pa...@gmail.com>.
Hi,

in XULRunner you can use HTML documents instead of XUL and they have
the same privileges as XUL ones. So you may try this thing:

>From http://code.google.com/p/xuljet/ download the latest archive and
use examples/helloworld directory as a template.

in the file defaults/preferences/prefs.js change the first line to the
actual starting html file:

pref("toolkit.defaultChromeURI", "chrome://myapp/content/index.html");

>From CouchDB copy the file couch.js
(/usr/share/couchdb/www/script/couch.js) to the chrome/content
directory

Create chrome/content/index.html and add <script
type="text/javascript" src="lib/couch.js"/> to the head section.

Then you may try something like

CouchDB.urlPrefix = "http://192.168.1.42:5984"
var db = new CouchDB("myDatabase");
alert(db.allDocs());

You cannot start witch external server address however you can use
XULRunner as a local provider that will get data server external web
server via Ajax and display.

Maybe you can use basic XUL document with a browser tag and use
browser tag inside
(https://developer.mozilla.org/en/XUL/browser#a-browser.type) with the
type "chrome". But I'm not sure if it will work well.

-- Pavel




couch.db.urlPrefix = "http://192.168.1.42:5984"
var db = new couch.db("adresy");

On Fri, Dec 10, 2010 at 10:53 AM, Nils Breunese <N....@vpro.nl> wrote:
> Florian Leitner wrote:
>
>> As I never used node.js, I gave it a look just now - and found
>> something rather worrying with respect to my needs: node.js does not
>> support Windows (natively, only via Cygwin), and after checking their
>> mailing list, it seems the developers behind node.js are not planning
>> any support for it, either - and not even much for their "Cygwin
>> port". So, essentially, a LivelyCouch app can only run on Mac and
>> Linux, right? (Not that I like or even support Windoze, but I assume
>> many users of a desktop-based application using CouchDB will...)
>
> I haven't looked into LivelyCouch, but AFAIK node.js is a server-side thing, so I guess app end users can run whatever OS they like. If LivelyCouch is about using node.js on the client side of things, then I might be wrong. :o)
>
> Nils.
> ------------------------------------------------------------------------
>  VPRO
>  phone:  +31(0)356712911
>  e-mail: info@vpro.nl
>  web:    www.vpro.nl
> ------------------------------------------------------------------------
>

Re: LivelyCouch - a framework around CouchDB and Node.js

Posted by Mirko Kiefer <mi...@arcor.de>.
Hi Florian,

yes your forwarding of HTTP requests scenario would be quite easy with 
LivelyCouch.
You would basically have to write a Handler as described in the 
introduction at livelycouch.org.
This Handler would just forward the request it receives as you described 
and could then even write the response to a user database.

Mirko

On 12/10/10 4:56 PM, Florian Leitner wrote:
> Hi Mirko, Pavel, Nils,
>
> Sorry for the double post - I answered the issues in my original post
> already, but in case you are only following this thread, here is what
> I wrote (plus I've added a question for Mirko - see below):
>
> I am completely aware of the fact that you can do replication and
> synchronization in CouchDB. Maybe I did not explain myself
> sufficiently: What I need to do is find a way to make CORS
> (Cross-Origin Resource Sharing) requests to websites that do not
> actually implement CORS (i.e., provide the CORS headers you have to
> add to your server responses) via an application that uses CouchDB as
> its permanent storage. By "coincidence", those requests could be sent
> to sites could even be sites running CouchDB and even my own
> application I will write, but that do not actually share any data
> (i.e., no CouchDB syncing/replication between the two sites). The only
> way to do that seems to use some "man-in-the-middle" webserver
> solution, or if CouchDB would provide some means to create a XHR
> (XmlHttpRequest) proxy, so you can work around that Single Origin
> Policy problem.
>
> So, if it were a "man-in-the-middle" solution by wrapping CouchDB with
> a web server (which seems the only way to go so far), it should
> ideally be as flexible as CouchDB itself or at the very least run on
> all three main desktop platfoms: Linux, Apple, and Windoze. The
> current solutions I have found so far not really work out: LivelyCouch
> &  node.js does not work on Windoze (bummer, but I can understand the
> guys - its not their priority...). XULRunner/XULjet only works for
> desktop apps, so I realized it doesn't really solve my issue either,
> because you would have to create two interfaces: one for the server
> part serving web pages, based - for example - on LivelyCouch/node.js,
> and one for XULRunner/XULjet to make a desktop (client) app that can
> run on many different platforms. This is the closest I currently got
> to a solution, but it isn't optimal, because I will have to maintain
> _two_ interface libraries...
>
> @Mirko: I am also not 100% sure that with LivelyCouch you can actually
> forward a user (XHR) request to any other website, creating sort of a
> "cutomized" XHR proxy. Say, I present a form to a user to make a
> query, he POSTs that to LivelyCouch/node.js, that then POSTs that
> query to some URL and fetches and represents the results to the user.
> Next, if the user selects (GETs) a result, LivelyCouch/node.js GETs
> that resource from some URL, dumps it into the user's CouchDB, and
> presents that fetched resource to the user. Can you do that with
> LivelyCouch/node.js? I assume the answer is yes, but I just want to be
> sure.
>
> Regards,
> Florian
>
> On 10 December 2010 11:42, Mirko Kiefer<mi...@arcor.de>  wrote:
>> Florian,
>> I just discovered your earlier post.
>> In your scenario it in fact makes a lot of sense to me that you use
>> CouchDB's replication to push documents to the server and get them from
>> possibly other servers. You can do replication on a per document basis or as
>> far as I know even use a filter function.
>>
>> Mirko
>>
>> On 12/10/10 10:53 AM, Nils Breunese wrote:
>>> Florian Leitner wrote:
>>>
>>>> As I never used node.js, I gave it a look just now - and found
>>>> something rather worrying with respect to my needs: node.js does not
>>>> support Windows (natively, only via Cygwin), and after checking their
>>>> mailing list, it seems the developers behind node.js are not planning
>>>> any support for it, either - and not even much for their "Cygwin
>>>> port". So, essentially, a LivelyCouch app can only run on Mac and
>>>> Linux, right? (Not that I like or even support Windoze, but I assume
>>>> many users of a desktop-based application using CouchDB will...)
>>> I haven't looked into LivelyCouch, but AFAIK node.js is a server-side
>>> thing, so I guess app end users can run whatever OS they like. If
>>> LivelyCouch is about using node.js on the client side of things, then I
>>> might be wrong. :o)
>>>
>>> Nils.
>>> ------------------------------------------------------------------------
>>>   VPRO
>>>   phone:  +31(0)356712911
>>>   e-mail: info@vpro.nl
>>>   web:    www.vpro.nl
>>> ------------------------------------------------------------------------

Re: LivelyCouch - a framework around CouchDB and Node.js

Posted by Florian Leitner <fl...@gmail.com>.
Hi Mirko, Pavel, Nils,

Sorry for the double post - I answered the issues in my original post
already, but in case you are only following this thread, here is what
I wrote (plus I've added a question for Mirko - see below):

I am completely aware of the fact that you can do replication and
synchronization in CouchDB. Maybe I did not explain myself
sufficiently: What I need to do is find a way to make CORS
(Cross-Origin Resource Sharing) requests to websites that do not
actually implement CORS (i.e., provide the CORS headers you have to
add to your server responses) via an application that uses CouchDB as
its permanent storage. By "coincidence", those requests could be sent
to sites could even be sites running CouchDB and even my own
application I will write, but that do not actually share any data
(i.e., no CouchDB syncing/replication between the two sites). The only
way to do that seems to use some "man-in-the-middle" webserver
solution, or if CouchDB would provide some means to create a XHR
(XmlHttpRequest) proxy, so you can work around that Single Origin
Policy problem.

So, if it were a "man-in-the-middle" solution by wrapping CouchDB with
a web server (which seems the only way to go so far), it should
ideally be as flexible as CouchDB itself or at the very least run on
all three main desktop platfoms: Linux, Apple, and Windoze. The
current solutions I have found so far not really work out: LivelyCouch
& node.js does not work on Windoze (bummer, but I can understand the
guys - its not their priority...). XULRunner/XULjet only works for
desktop apps, so I realized it doesn't really solve my issue either,
because you would have to create two interfaces: one for the server
part serving web pages, based - for example - on LivelyCouch/node.js,
and one for XULRunner/XULjet to make a desktop (client) app that can
run on many different platforms. This is the closest I currently got
to a solution, but it isn't optimal, because I will have to maintain
_two_ interface libraries...

@Mirko: I am also not 100% sure that with LivelyCouch you can actually
forward a user (XHR) request to any other website, creating sort of a
"cutomized" XHR proxy. Say, I present a form to a user to make a
query, he POSTs that to LivelyCouch/node.js, that then POSTs that
query to some URL and fetches and represents the results to the user.
Next, if the user selects (GETs) a result, LivelyCouch/node.js GETs
that resource from some URL, dumps it into the user's CouchDB, and
presents that fetched resource to the user. Can you do that with
LivelyCouch/node.js? I assume the answer is yes, but I just want to be
sure.

Regards,
Florian

On 10 December 2010 11:42, Mirko Kiefer <mi...@arcor.de> wrote:
> Florian,
> I just discovered your earlier post.
> In your scenario it in fact makes a lot of sense to me that you use
> CouchDB's replication to push documents to the server and get them from
> possibly other servers. You can do replication on a per document basis or as
> far as I know even use a filter function.
>
> Mirko
>
> On 12/10/10 10:53 AM, Nils Breunese wrote:
>>
>> Florian Leitner wrote:
>>
>>> As I never used node.js, I gave it a look just now - and found
>>> something rather worrying with respect to my needs: node.js does not
>>> support Windows (natively, only via Cygwin), and after checking their
>>> mailing list, it seems the developers behind node.js are not planning
>>> any support for it, either - and not even much for their "Cygwin
>>> port". So, essentially, a LivelyCouch app can only run on Mac and
>>> Linux, right? (Not that I like or even support Windoze, but I assume
>>> many users of a desktop-based application using CouchDB will...)
>>
>> I haven't looked into LivelyCouch, but AFAIK node.js is a server-side
>> thing, so I guess app end users can run whatever OS they like. If
>> LivelyCouch is about using node.js on the client side of things, then I
>> might be wrong. :o)
>>
>> Nils.
>> ------------------------------------------------------------------------
>>  VPRO
>>  phone:  +31(0)356712911
>>  e-mail: info@vpro.nl
>>  web:    www.vpro.nl
>> ------------------------------------------------------------------------
>

Re: LivelyCouch - a framework around CouchDB and Node.js

Posted by Mirko Kiefer <mi...@arcor.de>.
Florian,
I just discovered your earlier post.
In your scenario it in fact makes a lot of sense to me that you use 
CouchDB's replication to push documents to the server and get them from 
possibly other servers. You can do replication on a per document basis 
or as far as I know even use a filter function.

Mirko

On 12/10/10 10:53 AM, Nils Breunese wrote:
> Florian Leitner wrote:
>
>> As I never used node.js, I gave it a look just now - and found
>> something rather worrying with respect to my needs: node.js does not
>> support Windows (natively, only via Cygwin), and after checking their
>> mailing list, it seems the developers behind node.js are not planning
>> any support for it, either - and not even much for their "Cygwin
>> port". So, essentially, a LivelyCouch app can only run on Mac and
>> Linux, right? (Not that I like or even support Windoze, but I assume
>> many users of a desktop-based application using CouchDB will...)
> I haven't looked into LivelyCouch, but AFAIK node.js is a server-side thing, so I guess app end users can run whatever OS they like. If LivelyCouch is about using node.js on the client side of things, then I might be wrong. :o)
>
> Nils.
> ------------------------------------------------------------------------
>   VPRO
>   phone:  +31(0)356712911
>   e-mail: info@vpro.nl
>   web:    www.vpro.nl
> ------------------------------------------------------------------------

Re: LivelyCouch - a framework around CouchDB and Node.js

Posted by Nils Breunese <N....@vpro.nl>.
Florian Leitner wrote:

> As I never used node.js, I gave it a look just now - and found
> something rather worrying with respect to my needs: node.js does not
> support Windows (natively, only via Cygwin), and after checking their
> mailing list, it seems the developers behind node.js are not planning
> any support for it, either - and not even much for their "Cygwin
> port". So, essentially, a LivelyCouch app can only run on Mac and
> Linux, right? (Not that I like or even support Windoze, but I assume
> many users of a desktop-based application using CouchDB will...)

I haven't looked into LivelyCouch, but AFAIK node.js is a server-side thing, so I guess app end users can run whatever OS they like. If LivelyCouch is about using node.js on the client side of things, then I might be wrong. :o)

Nils.
------------------------------------------------------------------------
 VPRO
 phone:  +31(0)356712911
 e-mail: info@vpro.nl
 web:    www.vpro.nl
------------------------------------------------------------------------

Re: LivelyCouch - a framework around CouchDB and Node.js

Posted by Mirko Kiefer <mi...@arcor.de>.
Hi Florian,

running LivelyCouch on the client-side is an option, but as you say only 
possible with Cygwin on Windows.
Our main intention with LivelyCouch is to use it as a server-side thing. 
If you would run an app on the server you would only have one site to 
speak to as LivelyCouch runs behind CouchDB using it as a proxy.

If you plan to use CouchDB on the client anyway, you may think about 
combining both. As you can't do cross-site request from the browser you 
could for example use CouchDB's replication to "communicate" to your server.
You could for example have a "message" database on your client that gets 
continuously replicated to the server.
On the server you could then use LivelyCouch with a changelistener that 
triggers some actions whenever new documents arrive...
Don't know your use case so maybe that doesn't make sense to you.

Mirko

On 12/10/10 3:42 AM, Florian Leitner wrote:
> Hi Mirko,
>
> As I never used node.js, I gave it a look just now - and found
> something rather worrying with respect to my needs: node.js does not
> support Windows (natively, only via Cygwin), and after checking their
> mailing list, it seems the developers behind node.js are not planning
> any support for it, either - and not even much for their "Cygwin
> port". So, essentially, a LivelyCouch app can only run on Mac and
> Linux, right? (Not that I like or even support Windoze, but I assume
> many users of a desktop-based application using CouchDB will...)
>
> --Florian
>
> On 10 December 2010 02:53, Florian Leitner<fl...@gmail.com>  wrote:
>> Hi Mirko,
>>
>> Your project sounds pretty much exactly like what I am looking for; I
>> have posted an issue about my cross-site XHR requests for the
>> couch-based application I am about to develop in a recent post
>> ("CouchDB/App, XHR, and the JavaScript Same Origin Policy"). So, if I
>> understand what you propose on the LivelyCouch website, this would
>> _exactly_ solve my issues, right? Because of using node.js as
>> "man-in-the-middle" between the browser and the CouchDB, I can do any
>> XHR to any site without having to think about Same Origin
>> Policy-stuff. On the other hand, because a LivelyCouch app is fully
>> stored inside CouchDB, installing (replicating) and updating
>> (synchronizing) such an app stays as trivial as it is with CouchApp.
>> Is this correct?
>>
>> Thanks,
>> Florian
>>
>> On 7 December 2010 18:55, Mirko Kiefer<mi...@arcor.de>  wrote:
>>> Hey,
>>> we've been heavily working on getting LivelyCouch to a usable state for the
>>> CouchDB and Node.js community.
>>> You can now find the source and a first tutorial on the project site:
>>> http://www.livelycouch.org
>>>
>>> A second more advanced tutorial will follow tomorrow. Mikeal, if you don't
>>> mind I will borrow your e-mail outbox scenario from the js conference in
>>> Berlin - it suits perfectly as a LivelyCouch use case :)
>>>
>>> Best,
>>> Mirko
>>>
>>> On 11/8/10 11:11 PM, Mikeal Rogers wrote:
>>>> Yeah, this stuff is amazing because it implements things that were in my
>>>> head and I didn't write it :)
>>>>
>>>> I'm super happy right now ;)
>>>>
>>>> On Mon, Nov 8, 2010 at 2:09 PM, Gabriel Farrell<gs...@gmail.com>    wrote:
>>>>
>>>>> Neat. I look forward to both using the framework and learning from its
>>>>> use of externals and http proxy modules. Comments:
>>>>>
>>>>> Because the handlers are similar to views, I'm tempted to want them in
>>>>> my design documents. Would it be possible to read them from a
>>>>> "handlers" value there?
>>>>>
>>>>> I think that URL example at the end of Part 1 should be
>>>>> "filtered_people" instead of "blond_people".
>>>>>
>>>>> I like the way Mikeal talked about triggering events in his "Crazy
>>>>> Delicious" talk at JSConf by giving each trigger its own document,
>>>>> firing events off a long poll of _changes, then updating that document
>>>>> with event responses. How would LivelyCouch notify an app with event
>>>>> responses?
>>>>>
>>>>>
>>>>> Gabriel
>>>>>
>>>>> On Mon, Nov 8, 2010 at 4:24 PM, Mirko Kiefer<mi...@arcor.de>
>>>>> wrote:
>>>>>> Hi,
>>>>>> we are currently working on open sourcing our so called LivelyCouch
>>>>>> framework which emerged out of a few projects.
>>>>>> Hopefully this week still we will have a website up and running
>>>>> explaining
>>>>>> the usage of LivelyCouch in more detail.
>>>>>> I would just like to get some early feedback on our concepts - so I
>>>>>> wrote
>>>>> a
>>>>>> little summary in two parts on my blog.
>>>>>>
>>>>>> The first part focuses on writing Node.js handlers:
>>>>>>
>>>>> http://mirkokiefer.com/blog/2010/11/introducing-livelycouch-part-1-writing-node-js-handler/
>>>>>> Part two explains the event system we built around CouchDB using Node:
>>>>>>
>>>>> http://mirkokiefer.com/blog/2010/11/introducing-livelycouch-part-2-events-and-workers/
>>>>>> Hope to get a lot of feedback!
>>>>>>
>>>>>> Mirko
>>>>>>

Re: LivelyCouch - a framework around CouchDB and Node.js

Posted by Florian Leitner <fl...@gmail.com>.
Hi Mirko,

As I never used node.js, I gave it a look just now - and found
something rather worrying with respect to my needs: node.js does not
support Windows (natively, only via Cygwin), and after checking their
mailing list, it seems the developers behind node.js are not planning
any support for it, either - and not even much for their "Cygwin
port". So, essentially, a LivelyCouch app can only run on Mac and
Linux, right? (Not that I like or even support Windoze, but I assume
many users of a desktop-based application using CouchDB will...)

--Florian

On 10 December 2010 02:53, Florian Leitner <fl...@gmail.com> wrote:
> Hi Mirko,
>
> Your project sounds pretty much exactly like what I am looking for; I
> have posted an issue about my cross-site XHR requests for the
> couch-based application I am about to develop in a recent post
> ("CouchDB/App, XHR, and the JavaScript Same Origin Policy"). So, if I
> understand what you propose on the LivelyCouch website, this would
> _exactly_ solve my issues, right? Because of using node.js as
> "man-in-the-middle" between the browser and the CouchDB, I can do any
> XHR to any site without having to think about Same Origin
> Policy-stuff. On the other hand, because a LivelyCouch app is fully
> stored inside CouchDB, installing (replicating) and updating
> (synchronizing) such an app stays as trivial as it is with CouchApp.
> Is this correct?
>
> Thanks,
> Florian
>
> On 7 December 2010 18:55, Mirko Kiefer <mi...@arcor.de> wrote:
>> Hey,
>> we've been heavily working on getting LivelyCouch to a usable state for the
>> CouchDB and Node.js community.
>> You can now find the source and a first tutorial on the project site:
>> http://www.livelycouch.org
>>
>> A second more advanced tutorial will follow tomorrow. Mikeal, if you don't
>> mind I will borrow your e-mail outbox scenario from the js conference in
>> Berlin - it suits perfectly as a LivelyCouch use case :)
>>
>> Best,
>> Mirko
>>
>> On 11/8/10 11:11 PM, Mikeal Rogers wrote:
>>>
>>> Yeah, this stuff is amazing because it implements things that were in my
>>> head and I didn't write it :)
>>>
>>> I'm super happy right now ;)
>>>
>>> On Mon, Nov 8, 2010 at 2:09 PM, Gabriel Farrell<gs...@gmail.com>  wrote:
>>>
>>>> Neat. I look forward to both using the framework and learning from its
>>>> use of externals and http proxy modules. Comments:
>>>>
>>>> Because the handlers are similar to views, I'm tempted to want them in
>>>> my design documents. Would it be possible to read them from a
>>>> "handlers" value there?
>>>>
>>>> I think that URL example at the end of Part 1 should be
>>>> "filtered_people" instead of "blond_people".
>>>>
>>>> I like the way Mikeal talked about triggering events in his "Crazy
>>>> Delicious" talk at JSConf by giving each trigger its own document,
>>>> firing events off a long poll of _changes, then updating that document
>>>> with event responses. How would LivelyCouch notify an app with event
>>>> responses?
>>>>
>>>>
>>>> Gabriel
>>>>
>>>> On Mon, Nov 8, 2010 at 4:24 PM, Mirko Kiefer<mi...@arcor.de>
>>>> wrote:
>>>>>
>>>>> Hi,
>>>>> we are currently working on open sourcing our so called LivelyCouch
>>>>> framework which emerged out of a few projects.
>>>>> Hopefully this week still we will have a website up and running
>>>>
>>>> explaining
>>>>>
>>>>> the usage of LivelyCouch in more detail.
>>>>> I would just like to get some early feedback on our concepts - so I
>>>>> wrote
>>>>
>>>> a
>>>>>
>>>>> little summary in two parts on my blog.
>>>>>
>>>>> The first part focuses on writing Node.js handlers:
>>>>>
>>>>
>>>> http://mirkokiefer.com/blog/2010/11/introducing-livelycouch-part-1-writing-node-js-handler/
>>>>>
>>>>> Part two explains the event system we built around CouchDB using Node:
>>>>>
>>>>
>>>> http://mirkokiefer.com/blog/2010/11/introducing-livelycouch-part-2-events-and-workers/
>>>>>
>>>>> Hope to get a lot of feedback!
>>>>>
>>>>> Mirko
>>>>>
>>
>

Re: LivelyCouch - a framework around CouchDB and Node.js

Posted by Florian Leitner <fl...@gmail.com>.
Hi Mirko,

Your project sounds pretty much exactly like what I am looking for; I
have posted an issue about my cross-site XHR requests for the
couch-based application I am about to develop in a recent post
("CouchDB/App, XHR, and the JavaScript Same Origin Policy"). So, if I
understand what you propose on the LivelyCouch website, this would
_exactly_ solve my issues, right? Because of using node.js as
"man-in-the-middle" between the browser and the CouchDB, I can do any
XHR to any site without having to think about Same Origin
Policy-stuff. On the other hand, because a LivelyCouch app is fully
stored inside CouchDB, installing (replicating) and updating
(synchronizing) such an app stays as trivial as it is with CouchApp.
Is this correct?

Thanks,
Florian

On 7 December 2010 18:55, Mirko Kiefer <mi...@arcor.de> wrote:
> Hey,
> we've been heavily working on getting LivelyCouch to a usable state for the
> CouchDB and Node.js community.
> You can now find the source and a first tutorial on the project site:
> http://www.livelycouch.org
>
> A second more advanced tutorial will follow tomorrow. Mikeal, if you don't
> mind I will borrow your e-mail outbox scenario from the js conference in
> Berlin - it suits perfectly as a LivelyCouch use case :)
>
> Best,
> Mirko
>
> On 11/8/10 11:11 PM, Mikeal Rogers wrote:
>>
>> Yeah, this stuff is amazing because it implements things that were in my
>> head and I didn't write it :)
>>
>> I'm super happy right now ;)
>>
>> On Mon, Nov 8, 2010 at 2:09 PM, Gabriel Farrell<gs...@gmail.com>  wrote:
>>
>>> Neat. I look forward to both using the framework and learning from its
>>> use of externals and http proxy modules. Comments:
>>>
>>> Because the handlers are similar to views, I'm tempted to want them in
>>> my design documents. Would it be possible to read them from a
>>> "handlers" value there?
>>>
>>> I think that URL example at the end of Part 1 should be
>>> "filtered_people" instead of "blond_people".
>>>
>>> I like the way Mikeal talked about triggering events in his "Crazy
>>> Delicious" talk at JSConf by giving each trigger its own document,
>>> firing events off a long poll of _changes, then updating that document
>>> with event responses. How would LivelyCouch notify an app with event
>>> responses?
>>>
>>>
>>> Gabriel
>>>
>>> On Mon, Nov 8, 2010 at 4:24 PM, Mirko Kiefer<mi...@arcor.de>
>>> wrote:
>>>>
>>>> Hi,
>>>> we are currently working on open sourcing our so called LivelyCouch
>>>> framework which emerged out of a few projects.
>>>> Hopefully this week still we will have a website up and running
>>>
>>> explaining
>>>>
>>>> the usage of LivelyCouch in more detail.
>>>> I would just like to get some early feedback on our concepts - so I
>>>> wrote
>>>
>>> a
>>>>
>>>> little summary in two parts on my blog.
>>>>
>>>> The first part focuses on writing Node.js handlers:
>>>>
>>>
>>> http://mirkokiefer.com/blog/2010/11/introducing-livelycouch-part-1-writing-node-js-handler/
>>>>
>>>> Part two explains the event system we built around CouchDB using Node:
>>>>
>>>
>>> http://mirkokiefer.com/blog/2010/11/introducing-livelycouch-part-2-events-and-workers/
>>>>
>>>> Hope to get a lot of feedback!
>>>>
>>>> Mirko
>>>>
>

Re: LivelyCouch - a framework around CouchDB and Node.js

Posted by Mirko Kiefer <mi...@arcor.de>.
Hey,
we've been heavily working on getting LivelyCouch to a usable state for 
the CouchDB and Node.js community.
You can now find the source and a first tutorial on the project site:
http://www.livelycouch.org

A second more advanced tutorial will follow tomorrow. Mikeal, if you 
don't mind I will borrow your e-mail outbox scenario from the js 
conference in Berlin - it suits perfectly as a LivelyCouch use case :)

Best,
Mirko

On 11/8/10 11:11 PM, Mikeal Rogers wrote:
> Yeah, this stuff is amazing because it implements things that were in my
> head and I didn't write it :)
>
> I'm super happy right now ;)
>
> On Mon, Nov 8, 2010 at 2:09 PM, Gabriel Farrell<gs...@gmail.com>  wrote:
>
>> Neat. I look forward to both using the framework and learning from its
>> use of externals and http proxy modules. Comments:
>>
>> Because the handlers are similar to views, I'm tempted to want them in
>> my design documents. Would it be possible to read them from a
>> "handlers" value there?
>>
>> I think that URL example at the end of Part 1 should be
>> "filtered_people" instead of "blond_people".
>>
>> I like the way Mikeal talked about triggering events in his "Crazy
>> Delicious" talk at JSConf by giving each trigger its own document,
>> firing events off a long poll of _changes, then updating that document
>> with event responses. How would LivelyCouch notify an app with event
>> responses?
>>
>>
>> Gabriel
>>
>> On Mon, Nov 8, 2010 at 4:24 PM, Mirko Kiefer<mi...@arcor.de>
>> wrote:
>>> Hi,
>>> we are currently working on open sourcing our so called LivelyCouch
>>> framework which emerged out of a few projects.
>>> Hopefully this week still we will have a website up and running
>> explaining
>>> the usage of LivelyCouch in more detail.
>>> I would just like to get some early feedback on our concepts - so I wrote
>> a
>>> little summary in two parts on my blog.
>>>
>>> The first part focuses on writing Node.js handlers:
>>>
>> http://mirkokiefer.com/blog/2010/11/introducing-livelycouch-part-1-writing-node-js-handler/
>>> Part two explains the event system we built around CouchDB using Node:
>>>
>> http://mirkokiefer.com/blog/2010/11/introducing-livelycouch-part-2-events-and-workers/
>>> Hope to get a lot of feedback!
>>>
>>> Mirko
>>>

Re: LivelyCouch - a framework around CouchDB and Node.js

Posted by Mirko Kiefer <mi...@arcor.de>.
Great to hear that - we will hopefully manage to bring out the source, 
soon. Any help on bringing this forward will then be welcome ;)

On 11/8/10 11:11 PM, Mikeal Rogers wrote:
> Yeah, this stuff is amazing because it implements things that were in my
> head and I didn't write it :)
>
> I'm super happy right now ;)
>
> On Mon, Nov 8, 2010 at 2:09 PM, Gabriel Farrell<gs...@gmail.com>  wrote:
>
>> Neat. I look forward to both using the framework and learning from its
>> use of externals and http proxy modules. Comments:
>>
>> Because the handlers are similar to views, I'm tempted to want them in
>> my design documents. Would it be possible to read them from a
>> "handlers" value there?
>>
>> I think that URL example at the end of Part 1 should be
>> "filtered_people" instead of "blond_people".
>>
>> I like the way Mikeal talked about triggering events in his "Crazy
>> Delicious" talk at JSConf by giving each trigger its own document,
>> firing events off a long poll of _changes, then updating that document
>> with event responses. How would LivelyCouch notify an app with event
>> responses?
>>
>>
>> Gabriel
>>
>> On Mon, Nov 8, 2010 at 4:24 PM, Mirko Kiefer<mi...@arcor.de>
>> wrote:
>>> Hi,
>>> we are currently working on open sourcing our so called LivelyCouch
>>> framework which emerged out of a few projects.
>>> Hopefully this week still we will have a website up and running
>> explaining
>>> the usage of LivelyCouch in more detail.
>>> I would just like to get some early feedback on our concepts - so I wrote
>> a
>>> little summary in two parts on my blog.
>>>
>>> The first part focuses on writing Node.js handlers:
>>>
>> http://mirkokiefer.com/blog/2010/11/introducing-livelycouch-part-1-writing-node-js-handler/
>>> Part two explains the event system we built around CouchDB using Node:
>>>
>> http://mirkokiefer.com/blog/2010/11/introducing-livelycouch-part-2-events-and-workers/
>>> Hope to get a lot of feedback!
>>>
>>> Mirko
>>>

Re: LivelyCouch - a framework around CouchDB and Node.js

Posted by Mikeal Rogers <mi...@gmail.com>.
Yeah, this stuff is amazing because it implements things that were in my
head and I didn't write it :)

I'm super happy right now ;)

On Mon, Nov 8, 2010 at 2:09 PM, Gabriel Farrell <gs...@gmail.com> wrote:

> Neat. I look forward to both using the framework and learning from its
> use of externals and http proxy modules. Comments:
>
> Because the handlers are similar to views, I'm tempted to want them in
> my design documents. Would it be possible to read them from a
> "handlers" value there?
>
> I think that URL example at the end of Part 1 should be
> "filtered_people" instead of "blond_people".
>
> I like the way Mikeal talked about triggering events in his "Crazy
> Delicious" talk at JSConf by giving each trigger its own document,
> firing events off a long poll of _changes, then updating that document
> with event responses. How would LivelyCouch notify an app with event
> responses?
>
>
> Gabriel
>
> On Mon, Nov 8, 2010 at 4:24 PM, Mirko Kiefer <mi...@arcor.de>
> wrote:
> > Hi,
> > we are currently working on open sourcing our so called LivelyCouch
> > framework which emerged out of a few projects.
> > Hopefully this week still we will have a website up and running
> explaining
> > the usage of LivelyCouch in more detail.
> > I would just like to get some early feedback on our concepts - so I wrote
> a
> > little summary in two parts on my blog.
> >
> > The first part focuses on writing Node.js handlers:
> >
> http://mirkokiefer.com/blog/2010/11/introducing-livelycouch-part-1-writing-node-js-handler/
> >
> > Part two explains the event system we built around CouchDB using Node:
> >
> http://mirkokiefer.com/blog/2010/11/introducing-livelycouch-part-2-events-and-workers/
> >
> > Hope to get a lot of feedback!
> >
> > Mirko
> >
>

Re: LivelyCouch - a framework around CouchDB and Node.js

Posted by Gabriel Farrell <gs...@gmail.com>.
On Mon, Nov 8, 2010 at 5:45 PM, Mirko Kiefer <mi...@arcor.de> wrote:
> Moving the handlers to design documents shouldn't be a problem.
> You would then probably want to call a URL like:
> http://127.0.0.1:5984/_handler/yourdb/_design/designdoc/handlername
>
> We decided to have a separate handler DB as one of our main motivations was
> to be able to do requests across databases. Also, at the moment we
> constantly keep a worker running who writes out handler code to the file
> system everytime it changes. Handlers are then executed from there. If you
> split your handler code across databases you would have to listen to changes
> on each of them.
> The reason we write out the code is that we couldn't find an easy solution
> to handle dependencies of your handler - if you do a "require" in your node
> code, the required file needs to be found.

Those reasons are sound. Awesome that the system has the flexibility
to handle different setups, too.

> I haven't seen Mikeal's talk but going to have a look right now.
> Not sure if I understand you right - in LivelyCouch you could do something
> like:
> - have a Worker running who listens on _changes of a database
> - when a change happens the worker would send out a message
> - other Workers could be triggered by this depending of your definition in
> the Event documents

Sounds like LivelyCouch also has the flexibility to handle what I was
thinking here. The example Mikeal gives is email, where a changed or
new document in _changes signals that an email should be sent. After
the email is sent, node would then update that same document to signal
that the email had been sent.


> On 11/8/10 11:09 PM, Gabriel Farrell wrote:
>>
>> Neat. I look forward to both using the framework and learning from its
>> use of externals and http proxy modules. Comments:
>>
>> Because the handlers are similar to views, I'm tempted to want them in
>> my design documents. Would it be possible to read them from a
>> "handlers" value there?
>>
>> I think that URL example at the end of Part 1 should be
>> "filtered_people" instead of "blond_people".
>>
>> I like the way Mikeal talked about triggering events in his "Crazy
>> Delicious" talk at JSConf by giving each trigger its own document,
>> firing events off a long poll of _changes, then updating that document
>> with event responses. How would LivelyCouch notify an app with event
>> responses?
>>
>>
>> Gabriel
>>
>> On Mon, Nov 8, 2010 at 4:24 PM, Mirko Kiefer<mi...@arcor.de>
>>  wrote:
>>>
>>> Hi,
>>> we are currently working on open sourcing our so called LivelyCouch
>>> framework which emerged out of a few projects.
>>> Hopefully this week still we will have a website up and running
>>> explaining
>>> the usage of LivelyCouch in more detail.
>>> I would just like to get some early feedback on our concepts - so I wrote
>>> a
>>> little summary in two parts on my blog.
>>>
>>> The first part focuses on writing Node.js handlers:
>>>
>>> http://mirkokiefer.com/blog/2010/11/introducing-livelycouch-part-1-writing-node-js-handler/
>>>
>>> Part two explains the event system we built around CouchDB using Node:
>>>
>>> http://mirkokiefer.com/blog/2010/11/introducing-livelycouch-part-2-events-and-workers/
>>>
>>> Hope to get a lot of feedback!
>>>
>>> Mirko
>>>
>

Re: LivelyCouch - a framework around CouchDB and Node.js

Posted by Mirko Kiefer <mi...@arcor.de>.
Hi Gabriel,
yes I meant "filtered_people" :)

Moving the handlers to design documents shouldn't be a problem.
You would then probably want to call a URL like:
http://127.0.0.1:5984/_handler/yourdb/_design/designdoc/handlername

We decided to have a separate handler DB as one of our main motivations 
was to be able to do requests across databases. Also, at the moment we 
constantly keep a worker running who writes out handler code to the file 
system everytime it changes. Handlers are then executed from there. If 
you split your handler code across databases you would have to listen to 
changes on each of them.
The reason we write out the code is that we couldn't find an easy 
solution to handle dependencies of your handler - if you do a "require" 
in your node code, the required file needs to be found.

I haven't seen Mikeal's talk but going to have a look right now.
Not sure if I understand you right - in LivelyCouch you could do 
something like:
- have a Worker running who listens on _changes of a database
- when a change happens the worker would send out a message
- other Workers could be triggered by this depending of your definition 
in the Event documents

Mirko

On 11/8/10 11:09 PM, Gabriel Farrell wrote:
> Neat. I look forward to both using the framework and learning from its
> use of externals and http proxy modules. Comments:
>
> Because the handlers are similar to views, I'm tempted to want them in
> my design documents. Would it be possible to read them from a
> "handlers" value there?
>
> I think that URL example at the end of Part 1 should be
> "filtered_people" instead of "blond_people".
>
> I like the way Mikeal talked about triggering events in his "Crazy
> Delicious" talk at JSConf by giving each trigger its own document,
> firing events off a long poll of _changes, then updating that document
> with event responses. How would LivelyCouch notify an app with event
> responses?
>
>
> Gabriel
>
> On Mon, Nov 8, 2010 at 4:24 PM, Mirko Kiefer<mi...@arcor.de>  wrote:
>> Hi,
>> we are currently working on open sourcing our so called LivelyCouch
>> framework which emerged out of a few projects.
>> Hopefully this week still we will have a website up and running explaining
>> the usage of LivelyCouch in more detail.
>> I would just like to get some early feedback on our concepts - so I wrote a
>> little summary in two parts on my blog.
>>
>> The first part focuses on writing Node.js handlers:
>> http://mirkokiefer.com/blog/2010/11/introducing-livelycouch-part-1-writing-node-js-handler/
>>
>> Part two explains the event system we built around CouchDB using Node:
>> http://mirkokiefer.com/blog/2010/11/introducing-livelycouch-part-2-events-and-workers/
>>
>> Hope to get a lot of feedback!
>>
>> Mirko
>>

Re: LivelyCouch - a framework around CouchDB and Node.js

Posted by Gabriel Farrell <gs...@gmail.com>.
Neat. I look forward to both using the framework and learning from its
use of externals and http proxy modules. Comments:

Because the handlers are similar to views, I'm tempted to want them in
my design documents. Would it be possible to read them from a
"handlers" value there?

I think that URL example at the end of Part 1 should be
"filtered_people" instead of "blond_people".

I like the way Mikeal talked about triggering events in his "Crazy
Delicious" talk at JSConf by giving each trigger its own document,
firing events off a long poll of _changes, then updating that document
with event responses. How would LivelyCouch notify an app with event
responses?


Gabriel

On Mon, Nov 8, 2010 at 4:24 PM, Mirko Kiefer <mi...@arcor.de> wrote:
> Hi,
> we are currently working on open sourcing our so called LivelyCouch
> framework which emerged out of a few projects.
> Hopefully this week still we will have a website up and running explaining
> the usage of LivelyCouch in more detail.
> I would just like to get some early feedback on our concepts - so I wrote a
> little summary in two parts on my blog.
>
> The first part focuses on writing Node.js handlers:
> http://mirkokiefer.com/blog/2010/11/introducing-livelycouch-part-1-writing-node-js-handler/
>
> Part two explains the event system we built around CouchDB using Node:
> http://mirkokiefer.com/blog/2010/11/introducing-livelycouch-part-2-events-and-workers/
>
> Hope to get a lot of feedback!
>
> Mirko
>