You are previewing Meteor Design Patterns.
O'Reilly logo
Meteor Design Patterns

Book Description

Accelerate your code writing skills with over twenty programming patterns that will make your code easier to maintain and scale

About This Book

  • Optimize your web application for production use

  • Build views and controllers with minimal effort that will evolve with your application

  • Learn how to maintain a MeteorJS project while it is running in production

  • Who This Book Is For

    This book is for developers who have already had an introductory course with Meteor. Basic knowledge of web development is recommended.

    What You Will Learn

  • Use of Jade, Stylus, and CoffeeScript to speed up web development

  • Increase productivity by leveraging the best packages in the community

  • Optimize your site for load speed with advanced publishers and subscribers

  • Leverage the aggregation framework to produce results with big data

  • Master the intricacies of front-end development using Jeet, Bootstrap, CSS animations, and more

  • Optimize your site for search engine visibility

  • Secure your site with Meteor’s best practices

  • Track the live status of your application, ensuring all errors have been taken care of

  • In Detail

    With the increasing interest in NodeJS web applications, a new framework, Meteor, has joined the ranks to simplify developer workflows. Meteor is one of the few open source frameworks that has received funding since its early development stages. It builds on ideas from existing frameworks and libraries, offering developers an easy way to develop a prototype app. At the same time, it gives them the tools and flexibility to build a fully fledged production app. Meteor is the weapon of choice for start-ups in today’s world.

    Meteor Design Patterns cuts through the jargon that most websites play with and gets to the point with simple solutions that will boost your development skills.

    We start off with a refresher on the basics of JavaScript programming such as templates, CoffeeScript, the Event Loop, and the Merge Box, amongst others. You then learn how to map real-world data and optimize the data’s publishers to output data with the least amount of work done by the server with some subscribe and publish patterns. Next, using front-end patterns, you will learn how to create maintainable and trackable forms, and make our site crawlable by any search engine. Following this, you will see how to optimize and secure the web application and maintain applications without breaking other features. Finally, you will learn how to deploy a secure production-ready application while learning to set up modulus, compose with Oplog tracking and SSL certificates, as well as error tracking with Kadira.

    Throughout the book, you will put your skills to practice and build an online shop from scratch. By the end of the book, you will have built a feature-rich online shop.

    Style and approach

    The book is a practical handbook on how to build an e-commerce web app using Meteor. Every topic ties into the webapp to easily illustrate the concepts that you are learning about.

    Downloading the example code for this book. You can download the example code files for all Packt books you have purchased from your account at If you purchased this book elsewhere, you can visit and register to have the code file.

    Table of Contents

    1. Meteor Design Patterns
      1. Table of Contents
      2. Meteor Design Patterns
      3. Credits
      4. About the Author
      5. About the Reviewers
        1. Support files, eBooks, discount offers, and more
          1. Why subscribe?
          2. Free access for Packt account holders
      7. Preface
        1. What this book covers
        2. What you need for this book
        3. Who this book is for
        4. Conventions
        5. Reader feedback
        6. Customer support
          1. Downloading the example code
          2. Errata
          3. Piracy
          4. Questions
      8. 1. Getting Started with Meteor
        1. CoffeeScript for Meteor
          1. Objects and arrays
          2. Logical statements and operators
          3. Functions
          4. Binding
        2. Jade for Meteor
          1. HTML tags
          2. Templates and components
          3. Helpers
        3. Stylus for Meteor
          1. CSS tags
          2. Variables
          3. Functions/mixins
        4. Templates, helpers, and events
          1. Templates
          2. Creating helpers
          3. Events
        5. The event loop and the merge box
          1. The event loop
          2. The merge box
        6. The beginning of our online shop
          1. The must-have packages
          2. File structure
        7. Summary
      9. 2. Publish and Subscribe Patterns
        1. Template-level subscriptions
          1. Setting up products for the online shop
          2. Building the publisher
          3. Subscribing to the publisher
        2. Database relationships
          1. One to one
          2. One to many
          3. Many to many
        3. Publishing with relations
          1. Publishing products with images (one to one)
          2. Publishing orders with details (one to many)
          3. Publishing a tag with products (many to many)
          4. Key, foreign key, options, and filter
        4. Aggregation publishers
          1. The aggregation framework
          2. Publishing the results
        5. External API publishers
          1. The HTTP package
        6. Summary
      10. 3. Front-end Patterns
        1. Responsive design
          1. General settings
          2. Bootstrap
          3. Jeet grid systems with Rupture
        2. Super helpers
          1. Defining a Blaze helper
          2. Making a global dictionary
        3. Variable types
          1. Session variables
          2. Persistent variables
          3. File scope variables
          4. The ReactiveVar variables
        4. Forms
          1. Meteor Methods
          2. Autoform
        5. Loading data
          1. Designing the loading indicator
          2. Implementing the loading indicator
        6. Animations and transitions
          1. Animating with CSS
          2. Executing animations in Meteor
        7. SEO
          2. Using Meta
        8. Summary
      11. 4. Application Patterns
        1. Filtering and paging collections
          1. Router gotchas
          2. Stateful pagination
          3. Filtering
        2. Security
          1. Roles
          2. Collection2
          3. Deny rules
          4. Custom deny rules
          5. The Meteor methods – round 2
          6. Managing the wait time
          7. Browser policy
          8. Framing
          9. Content
        3. External APIs
          1. Synchronization
          2. Webhooks
        4. Summary
      12. 5. Testing Patterns
        1. Behavior tests
        2. Unit tests
        3. Summary
      13. 6. Deployment
        1. Setting up Modulus
        2. Setting up Compose
        3. Setting up Kadira
        4. Setting up an SSL certificate
        5. Summary
      14. Index