Quantcast
Channel: MongoDB | Blog
Viewing all articles
Browse latest Browse all 2423

Meteor: Build iOS and Android Apps that are a Delight to Use

$
0
0

Meteor provides a complete open source platform for building web and mobile apps in pure JavaScript. The Meteor team chose MongoDB as its datastore for its performance, scalability, and rich features for JSON. Meteor apps run using JavaScript via Node.JS on the server and JavaScript in the phone’s browser. You write both the client and the server sides of your application in JavaScript using the Meteor.JS framework.

What’s so great about Meteor? Here’s a few things that are particularly interesting to MongoDB developers:

  • Productivity Through Simplicity. Through reactivity and intelligent implication, Meteor requires much less code than other frameworks to get the same tasks done.
  • One Language. You write the client and server portions of your application in the same JavaScript language using the same framework. You can even place both in one file if you like.
  • Database Everywhere. The same methods access your MongoDB database on the server or on the phone.
  • Data on the Wire. Meteor does not send HTML over the network. The server sends data and the client renders it.
  • Latency Compensation. On the client, Meteor prefetches data from a local database to make it look like server method calls return instantly.
  • Full Stack Reactivity. All layers update themselves as data changes without any additional code.
  • Open Ecosystem. Open Source Meteor integrates with other open source tools and frameworks

The Database Everywhere and Latency Compensation concepts are especially interesting. Meteor maintains a local copy of data by implementing its own miniMongo database in phone memory. All of the phone-to-server data communication and synchronization is provided by Meteor. miniMongo is a JavaScript implementation of the MongoDB API.

With the automatic syncing provided by Meteor, you don’t need to have one set of developers working in one framework for the phone, and another set of developers working in another framework for the server. Now you can have full stack developers use one language and one framework. The phone code and the server code reside in the same JavaScript file. You build and deploy with a single command.

To show you the amazing simplicity of Meteor, let me show you the implementation of a barebones app that does this on a phone:

This HTML presents the page:

Meteor Blaze is a powerful library for creating live-updating user interfaces. The Blaze UI responds to messages from objects inside the <template> object. Blaze replaces {{counter}} with the value of the counter value in the JavaScript section. Intelligent “reactivity” will update the counter variable as it changes.

Now for the JavaScript. Note how the client and server code reside in a single file:

Blaze replaces frameworks such as Angular, Backbone, Ember, React or Knockout. Blaze updates HTML templates automatically without directives, model classes, data dependency declarations, or rendering functions. Blaze infers the data dependency of arbitrary JavaScript, sets up callbacks to detect changes in the template’s data sources, recompute values, and changes the DOM in place with the update. Meteor calls this feature “reactivity.” You just write simple HTML with variable names enclosed in double brackets as we did with {{counter}} in the HTML above.

Blaze lets you create rich phone user interfaces as in these screens from the Verso app built with Meteor and MongoDB:

The same codebase that powers the phone app can power a website for a PC or Mac in a browser. Employees can use their phones to run an app while managers use their desktops for reporting. For example, the same codebase that creates the phone interfaces above presents these web pages in a browser running on a PC or Mac desktop computer:

You can install and use Meteor for free. That link has excellent step by step tutorial showing you how to create a simple “todo” app that uses MongoDB for the datastore. At the end of the tutorial you can install a more elaborate sample todo app or a more complex customer engagement app that shows off native phone hardware functionality and social features. Meteor even provides a free server sandbox to deploy and test your apps.

If you’re interested in learning more about the architecture of MongoDB, download our guide:

DOWNLOAD ARCHITECTURE GUIDE


Viewing all articles
Browse latest Browse all 2423

Trending Articles