On the Smashing Magazine site today Brian Hoyt has some suggestions for you to use to keep your workflow organized when developing your applications (code, file structure, assets, database, etc).
Perhaps in the past you've tried to build a more complex, cutting-edge website like [our example], and the project started off with great enthusiasm, but ended up in a nightmarish mess that you couldn’t maintain. Your client lost interest when new features started getting too hard to add, and you started having to work late at night, tracking down bugs that you couldn't even find the relevant file for. After a project like that, it's not hard to see the relevance of a well-organized website project.
He talks about some general principles like "don't over-organize" and "don't mix aspects of the site" as well as some more specific things like a website size to structure recommendation and parts of a site and how to handle them - assets, stylesheets, javascript, the database structure/values and, of course, the code.