I do my DB design first, set up all the fields and foreign keys. Then I connect my factory to this newly created database and the factory creates the application structure based on the relations etc. The factory then uses code templates to generate a fully functioning web app based on Yii (http://www.yiiframework.com) with MVC, unit and functional tests and most of the boring repetitve work done for you e.g CRUD, search, autocomplete, jqgrid data grids, search engine friendly urls etc. After that it's just a case of adding your business logic and customising the CSS. This is something I'll be releasing in future, probably a lot sooner now that i have more time on my hands
It's not perfect yet, i have to edit the code templates for every site i build, i'll probably have to write a simpler templating system before i can release it. The cool thing is it's almost a quine - I can make the factory generate it's own code :). I think the plan is to offer a basic free version and a paid version that will allow deeper customisation. At the moment it only supports mysql but thanks to Yii making mssql/oracle/postgres work shouldn't be hard. I'll be working on this this week, I'll let HN know how it progresses