Meteor Cheat Sheet

Notes covering the critical Meteor concepts that will help you get up and running.


Meteor is a full-stack Javascript framework for building web and native applications.

Directory Structure

  • Files in the Client folder are only rendered on the Client.
  • Files in the Server folder are only rendered on the Server.
  • Files in Lib are rendered on both Client and Server.
  • Files in Public are rendered to the Client.


Routing requires middleware/package. Most common:
  • Flow-router
  • Iron-router

Global helpers (functions)

  • Create helper in lib directory (“/lib/helpers.js”)
  • Syntax: Template.registerHelper(‘helperName’, ‘function () {});


  • Create a collection in lib (Collection = new Mongo.Collection(‘collection’);


  • Insert: collection.insert(doc, [callback]);
  • Update: collection.update(selector, modifier, [options], [callback])
  • Remove: collection.remove(selector, [callback])


  • Sessions are global objects on the client. Can be used to store key-value pairs
  • Session.set(key, value) – New session
  • Session.set(key) – Get the value of session


Creating a new template (template name=“foo”> in HTML creates a template object named
Events – Specify events for this template like click, dblclick
Template.myTemplate.helpers – Specify template helpers (methods) available to this template
Template.mytemplate.onRendered – Methods to be called when template is inserted into DOM


Middleware/extensions to be used with app.
NPM packages with Meteor


  • Basic package is ‘accounts-base’
  • accounts-password, accounts-facebook, accounts-github, accounts-google, accounts-meetup, accounts-twitter
  • Meteor.user() – Get current user record or null if no user is logged in
Accounts UI
  • Add accounts-ui package
  • Add at least one login provider package:
    • accounts-password
    • accounts-facebook
    • accounts-github
    • etc
  • Add {{> loginButtons}} helper to an HTML file
  • This will place login widget on page