Meteor Tutorial

From WikiOD

Meteor is a full-stack JavaScript platform for developing modern Web and mobile applications.

Within one project, you are able to build your client (browser and/or hybrid mobile App for Android and/or iOS) and server sides.

Reference pages:

Versions[edit | edit source]

Version Release Date
0.4.0 2012-08-30
0.5.0 2013-10-17
0.6.0 2013-04-04
0.7.0 2013-12-20
0.8.0 2014-04-21
0.9.0 2014-08-26
0.9.1 2014-09-04
0.9.2 2014-09-15
0.9.3 2014-09-25
0.9.4 2014-10-13
1.0.1 2014-12-09
1.0.2 2014-12-19
1.0.3.1 2014-12-09
1.1.0 2015-03-31
1.2.0 2015-09-21
1.3.0 2016-03-27
1.4.0 2016-07-25
1.5.0 2017-05-30

Getting Started[edit | edit source]


Install Meteor[edit | edit source]

On OS X and Linux[edit | edit source]

Install the latest official Meteor release from your terminal:

$ curl https://install.meteor.com/ | sh

On Windows[edit | edit source]

Download the official Meteor installer here.

Create your app[edit | edit source]


Once you've installed Meteor, create a project:

$ meteor create myapp

Run it[edit | edit source]


Run it locally:

$ cd myapp
$ meteor npm install
$ meteor

Note: Meteor server running on: http://localhost:3000/

Then head to http://localhost:3000 to see your new Meteor application.


  • Read more about getting started with Meteor at the [Meteor Guide].
  • Explore Meteor Packages at atmosphere - a modern, fast, well engineered package manager.

Sample apps[edit | edit source]

Meteor has several sample apps built-in. You can create a project with one of them and learn from how it was built. To create a sample app, install Meteor (see Getting Started) and then type:

meteor create --example <app name>

For example to create a sample todos app, write:

meteor create --example todos

To get a list of all sample apps, type:

meteor create --list

Understanding build progress[edit | edit source]

Sometimes builds take longer than expected. There are a few environment variables you can set to better understand what's happening during the build process.

METEOR_DEBUG_BUILD=1       (logs progress)
METEOR_PROFILE=<n>         (logs time spent)
METEOR_DEBUG_SPRINGBOARD=1 (?)
METEOR_DEBUG_SQL=1         (logs SQLITE calls)
METEOR_PROGRESS_DEBUG=1    (? looks like it might be useful, but seems confusing)

Where <n> is a number of ms. Any process taking longer than this will be logged.

Linux/OSX Example[edit | edit source]

export METEOR_DEBUG_BUILD=1
export METEOR_PROFILE=100
meteor

Windows Example[edit | edit source]

set METEOR_DEBUG_BUILD=1
set METEOR_PROFILE=100
meteor

Updating Meteor Projects & Installed Packages[edit | edit source]

The Meteor Tool will notify you when a newer release is available.

To update Meteor projects to the latest release, execute the following command inside a Meteor project:

meteor update

In case you want to update your Meteor project to a specific Meteor release, run the following command inside the project:

meteor update --release <release>

If you want to update all non-core packages, run:

meteor update --packages-only

You can also update specific packages by passing their names as a command line argument to meteor update, for example:

meteor update [packageName packageName2 ...]

Build Mobile Apps[edit | edit source]

Meteor uses Cordova to package your application into a hybrid Mobile App. Once packaged, the App can be distributed like native Apps (through Apple App Store, Google Play Store, etc.)

  1. Add the target platform(s) to your Meteor project:
meteor add-platform android
meteor add-platform ios # Only available with Mac OS
  • Install the Android SDK and/or Xcode (for iOS, requires Mac OS).
  • Run your project (start with development mode):
meteor run android # You may need to configure a default Android emulator first

For iOS (only available with Mac OS):

meteor run ios # This will auto start an iOS simulator
  • Build your App package for distribution:
meteor build <output_folder> --server <url_app_should_connect_to>

This will create android and/or ios folder(s) alongside your server bundle.

  • The android folder contains the release-unsigned.apk file that you need to sign and zip align.
  • The ios folder contains the Xcode project that you need to sign.

See also the Meteor Mobile Apps topic.

Reference page: Meteor Guide > Build > Mobile

Managing Packages[edit | edit source]

Meteor has it's own package repository on atmospherejs.com

You can add new packages from atmosphere by running:

meteor add [package-author-name:package-name]

For example:

meteor add kadira:flow-router

Similarly, you can remove the same package by:

meteor remove kadira:flow-router

To see current packages in your project, type:

meteor list

List of packages can also be found in the file ./meteor/packages. To add a package add the package name in this file and to remove delete it.

To add a package locally, (e.g. unpublished packages or edited version of published packages), save the package in packages folder in the root.

Starting with version 1.3, Meteor added support for npm packages.

You can use the npm command inside Meteor project's directory as you would normally do without Meteor, or with the meteor npm command, which will use the bundled version of npm.

Checking the Version of the Meteor Tool & Meteor Projects[edit | edit source]

Meteor Tool[edit | edit source]

To check the installed version of the Meteor tool, just run the following command outside of any Meteor projects:

meteor --version

To get a list of all official (recommended) Meteor releases, run:

meteor show METEOR

Meteor Projects[edit | edit source]

If you want to check the project version of Meteor, you can also execute the following command inside a project:

meteor --version

or just print content of the file .meteor/release:

cat .meteor/release

In case you want to check the version of the packages which are currently installed in your Meteor project, print the content of the file .meteor/versions:

cat .meteor/versions

Meteor Website[edit | edit source]

To see which version of Meteor a Meteor based website is running, dump the contents of Meteor.release in your browsers console while visiting the website:

Meteor.release

Credit:Stack_Overflow_Documentation