Realtime data layer for web applications
Latest commit 25060c4 Jul 9, 2012 @marcuswestin Merge pull request #1 from node-migrator-bot/clean
Hi! I fixed some code for you!
Failed to load latest commit information.
engines [fix] fs.existsSync was moved to fs.existsSync Jul 7, 2012
Changelog Changelog for client-side caching Aug 19, 2011
LICENSE It's 2011\! Feb 13, 2011
package.json Merge branch 'master' of Aug 19, 2011

Run the demo

git clone git://
cd fin
sudo npm install .
sudo npm install ui
node demo/run-server.js
# Go to http://localhost:1234/


Install fin npm install fin

Run the server fin localhost 8080

Now fire up your browser to localhost/[path to fin]/demo, or try out the Key/Value API example below

Key/Value API

<script src="http://localhost:8080/fin-api.js"></script>
fin.connect(function() {
    // Create items
    fin.create({ name: 'john' }, function(friendID) {
        fin.create({ name: 'marcus' }, function(marcusID) {
            fin.set(marcusID, 'friend', friendID)

            // Observe item properties
            fin.observe(marcusID, 'name', function(mutation) { console.log("Marcus' name is", mutation.value) })
            fin.observe(marcusID, '', function(mutation) { console.log("Marcus' friend's name is", mutation.value) })

        // Mutate item properties
        var names = ['john', 'david', 'lars', 'henrik', 'johannes', 'mark']
        setInterval(function() {
            fin.set(friendID, 'name', names[Math.floor(Math.random() * names.length)])
        }, 1000 + Math.ceil(Math.random() * 3000))


<script src="http://localhost:8080/fin-models-api.js"></script>
fin.connect(function() {
    // Declare schema
        "Global": {
            "messages": { id:1, type:'List', of:'Message' }
        "Message": {
            "text": { id:1, type:'Text' },
            "from": { id:2, type:'User' }
        "User": {
            "name": { id:1, type:'Text' },
            "age":  { id:2, type:'Number' }

    // Instantiate models
    var user = new fin.models.User(1) // user with ID 1
    var message = new fin.models.Message({ text:'Hi!', from:user })

    // Observe model properties'push', function(message) { { console.log('message from', name) })
        message.text.observe(function(text) { console.log('message text is',  text) })


Fin uses pluggable engines for storage and pubsub. You can build your own engine, or use one that comes with fin.

var fin = require('fin'), engine = require('fin/engines/development')
fin.start('localhost', 8080, engine)

The "development" engine holds all data and handles subscriptions in node process memory. It's great for development since you do not need to install a storage system and a pubsub system to get started. In production, you should use a more scalable engine, e.g. the redis engine:

Install redis sudo make install-redis Start redis server redis-server Start fin server var fin = require('fin'), redisEngine = require('fin/engines/development') fin.start('', 8080, redisEngine)