neuro

0.0.1 • Public • Published

Neuro

warning: this should be considered VERY ALPHA so don't expect it to work 100% of the time or at all

Neuro is a rapid web application development framework for Node.JS written in CoffeeScript (but accepting of both JavaScript and CoffeeScript apps). Its name comes from an analogy to Backbone.JS. Where Backbone provides the physical, tangible structure of a web application, Neuro provides its brains. Neuro bridges the gap between server-side and client-side programming by using a single language (JavaScript, or CoffeeScript if you prefer...) and sharing resources such as models and view templates between the two applications.

Usage

Currently, the best way to get a working Neuro app installed is to simply clone this repository, type npm install and begin running the generators. Start the Neuro server by typing coffee lib/neuro.coffee. There will be an installer system set up in the future so Neuro can be managed over NPM.

Philosophy

Render in the browser, process on the server

Modern web applications are increasingly leveraging Ajax to build rich, clean user interfaces that respond "naturally" and allow for incredibly intuitive experiences. Sometimes, these applications will respond poorly or not at all under high pressure situations, such as when the server is being overworked or database configuration is preventing quick reads. In situations where a previously built Ajax-driven application is performing slowly, development teams are forced to reimplement hundreds of lines of code again, but this time in an entirely different (and sometimes less feature-rich) language. This can be taxing on your team, and quite expensive to say the least.

One solution that a number of teams have leveraged is to render in the browser, and process on the server. That may sound redundant, but it really does make sense. In Neuro, when a user makes a GET request with the Content-Type: text/html header, only the layout is rendered by the server. The rest is taken care of by the client-side JavaScript, which performs another simultaneous GET request to the same resource, but this time using the header Content-Type: application/json. With this request, the client retrieves the actual data for the page, and quickly inserts such data into the proper places on the template. On some servers optimized for HTTP/1.1 Streaming, it's even possible to simultaneously load these two GET requests at once for a truly seamless web application experience.

Leverage existing technology

Neuro is familiar to Node developers because it leverages some of the same technology you're already using.

Connect middleware

The config.middleware directive allows you to fully customize the middleware stack, giving you ultimate control over the HTTP request from the time it is given to the Node server to the time it responds back to the user. The Neuro application, in fact, is just another Connect middleware, and can be run alongisde other Neuro or Express apps on the same stack.

Backbone client-side MVC

Neuro is heavily integrated with the Backbone MVC framework. In fact, Neuro models are just an extension of Backbone.Model, wrapped with direct database connectivity and some other high-level functions only available on the server side. The Backbone router is also pre-loaded with the directives from the Neuro router, giving the Backbone models immediate out-of-the-box RESTful routing and functionality. And finally, Backbone's Collection and View objects are also auto-generated based on the server-side implementation of the Controller. When you develop a Neuro application, you basically get a Backbone application for free.

Dynamic themeing with LESS and [Bootstrap][bootstrap]

Neuro will automatically compile your LESS stylesheets when the server starts and as it's running. It watches app/stylesheets for changes. You can place regular CSS files in here as well, and they will be available as static files on the server. Stylesheets can be loaded in the view layer by referencing their filename under the stylesheets/ directory (configurable in config/application.coffee with config.stylesheets_dir).

HTML templates with Eco

Neuro supports the Eco templating language for the view layer. These template files are actually loaded on the client side in the combined javascripts/application.js file.

Test-driven development with Assert and Zombie (or Jasmine)

TDD helps you build better applications. When your framework gives you a really easy way to build these tests, its much easier to get started. Neuro's test case object wraps a number of existing test frameworks like Assert and Zombie, and allows for setup/teardown functionality to be run before a set of tests and afterward (respectively).

Neuro also supports the use of Jasmine for BDD in the spec/ directory.

Rapid prototyping

It's always more fun to hack away and experiment with new ideas when your framework gives you an easy way to rapidly prototype your ideas. Code generation lets you realize these new ideas in your app with ease, and Neuro's generators will give you all the code you need for the object you're trying to create. For models, this includes unit tests, and for controllers this includes view templates, stylesheets, helper function files and integration/functional tests.

Roadmap

  • Application generator should create empty Neuro application with similar directory structure to this repo.
  • Auto-generate Backbone.Models, Backbone.Router and Backbone.Collections from the Neuro.Models and Neuro.Router.routes defined in your application. Place in javascripts/application.js
  • Compile Eco templates when the server starts. Serve all views as templates from the templates/ dir on the static server, process all data on the client side

Readme

Keywords

none

Package Sidebar

Install

npm i neuro

Weekly Downloads

15

Version

0.0.1

License

none

Last publish

Collaborators

  • tubbo