YiiBackboneBoilerplate
We at Clevertech use this folder structure setup for our own projects when developing BackboneJS applications.
YiiBackboneBoilerplate, aims to provide Yii Backbone developers with an application folder to ease the startup of their projects. It uses the flexibility of our YiiBoilerplate with a twist for BackboneJS applications.
Backbone.js gives structure to web applications by providing models with key-value binding and custom events, collections with a rich API of enumerable functions, views with declarative event handling, and connects it all to your existing API over a RESTful JSON interface.
You may be thinking that Yii is too powerful to be used just as a RESTful service. That for this purpose it could be done with NodeJS or any of the other libraries available, but it is the power of Yii and for the sake of application scalability that we decided to use it.
We love to work at Clevertech with Yii, in fact, it is one of the biggest assets of our company nowadays. Nevertheless, we are very aware of the new trends, and we had the opportunity to work with BackboneJS. So we decided that it could be good to provide a project startup for our developers, and allow us to get the best out of both worlds.
This document will be focused mainly in the folder structure that we set for the Backbone application. Please, read YiiBoilerplate's README for a deeper explanation of the main Yii folder structure setup.
Below the directory structure we are using:
/
backend/
...
common/
...
console/
...
frontend/
...
www/
app/
css/
img/
js/
boilerplate/
collections/
libs/
models/
views/
app.js
controller.js
main.js
router.js
vent.js
templates/
tests/
...
In the js directory, we have:
A special note regarding the templates directory. This folder is normally within the js folder, but we thought that it would be better to separate UI design from the business logic of the javascript files.
This section is actually extracted from YiiBoilerplate, but it is worth repeating the procedure.
The project has a very handy script that automatically creates the required and folders that are not shared for a Yii application, the runtime and assets folders, extracts the configuration settings specified for a specific environment then copies them to the ****-env.php*** files, and then runs migrations when not on private environments --we believe that migrations should be always run manually by developers on their machines.
To use this, from the application's root folder, simply run:
./runpostdeploy environmentType migrations
./runpostdeploy private to use ****-private.php*** configurations)We would like to inform that this is just a startup boilerplate for your own projects. It is not intended by any means to be used 'AS IS', but rather as a base to scale to more complicated structures.
Neverteless, we have included a couple of goodies that we hope to improve with the help of the community.
====
well-built beautifully designed web applications
www.clevertech.biz
Total 4 comments
You have to configure the server so it can point to the desired folder, that's if you have the controller in the sever , but if you have mutual hosting service I think you should change this structure.
Hi great extension , looks extremly promissing but as it's structure is based on event driven programming it changes from a classic Yii way of working I think a little explaining would be usefull for the community to grasp how Yiibackboneboilerplate runs once I'm rolling I'd be glad to make a tutorial , but could someone add sush an explanation ? Thanks
I have used this structure for my new project, please can you let me know about the url structure .
right now its like www.domain.com/frontend/www/ and I want it to be www.domain.com and same for backend its www.domain.com/backend/www and I want www.domain.com/backend
thanks
Just another great work by YII community
Leave a comment
Please login to leave your comment.