by Dan Steinman

Our first public release of JaxServer is now available! After completing the JaxScript prototype last year, we began work on our server-side web development platform using NodeJS. Originally JaxServer was going to be written using Rhino on the JVM. However, as Joyent's NodeJS project started to mature we discovered that we could build our dream webserver entirely in JavaScript.

Since then, the NodeJS community size and the number of modules available has exploded. Developing server-side JavaScript applications on a fast, lightweight platform is a breath of fresh air to a lot of developers. And I too believe that NodeJS could be the next major server-side web development platform. Having so many libraries and drivers available definitely makes building on a new platform more comforting. There are now no fewer than 35 frameworks for NodeJS. But what makes JaxServer stand out is it is not just a library or a template engine, it is a full-featured, tightly-integrated application server and part of an end-to-end JavaScript development environment. The way JaxServer's command line system, application container, template engine, CSS processor, logging and debugging systems work together under a common API (the "jax" core library) is very unique. Few web frameworks can claim this level of integration.

With NodeJS you typically write your application as a server:

var http = require('http');
http.createServer(function (req, res) {
	res.writeHead(200, {'Content-Type': 'text/plain'});
	res.end('Hello World\n');
}).listen(1337, "127.0.0.1");

And run it with the node executable:

node server.js

What the Jaxcore platform does is it puts your application into object that can be instantiated by JaxServer:

function Myapp() {
	jax.server.Controller.call(this, arguments, __dirname);
	this.get('/','index');
}
Myapp.prototype = new jax.server.Controller();

Myapp.prototype.index = function(request, response) {
	jax.server.sendHTML(request,response,'Hello World\n');
};

myapp can then be run on any port by setting a command line argument:

jax run myapp --port=1337

Or several can be run by using a script:

jax -e "run('myapp',1337); run('myapp',1338); run('myapp',1339)"

Then you can save the script and automate the startup and shutdown processes or perform other batch processing:

Source of start-myapp.js:
for (var i=0;i<10;i++) {
    start('myapp',1337+i)
}
quit()
jax -f start-myapp.js
Source of stop-myapp.js:
for (var i=0;i<10;i++) {
    stop('myapp',1337+i)
}
jax -f stop-myapp.js

Note: NodeJS 0.5.x is required for start() and stop() commands

JaxServer allows you to build web applications and websites in a way you may already familiar with. The way JaxServer's configuration files work is similar to Apache, but the directory structure and app deployment is more reminiscent of Tomcat. The JXP template engine is a derivative of JSP. And although the JXSS stylesheet processor is inspired by SASS, it has a completely new JavaScript/CSS hybrid syntax that is unique. The goal was to take the best ideas and conventions from other platforms and leverage all of JavaScript's strengths to produce something new.

And we have a lot more coming. Building JaxServer has laid the groundwork for how its client-side sister framework, JaxScript, needs to work. We are already building new client-server libraries and utilities than can push this platform to the next level.

So give JaxServer a try, and let us know, good or bad, what you think of it. We're still getting things set up, so we don't yet have a community forum. But for now you can always contact us directly, or find us on Twitter at @jaxcore.

We would appreciate any bug reports or security issues, they can be sent to our github repository.