Created: 2011-07-19 03:24
Updated: 2018-11-08 22:16
License: mit


An advanced modular Web Framework built on Node.

Build Status


$ npm install bricks

Super Basic Usage

Change directories into the directory that you wish to server files from:

$ bricks


Usage: bricks [--help] [--port port] [--ipaddr ipaddr] [--path path] [--log log]
    --port port     [default 8080]
    --ipaddr ipaddr [default]
    --path path     [default "."]
    --log log       [default none]

Basic Usage

var bricks = require('bricks');
var appServer = new bricks.appserver();

appServer.addRoute("/static/.+", appServer.plugins.filehandler, { basedir: "./static" });
appServer.addRoute(".+", appServer.plugins.fourohfour);
var server appServer.createServer();



Routing in bricks is based on String matches and truth values. A regular expression may be passed, as well as a function that can determine whether or not the route should be executed.

The router simplified:

if (typeof(route) === 'function') {
    var match = route(path);
    if (match) {
        return true;
} else {
    if ((typeof(route) === 'string') && path.match(route)) {
        return true;

return false;

Built-in Plugins

There are plugins that are built-in to bricks that cover basic usage. These plugins are light-weight and loaded as part of the application server. These plugins accept various options for configuration.


Default static file handler. This file handler is for basic functionality, it does not cache.

  basedir: '/path/to/files/'  // default '.'


Default 404 handler. By design, this handler simply sets the 404 status code and writes 404 Error to the requesting browser.


The default redirect handler deals with both temporary and permanent redirects. As with routes, the path can be a String, a RegExp, or a function. Redirects are sent as temporary redirects (307) unless denoted as permanent (301).

  routes: [
    { path: "^/foo$", url: "", permanent: true },
    { path: new RegExp(/\/bar\/.+/), url: "" }

Advanced Stuff

Bricks is a fully baked web application server, but a README can only contain so much information.

For more information and documentation visit

Cookies help us deliver our services. By using our services, you agree to our use of cookies Learn more