Reusable models in the client and the server

Fork me on GitHub

Invisible.js works on top of your express app leveraging browserify to allow your domain models to work seamlessly in the client and the server.

Invisible = require("invisible");
crypto = require("crypto");
_s = require("underscore.string");

function Person(firstName, lastName, email){
    this.firstName = firstName;
    this.lastName = lastName; = email;

Person.prototype.fullName = function(){
    return this.firstName + ' ' + this.lastName;

Person.prototype.getAvatarUrl = function(){
    cleanMail = _s.trim(;
    hash = crypto.createHash("md5").update(cleanMail).digest("hex");
    return "" + hash;

module.exports = Invisible.createModel("Person", Person);

Require as usual in the server:

Invisible = require("invisible")
john = new Invisible.Person("John", "Doe", "");
john.fullName(); //John Doe

In the client, just add the invisible script:

<script src="invisible.js"></script>
    jane = new Invisible.Person("Jane", "Doe", "");
    alert(jane.fullName()); //Jane Doe

VoilĂ ! Restful API, MongoDB persistence, client and server validations and real-time events all come for free! See the github project for a full reference.