Jay Sylvester
Node.js · Open source · MIT

citizen

An MVC-based web application framework designed for people interested in quickly building fast, scalable web sites instead of digging around Node's guts or cobbling together a wobbly Jenga tower made out of 50 different packages.

Use citizen as the foundation for a traditional server-side web application, a modular single-page application, or a RESTful API.

Philosophy

Convention over configuration, but still flexible. A citizen app is a directory of controllers, models, and views that follow a naming convention; the framework infers the routes. There is no build step, no router to register, and no assembly of a dependency graph before the first page renders.

The framework has few direct dependencies, which is the point. Routing, static serving, session management, caching, compression, form parsing, and logging are all part of the framework rather than a package each.

Code reuse happens through includes and chaining. An include is a complete MVC pattern with its own controller, model, and views, delivered to the caller as fully rendered output, so logic stays in the controller rather than the template.

Capabilities

Zero-configuration routing

SEO-friendly URLs with name/value parameters instead of query strings.

Content negotiation

HTML, JSON, JSONP, and plain text served from the same pattern.

Includes as components

Full MVC patterns used as addressable components.

Controller chaining

Chain any number of controllers in a single request.

Key/value cache

An in-memory store for requests, actions, objects, and static files.

Session management

Server-side sessions with configurable lifespan and HTTP helpers.

Hot module replacement

Development changes re-import in real time without a restart.

Application event hooks

Act on application, request, response, and session events.

Graceful error handling

Errors return in the requested format without exiting the process.

ES and CommonJS modules

Both module systems are supported.

In production

Runs this site and originaltrilogy.com, which handles a few hundred thousand views a month.

Stability

A single instance, with the process running for months at a time without crashing.

Maintenance

Sole author and maintainer since 2013, across 300+ commits and two major versions.

Documentation