6 ms·
Introducing the Backbone.js Boilerplate
- deleted 15y ago[deleted]
- drivebyacct2 15y agoThis has been very helpful for me, learning Backbone.js: http://ricostacruz.com/backbone-patterns/ http://ricostacruz.com/backbone-patterns/
- tmcw 15y agoMight also want to check out my company's bones framework: https://github.com/developmentseed/bones https://github.com/developmentseed/bones Expressjs + Backbone, with plugins, multi-process servers, settings management, etc. It's used by large applications like our hosting service: http://tiles.mapbox.com/ http://tiles.mapbox.com/
- ews 15y agoThis looks like what I have been thinking about developing for the last few days. Thanks for sharing, it looks really interesting and it's going to save me several days of work.
- Juha 15y agoThe first time I see a company recommending to install VirtualBox and Ubuntu on it just to get the app to run on Windows. Better than saying Windows is not supported at all I guess :). Must be getting a lot of support tickets though. But it does look like interesting OSS project.
- tmcw 15y agoWe're hard at work on a native Windows port. The software was released far before node.js had any Windows compatibility, and the priority has always been to make it better in an absolute sense, and then port it when possible.
- jashkenas 15y agoI'd be curious to hear someone from Bocoup describe how this boilerplate fits in when you're already using a web framework. In Rails, or Django, or whatever, wouldn't you want to use the built-in JavaScript folder structure and asset building strategy?
- tbranyen 15y agoYou would modify the folder structure of the boilerplate to accommodate the framework. Assuming your framework does asset building as well, you can just delete the build folder.
- pacomerh 15y agoYeah, boilerplate structures based on the most popular frameworks would be cool small project and time saver. I'm gonna adopt this idea.
- danso 15y agoCodebrew has its own rails-backbone gem: https://github.com/codebrew/backbone-rails https://github.com/codebrew/backbone-rails
- ryanfitz 15y agoI'm the author of that gem. My goal with it is to really just help people get up and running with rails & backbone as quickly as possible. There are no best practices built in and I try to avoid adding any extra features that aren't needed for getting started. I'm sure you could use rails-backbone to help get off the ground and then read over the snippets from backbone-boilerplate to see where to go from there.
- ryanfitz 15y agoI'm not from Bocoup, but I want something like this to build, test, deploy the client portion of my apps and then proxy api calls to backend services.
- goblin89 15y ago
- ronreiter 15y agoHere's my boilerplate for GAE + Backbone.js + Require.js, which is very good for large scale Javascript development. https://github.com/ronreiter/webapp-boilerplate https://github.com/ronreiter/webapp-boilerplate I've seen your source code, and your build directory makes a lot of sense. I'll add it to my boilerplate as well. Thanks for your code!
- tbranyen 15y agoAwesome, its still new, so make sure you report any issues you find.
- jsavimbi 15y agoHats off to the hard-working Tim Branyen and the rest of the crew at Bocoup. Thanks for sharing!
- rralian 15y agoThis is really cool. As someone who has only a little experience with backbone, I've really been looking for a more opinionated approach to backbone.
- samstokes 15y agoNitpick: I recently began to organize this work into a _conical_ boilerplate for Backbone. I think you mean "canonical" :)
- tbranyen 15y agoFixed thank you =)
- howardr 15y agoGlad there are people spearheading discussions around backbone project organization. I agree that backbone is very powerful, but talk is just beginning on how to fit it in to current web app projects that don't fit the boostrapped-singled-html page model
- ajtaylor 15y agoYes, I too would love more information on integrating backbone into existing apps. We're adding a lot of JS at $work and I'd like to better organize it and reduce boilerplate code.
- darylteo 15y agoCommenting so I can look at this later.
- shaunxcode 15y agojust so you know, you were probably downvoted because hn approach is to upvote the story and then click your name to enter your profile and finally click "saved stories" to peruse at your leisure.
- goblin89 15y agoWhich actually is somewhat strange, as one might upvote the story only to realize at later examination that it's less fine as one originally thought. And taking back votes isn't allowed, or requires some karma.
- darylteo 15y agoI'll note this for next time. I would have preferred a "save this story" feature instead though (especially since "vote story" didn't immediately equate to "save story" for me)
- brown9-2 15y agoYou should check out instapaper or readability. Both offer browser bookmarklets for "Save for Later" functionality.
- fiznool 15y agoThis looks fantastic, especially with the integration with HTML5BP. Awesome work! Just wondering if you considered using RequireJS instead of namespacing? Backbone plays quite nicely with RequireJS if you use James Burke's version which has been forked to be compatible: https://github.com/jrburke/backbone/blob/optamd/backbone.js https://github.com/jrburke/backbone/blob/optamd/backbone.js More info here: http://jcreamerlive.com/2011/12/09/backbonejs-modular-app-using-requirejs/ http://jcreamerlive.com/2011/12/09/backbonejs-modular-app-us...
- tbranyen 15y agoYup, https://github.com/tbranyen/backbone-boilerplate/issues/22 https://github.com/tbranyen/backbone-boilerplate/issues/22 Currently anyone can use require.js. Delete the build folder and update the index.html.
- deleted 15y ago[deleted]
- kragen 15y ago"Boilerplate", as I understand it, is text you copy and paste, and then edit to your needs. But the name of the game in programming is "don't repeat yourself", that is, don't copy and paste text. (And "eliminate dependencies," but that doesn't come into play here.) So, in programming, boilerplate is always bad. Boilerplate is the enemy. Boilerplate is what makes software unmaintainable. Boilerplate multiplies bugs. Boilerplate is not a "best practice". Boilerplate is a worst practice. Boilerplate is not canonical; it is demonical. Boilerplate is the failure to factor your software into reusable subroutines. Boilerplate mixes your green, red, and yellow code all together. This seems to be a combination of a decent development environment (a reasonable selection of libraries: Underscore, jQuery, Backbone, node.js) and 1000+ lines of actual boilerplate. I don't know why people here seem so willing to forgive the use of boilerplate. This post has 193 upvotes as I write this so I guess there are at least 193 non-hackers reading and voting on Hacker News. I hope I never have to fix their code.
- Vitaly 15y agoI don't agree. Recently I started to work with node.js and after switching from Rails where you have a pre-configured ready-to-go project within seconds, with node you need to assemble the whole thing yourself. For example there is no "standard" file layout, there is no "standard" way to initialize your ODM and there is no "standard" way to package your assets. Am I supposed to just choose something for myself re-inventing the wheel again? Thanks, but no thanks. Instead I'm browsing other people applications on github and, yes, templates and boilerplates.
- kragen 15y ago> Recently I started to work with node.js and after switching from Rails where you have a pre-configured ready-to-go project within seconds, with node you need to assemble the whole thing yourself. I haven't used Rails in a while, but last time I used it, the "boilerplate" in the newly created project was something like 20 lines, not 1000. But I object to that, too. If you need 1000 lines of text to have a ready-to-go software project, your development tools suck. > Am I supposed to just choose something for myself re-inventing the wheel again? The things that you aren't inventing shouldn't be in your project; they should be in a library. Your project should have only the stuff you're inventing. (Subject to "eliminate dependencies", of course.) That way, you can upgrade to a new version of the stuff you're not inventing later, fixing bugs and adding features in it; and somebody looking at two of your projects can see what's the same and what's different between them without resorting to running diff. I mean, seriously, this is one of the two most fundamental things about programming. If you disagree with it, it's not a matter of us having different subjective opinions. It's a matter of you being completely sodding ignorant about how to program. Of course, there are overall similarities in structure; lots of C projects, for example, have a main.c, a .h file corresponding to each other .c file, and a Makefile. But generating a "boilerplate" project with stuff you edit doesn't save you any significant time over just giving you an example project you can look at and then type.
- iusable 15y agoWithout getting into the technicalities of this, I am grateful somebody came up with this. I am working on a backbone + jq + mongo app right now & this might have been useful, at least in the early days.