Renowned JavaScript Guru Addy Osmani has a great presentation on how to handle JavaScript on large projects (defined as >100K LOC)

Today’s solutions and frameworks are great, but how do you keep them under control as your project grows?

In this presentation, Addy Osmani presents an effective set of design patterns for large-scale JavaScript (and jQuery) application architecture that have previously been used at both AOL and Yahoo amongst others.

You’ll learn how to keep your application logic truly decoupled, build modules that can exist on their own or be dropped into other projects and future-proof your code in case you need to switch to a different DOM library in the future.

jQquerysummit - Large-scale JavaScript Application Architecture from Jiby John