Introduction
Page preview for evaluation of importing data to GitBook
Do a little mental experiment for me. Imagine you're opening the same folder in two different windows on your computer.
Now click inside one of the two windows and delete a file. Did the file disappear from the other window as well?
You don't need to actually do these steps to know that it did. When we modify something on our local filesystems, the change is applied everywhere without the need for refreshes or callbacks. It just happens.
However, let's think about how the same scenario would play out on the web. For example, let's say you opened the same WordPress site admin in two browser windows and then created a new post in one of them. Unlike on the desktop, no matter how long you wait, the other window won't reflect the change unless you refresh it.
Over the years, we've gotten used to the idea that a website is something that you only communicate with in short, separate bursts.
But Meteor is part of a new wave of frameworks and technologies that are looking to challenge the status quo by making the web real-time and reactive.
What is Meteor?
Meteor is a platform built on top of Node.js for building real-time web apps. It's what sits between your app's database and its user interface and makes sure that both are kept in sync.
Since it's built on Node.js, Meteor uses JavaScript on both the client and on the server. What's more, Meteor is also able to share code between both environments.
The result of all this is a platform that manages to be very powerful and very simple by abstracting away many of the usual hassles and pitfalls of web app development.
Why Meteor?
So why should you spend your time learning Meteor rather than another web framework? Leaving aside all the various features of Meteor, we believe it boils down to one thing: Meteor is easy to learn.
More so than any other framework, Meteor makes it possible to get a real-time web app up and running on the web in a matter of hours. And if you've ever done front-end development before, you'll already be familiar with JavaScript and won't even need to learn a new language.
Meteor might be the ideal framework for your needs, or then again it might not. But since you can get started over the course of a few evenings or a week-end, why not try it and find out for yourself?
Why This Book?
For the past couple years, we've been working on numerous Meteor projects, spanning the range from web to mobile apps, and from commercial to open-source projects.
We learned a ton, but it wasn't always easy to find the answers to our questions. We had to piece things together from many different sources, and in many cases even invent our own solutions. So with this book, we wanted to share all these lessons, and create a simple step-by-step guide that will walk you through building a full-fledged Meteor app from scratch.
The app we'll be building is a simplified version of a social news site like Hacker News or Reddit, which we'll call Microscope (by analogy with its big brother, Meteor open-source app Telescope). While building it, we'll address all the different elements that go into building a Meteor app, such as user accounts, Meteor collections, routing, and more.
Who Is This Book For?
One of our goals while writing the book was to keep things approachable and easy to understand. So, you should be able to follow along even if you have no experience with Meteor, Node.js, MVC frameworks, or even server-side coding in general.
On the other hand, we do assume familiarity with basic JavaScript syntax and concepts. But if you've ever hacked together some jQuery code or played around with the browser's developer console, you should be OK.
If you're not that comfortable with JavaScript yet, we suggest checking out our JavaScript primer for Meteor before getting started with the book.
About the Authors
In case you're wondering who we are and why you should trust us, here is a little more background on both of us.
Tom Coleman founded Percolate Studio, a web development shop with a focus on quality and user experience, was one of the creators of the Atmosphere package repository, and is also one of the brains behind many other Meteor open-source projects. He now works full-time for the Meteor Development Group.
Sacha Greif has worked with startups such as Hipmunk and RubyMotion as a product and web designer. He's the creator of Telescope and Sidebar (which is based on Telescope).
Chapters & Sidebars
We wanted this book to be useful both for the novice Meteor user and the advanced programmer, so we split the chapters into two categories: regular chapters (numbered 1 through 14) and sidebars (.5 numbers).
Regular chapters will walk you through building the app, and will try to get you operational as soon as possible by explaining the most important steps without bogging you down with too much detail.
On the other hand, sidebars will go deeper into Meteor's intricacies, and will help you get a better understanding of what's really going on behind the scenes.
So if you're a beginner, feel free to skip the sidebars on your first read, and come back to them later on once you've played around with Meteor.
Git Commits
There's nothing worse than following along in a programming book and suddenly realizing your code has gotten out of sync with the examples and that nothing works like it should anymore.
To prevent this, we've set up a GitHub repository for Microscope, and we'll also provide direct links to git commits every few code changes. Here's an example of what that will look like:
<%= commit "11-2", "Display notifications in the header." %>
But note that just because we provide these commits doesn't mean you should just go from one git checkout
to the next. You will learn much better if you take the time to manually type out your app's code!
A Few Other Resources
If you ever want to learn more about a particular aspect of Meteor, the official Meteor documentation and Meteor Guide are the best places to start.
We also recommend Stack Overflow for troubleshooting and questions, and the #meteor IRC channel if you need live help.
<% note do %>
Do I Need Git?
While being familiar with Git version control is not strictly necessary to follow along with this book, we strongly recommend it.
If you want to get up to speed, we recommend Nick Farina's Git Is Simpler Than You Think.
If you're a Git novice, we also recommend the GitHub app (Mac OS), which lets you clone and manage repos without using the command line, or SourceTree (Mac OS & Windows), both of which are free.
<% end %>
Getting in Touch
If you'd like to get in touch with us, you can email us at hello@discovermeteor.com.
Additionally, if you find a typo or another mistake in the book's contents, you can let us know by submitting a bug in this GitHub repo.
If you have a problem with Microscope's code, you can submit a bug in Microscope's repository.
Finally, for every other question you can also just leave us a comment in this app's side panel.
Last updated