Structuring your app
Since Meteor gathers up your files and builds your app you get a lot of freedom when it comes to structuring your app. In larger applications there is some debate over how you should organize your files and will probably differ from project to project (unlike say, Ruby on Rails, which is very opinionated on the matter). The three main patterns are outlined in the docs here (scroll down a bit to "Organizing Your Project").
Since this will be a relatively small app, we'll keep it quite simple. After you have finished playing you can delete those 3 files and make your app structure look like this (they are all folders):
client/
lib/
styles/
views/
public/
images/
server/
both/
collections/
Remember how Meteor combines all your Javascript? So what if you want jQuery to load first? Luckily anything in a folder called lib
is loaded first. Also the deeper the folder, the higher up the position it will be loaded. So /client/lib
will be loaded before /lib
. Here are the actual rules to make it crystal clear:
- HTML template files are always loaded before everything else
- Files beginning with main. are loaded last
- Files inside any lib/ directory are loaded next
- Files with deeper paths are loaded next
- Files are then loaded in alphabetical order of the entire path
Also note that Meteor includes jQuery (and Underscore) by default, so there's no need to put it in your app at all.