node package manager
Don’t reinvent the wheel. Reuse code within your team. Create a free org »



Encapsulate form validation definitions in objects, using the excellent validator module to handle the actual validation and casting.

I missed the form definition pattern Python has adapted with libraries like and wtforms. Being able to declare form schema's in one place, and being able to trust in your controller code that what you're dealing with has already been validate and cast the way you want is pretty great. forro adds these niceties to Javascript land.

Build Status


var express = require("express"),
    app = express(),
    forro = require('forro'),
    StringField = forro.StringField,
    BooleanField = forro.BooleanField,
    DateField = forro.DateField;

// ... some code

var AuthForm = forro({
    'username': StringField.required().max(32),
    'password': StringField.required().length(4, 25),
    'remember_me': BooleanField
});"/login", AuthForm.middleware(), function(req, res){
    // Middleware already validated for us
    // and sent back a 400 error if validation failed.
    // now we can just call out authentication function with
    // req.form.val('username') and req.form.val('password')

 var BookmarkForm = forro({
    'url': StringField.required().url(),
    'tags': StringField.required().use(function tokenize(str){
        return str.split(',').map(function(s){
            return s.trim().toLowerCase();
            return s.length > 0;
    'created_on': DateField.default(
});"/bookmark", BookmarkForm.middleware(), function(req, res){
    saveBookmark(req.form.val('url'), req.form.val('tags'), req.form.val('created_on'), function(err, bookmark){
        if(err) return next(err);

// ... some more code


 npm install forro


git clone
npm install