Meteor Best Practices - Meteor

What are the best practices of meteor development?

Most of the best practices of Meteor development have been covered in our previous chapters.

Directory Structure

Meteor apps has no strict rules about directory structure. For more info about some guidelines, check out our Meteor - Structure chapter.

Use Methods

Always use Meteor - Methods while working with sensitive data instead of calling insert, update and remove directly from the client.

Data Management

Publish and Subscribe methods can be used to protect data. If you want your data to be available to all clients, use null as the publication name instead. Publishing small amount of data can also improve app performance.

Validate Data

You have to validate all the data which is stored inside collection. One of the best options is collection2 package. It easy to set server and client side validation using this package.

Minimize Session

Session variables are global variables and using globals is against the JavaScript best practices.

Router

Meteor routing has two most popular options. For smaller apps there is Iron Router. It will automatically rerun when the data changes. For larger apps there is Flow Router. This router will give you more freedom to optimize re-rendering of the templates at a cost of little more boilerplate code.

Packages

Always check if package is updated regularly before choosing to use it inside the app.

All rights reserved © 2018 Wisdom IT Services India Pvt. Ltd DMCA.com Protection Status

Meteor Topics