Meteor - Structure


Meteor offers some special folders that can help the developers’ in structuring their apps.


If you create a client folder, everything inside this folder will be run on the client side. This is the folder where you can place your HTML, CSS, and client side JavaScript. You should place Meteor.subscribe functions, templates, helpers, and events inside this folder. Note, you don't need to run the Meteor.isClient function in the files that are placed inside the client folder.


Files from this folder will only be run on the server side. This is the place where methods, Meteor.Publish() functions, and other sensitive data should be held. All of the authentication data should be held here. You don't need to use Meteor.isServer() for the files inside this folder.


This is the place where you should place your images, favicons, and all the other data that is served to the client.


Files from this folder can be accessed only from the server. They will be hidden from the client. You can put JSON or EJSON files that only the server will use inside this folder.


Some JavaScript libraries export variables as globals. Use this folder for files that need to be executed without being wrapped in a new variable scope.

The rest

The rest of the folders can be structured the way you want. The code that is placed outside of the folders mentioned above will be executed on the client and the server side. This is a good place where you can define your models.

Load Order

It is always good to know load order of the files. The following list is taken from the Meteor Official Documentation.

  • 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 an alphabetical order of the entire path