Persevere is a web framework for building HTTP/RESTful web applications, and is specifically designed for Ajax-style applications that benefit from a consistent end-to-end JSON/JavaScript data and coding. Persevere is composed of several different distinct packages that coherently combine to robust framework for quickly and easily building JSON-centric web applications. Persevere's framework allows you to focus on building well-organized data models, and exposing these to your client side user interface with a minimum of effort.

See the installation page for installation instructions.

The basic usage of Persevere is to create a data model with a Perstore data model and expose it through the Pintura web stack. For example, we could write an app:

var Model = require("perstore/model").Model, DefaultStore = require("perstore/stores").DefaultStore // create a store store = new DefaultStore(); // create the data model Product = Model(store, { properties: { name: String } }); // expose the data model through Pintura's HTTP REST interface require("pintura/pintura").getDataModel = function(request){ return { Product: Product }; };

Using the example wiki as a template, we could edit the app.js with the code above. Then we could start the application (running node index.js). And then we could access the data in our database using standard HTTP methods:

GET /{model}/{id} - Gets the object with the given id from the model store.

PUT /{model}/{id} - Updates or creates object with the given id in the model store.

DELETE /{model}/{id} - Deletes the object with the given id from the model store.

POST /{model}/ - Creates or incrementally updates an object in model store.

We could then go on to add logic to our data models or switch to a different backend database (like MongoDB) in our app.js. See the Perstore documentation for more on building data models. We could also add to or edit the web stack in the index.js using Pintura.

This is a very simple condensed example of using Persevere. To get started, you may want to look at the tutorials. To learn more about the specific APIs and modules that are available, you can take a look at each of the packages that make up Persevere:

The external interface of Persevere that provides the gateway to the web is Pintura. Pintura handles HTTP and WebSocket requests, processing these requests by querying and manipulating the underlying data model. Pintura is made up of a JSGI middleware stack providing authorization, content negotiation, sessions, cross-domain access and protection, and error handling in an HTTP standards compliant manner. This package allows you to automatically expose your data model through JSON and other media types with an out-of-the-box setup that can easily be customized for specific needs.

Perstore provides a the data persistence and modeling layer of Persevere. Perstore provides several data stores that allow it connect with different backends like SQL DBs, MongoDB, CouchDB, in-memory, and others. Perstore then provides the facilities for layering data models on top of these stores that enforce data integrity constraints and adds model logic.

Resource Query Language (RQL) is the query language used by Persevere, and is designed specifically for use in querying JSON-oriented DBs through URLs. The documentation

Promised-IO provides a promise-based library with cross-platform access to file, network, and other OS IO facilities through a consistent API. Promised-IO provides a promise module for working with promises with various convenience utility functions. Promised-IO normalizes the access to IO for Rhino and NodeJS, making it possible to build applications that run on both platforms.

Tunguska is a comet-based distributed publish/subscribe hub and enables building applications around a pubsub paradigm with real-time message delivery to browsers. This is used by Pintura to send data in real-time to clients.

Patr is a promise-based testing framework that is used by Persevere.

JSGI-Node is a JSGI container for Node, providing efficient asynchronous execution of Pintura's JSGI middleware stack.

Templify is a templating tool for generating HTML from data objects.

The source code and bug trackers for these packages are available here.

Documentation for Persevere 1.0 is available here.