Skip to content


Subversion checkout URL

You can clone with
Download ZIP
fauna client library for javascript
CoffeeScript Ruby
tree: 474ab2166b

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.


This is a client library for using the fauna service (

It's written in coffeescript and node, but it compiles to javascript, and is explicitly written to work in (modern) browsers. It does this primarily by using the 'request' library ( for HTTP inside node, and 'browser-request' ( inside a browser.

All API calls use the standard Q futures library (

The packaging assumes you use browserify, or something very similar.


This library is currently incomplete, and only implements the features I need for the redpanda project. I intend to end up with a complete implementation of the fauna v1 API, so please file an issue or contact me (Twitter & email below) if you have suggestions, bug reports, or patches.

Fauna works with "classes" and "instances" which should map to "models" and "objects" in your app. To define a model, describe a schema with the fields you intend to store in the database, and mark each field as being data or a reference:

fauna = require("fauna-js")

Schema = {
  messages: {
    author: fauna.Reference,
    body: fauna.Data
  users: {
    email: fauna.Data

When decoding objects from the fauna servers, items with class "messages" will be decoded from a json object like this:

"classes/messages/29192553537470464": {
  "ref" : "classes/messages/29192553537470464",
  "class" : "classes/messages",
  "ts" : 1364099038540000,
  "references": {
    "author" : "users/29183911200292864"
  "data" : {
    "body" : "meet me on bernal hill!"

to an object like this:

  meta: {
    id: "classes/messages/29192553537470464",
    className: "messages",
    ts: Sat Mar 23 2013 21:23:58 GMT-0700 (PDT)
  author: {
    meta: { ... },
    email: ""
  body: "meet me on bernal hill!"


Apache 2 license, included in 'LICENSE.txt'.


@robey - Robey Pointer

Something went wrong with that request. Please try again.