Blog

Get MEAN in 2017

maxresdefaultImage from Codegeekk blog

Over the years, we’ve worked with LAMP stacks, and .NET stacks to develop and run software.

In Q4 2015, we began small experiments with Angular.js, leading to micro-projects with MongoDB, Express.js, Angular.js and Node.js (aka MEAN).

This year we built out a multi-vendor, highly-customizable platform using the MEAN stack. I’m happy to report that choosing to get MEAN was the right choice.

It has given us unparalleled flexibility, vastly improved the user experience choices we could make and the range of optimizations that’s possible in web apps. Whether you are building a microservice or a platform, I would recommend considering to get MEAN in 2017! 🙂 Here’s some notes on our experience:

MongoDb:

Traditional SQL databases can make complex structures very rigid. If your app needs to allow users (or your developers) to have a lot of flexibility in deciding how data is structured, designing flexibility into a sql db can get tricky/messy and involve a lot of tables quite quickly.

With MongoDB, you store documents in collections. You can store any data you like in any document you like and Mongo won’t complain. This allows you to control your data structure in your app, rather than design data structures to meet SQL’s needs and retro-fitting them for your app.

Moreover, you can store nested arrays inside a document. For example, you could have a ‘book’ document, that includes reviews, instead of a ‘book’ table and a ‘book_reviews’ table, e.g.

MongoDB Document (stored as JSON)

{
_id: 348395894867486789,
title: "Get MEAN in 2017 ",
author: "Owen Cooney",
year: 2017,
price: priceless,
description: "JavaScript increasingly rocks my world!",
rating: "5/5",
review: [
{ name: "A Reader", text: "Wow, I get it." },
{ name: "JS Expert", text: "Recommended to novice and expert developers alike." }
]
}

The infrastructure around MongoDB is also awesome.

  • Database hosting: You’ve got great Database-as-a-Service providers like MongoDB Atlas and mLab.
  • Object modelling Automattic, best known for WordPress, has contributed an amazing open-source ORM Mongoose that works great with Express.js.

JSON:

As you can see above, with MongoDB, your data is stored in the db as JSON. What is more with Express and Angular, your data is sent back and forth and displayed in the browser in JSON.

When the data you store in the db, looks the same as the data you send via the api, and the data you work with in the client, life just becomes a little easier!

(Rather than dealing with tables and columns in sql, then transforming to JSON for the app.)

Express.js:

Express.js gives you an amazing and simply way to organise and write your api. It’s extremely powerful when combined with Mongoose and MongoDB.

When Parse open-sourced their parse-compatible api-server, it was written in express.js, enough said.

Angular.js

I will write another post on angular in the near future, but for now, all I’ll say is, we ♥ angular!

Finally you can get the smooth, faster experience of a desktop or ios app in your browser!

Note: A key area to look at when thinking about the user experience with angular is to look optimizations around pre-loading and storing data in the browser’s memory during a user session, rather than calling the db, similar to how you would think about a mobile/desktop app. This makes navigating back and forth between pages/screens lightening quick for the user, similar to a desktop or mobile experience.

Node.js

It’s fast, it’s reliable, and the npm library of modules is never-ending.

Any questions or comments, or your experience on getting MEAN, hit me up!

Leave a Reply

Leave a Comment