Six months with Spine.js

I have spent the last six months on a project where we are using Spine.js as one of the main technologies. Spine is a JavaScript library that allows you to build client-side-heavy applications with the MVC pattern using CoffeeScript.

Coming into this project I had a fair amount of experience building client-side-heavy applications – my previous project was built using the JavaScriptMVC library so I was very aware of all the possible difficulties in using a library like this.

Overall I have been very impressed with Spine – there is definitely a steep learning curve (especially if you’re doing TDD), but it’s a fantastic framework to work with and once you understand the underlying concepts it becomes very powerful and actually quite easy to work with.

The MVC Pattern

The models and controllers are very similar to their Rails counterparts. I especially like the interaction with the models – the data storage and optimistic persistence really feels familiar if you’re coming from Rails.

Integrating with Rails is also very straightforward and Spine has some great conventions that makes all the persistence and data retrieval very easy. In fact, if you stick to all the Spine conventions you wouldn’t need to write any custom AJAX calls.


This is definitely my favorite feature. I have used some JavaScript testing tools before, but it’s always been very difficult to do any kind of effective unit testing and TDD was completely out of the question. On this project we’re using Jasmine and all our JavaScript is unit tested. I’ve definitely been very impressed with the overall testability and it eliminates the usual maintenance nightmare you encounter with large JavaScript projects.


Spine is written in CoffeeScript, but it doesn’t necessarily mean you need to use CoffeeScript to develop your applications. We chose CoffeeScript over JavaScript and it has definitely worked very well for us – it is simply much more powerful and really decreases the amount of boilerplate code you need to write.


Spine is a pretty lightweight framework – the core is only 7K, which is really nice. However, it does mean that you need to depend on other libraries for some of the features you’re going to need. For example, you’ll probably need to use jQuery templating to render your views (even the the example that come with Spine uses this).

There are also some features that don’t exist at all – for example, there doesn’t seem to be any support for partial views. We implemented this ourselves, but it seems to be a reasonably common use case. I would also like to see better support for view helpers – Spine does support this, but it’s not really a first class citizen like it is in Rails.

Asynchronous Interfaces

One of the ‘core values’ of Spine is to take advantage of the asynchronous nature of JavaScript – to this end Spine stores and renders everything client-side and simply ignores pending server requests. The result is that the user interface is lightning fast and very responsive. Spine takes care of updating all the client-side data once the server request completes, but all of this is invisible ot the user. All of this leads to a great user experience.

I was very sceptical of the overall convention – especially the optimistic persistence – but after using it for a while it becomes second nature.


Spine.js is definitely a fantastic framework in my opinion and I would highly recommend it to anyone. The conventions make it easy to create a great user experience and the testability makes for a highly maintainable solution.

Happy coding.