I just write a small post on how I organise files on a Meteor project based on my 2 years of programming in Meteor. Hope It’ll help!
Let’s holywar begins
I have tryed all structures that you described. And found that Everything is Package is the best
We are moving more and more code into packages. for smaller projects we find this approach (below) much more effective than what Josh Owens prefers.
Sharing helpers and event code in the same files encourages file level scoped variables. we feel splitting them up makes things easier to find and also encourages better discipline. we use template level reactivedicts when events and helpers need them.
Download and explore this repo to see how well-organized and clean the code is.
Hi Max ( @maxhodges ) , thanx for sharing that presentation. Some really good advises!
I started out with the pure-app approach without any packages but eventually refactored to packages-only where all major concerns of my application are neatly separated and communicate via a clean api. This makes testing (and stubbing) your stuff much easier although it certainly reduces the convenience of Meteor auto-include-and-update-everything-in-the-main-app.
Another pattern that I am beginning to find very useful is splitting up bigger packages into sub-folders that are related to individual features of that package.
So I have an
accounts package that included everything related to user accounts like so:
|-------- // templates and views
|-------- // API and controllers
This really simplifies the structure and makes it crystal clear what you can expect when clicking around the folders. It’s also great when explaining to someone how your application works, because it is so straight-forward.