/HackNights

Primary LanguageJavaScriptMIT LicenseMIT

meteor-boilerplate

This boilerplate is here to give you a starting point for your meteor projects, with a console tool to ease up some tasks. Essential atmosphere packages are included to give you features like routing and collection schemas out-of-the-box.

The boilerplate looks like following: boilerplate.meteor.com. Have a look at starthacking for a project created with this boilerplate.

Installing with orion-cli

npm install -g orion-cli

This will install the orion-cli tool, which can be used for scaffolding files with different profiles. You can still clone the repository, which doesn't give you the profile and scaffolding support.

How to use

# Assuming meteor is already installed
orion create appName
cd appName && meteor

Generating files

With orion-cli you can scaffold files based on your configuration that you've got.

orion generate routes

You can create models, views, change profiles and reset the project with the console tool (see below).

Removing default code

There's already a lot of predefined code in this boilerplate, to show you the possible functionality. However, if you want to start off with an empty project use the provided command to get rid off all the code you don't need.

orion reset

Available profiles (cofeescript and es6)

  • default (Plain Vanilla Javascript)
  • coffee (coffeescript, Unfancy JavaScript)
  • es6 (traceur, Traceur is a JavaScript.next-to-JavaScript-of-today compiler)

You can change your profile like that

orion set-profile

There will be a prompt, where you can enter coffee or any other profile that you have specified. Also use the reset command to start off with blank files according to your profile.

Deployments

It is highly recommended to use Meteor Up for easy deployments. Have a look at the repository for more information.

SEO and other concerns

Meteor cannot do SEO

This statement is only partially true, since there is a package called ms-seo, which has a lot of neat little tricks to help web crawlers notice your app the way you want them to. This boilerplate also adds constants under client/lib/constants.js for the app. Change SEO settings inside the routes like that.

Router.route('/about', function () {
  this.render('about');
  // Using the app constants
  SEO.set({ title: 'About -' + Meteor.App.NAME, og: {...} });
});

Adding allow rules for external URLs

The browser-policy adds rules to deny all operations from external URLs. This helps dealing with clickjacking and other XSS methods used to attack the client. To whitelist a url, add following to server/config/security.js

BrowserPolicy.content.allowOriginForAll(YOUR_URL);

Other security enforcing packages like audit-argument-checks and matteodem:easy-security have also been added.

Structure

Packages used

The "insecure" and "autopublish" packages are removed by default (they make your app vulnerable).

Folder structure

client/ 				# Client folder
    compatibility/      # Libraries which create a global variable
    config/             # Configuration files (on the client)
	lib/                # Library files that get executed first
    startup/            # Javascript files on Meteor.startup()
    stylesheets         # LESS files
    modules/            # Meant for components, such as form and more(*)
	views/			    # Contains all views(*)
	    common/         # General purpose html templates
model/  				# Model files, for each Meteor.Collection(*)
private/                # Private files
public/                 # Public files
routes/                 # All routes(*)
server/					# Server folder
    fixtures/           # Meteor.Collection fixtures defined
    lib/                # Server side library folder
    publications/       # Collection publications(*)
    startup/            # On server startup
meteor-boilerplate		# Command line tool

(*) = the command line tool creates files in these folders

Other Awesome Boilerplates

License

This boilerplate has an MIT License, see the LICENSE.txt for more information.