So I have been reading all about the new things in D8. While these don't seeeeem to be things I need, I am curious as to how they fit together. Just want to understand it a bit better.

Having a bit of trouble picturing it.

MySQL -> Drupal -> Backbone.js

So would Drupal sit between the app you make with Backbone or is Backbone part of what Drupal outputs (or both) ???

Can I make a single page app with backbone, and Drupal provides all the things Drupal does like user mangement, Roles, ect..??

Could your backbone apps be inside a Drupal page?

Sorry if these are stupid questions...


Sam Moore’s picture

Not stupid at all - in fact very timely.
For myself, I envision using Drupal as the admin interface for creating and managing content which can be served to users in a backbone.js app. In this scenario, Drupal content would be delivered as JSON in response to requests from backbone.

The big difference between this and the way that Drupal's been used up to now, is that the whole theming/display process would happen at the client side (using one of the theming engines like mustache etc) and Drupal would just be supplying the data. This makes for fast transfers, especially in bandwidth-constrained environments like phones. Instead of pushing fully-formed HTML pages with CSS and JS, or even parts of pages in AJAX, you're just pushing JSON packets.

But the content management experience - creating content, approval and editorial workflow, user management, access control, etc etc etc - which Drupal IMHO is really good at - stays on the Drupal side.

Go have a look on the Drupalcon Portland website - there are some resources there about this.

socceronly’s picture


Does a backbone.js app have to be single page?

Can it exist in a node or a block surrounded by 'regular' Drupal output?

I am excited about learning this stuff over learning Drupal 7

Sam Moore’s picture

I think there's a lot of flexibility. Since you can put JS widgets into blocks (e.g. ChipIn etc.) why not a backbone app?
Backbone can do multiple "pages" - in the MVC paradigm, there's a thing called a router that's specifically designed to match URLs with functions. Now, there may never be an HTML doc on your filesystem corresponding to a given "page", but that doesn't mean it can't LOOK like a page in the app interface.
So even if users are still thinking in terms of pages, 'cause that's what we've been used to for nearly 20 years now, you still get the responsiveness of not having to load up a bunch of HTML every time a user clicks a button.