Top 5 NPM Libraries for mobile app backend development: how to accelerate the process

npm-logo

These days NodeJS is one of the fastest developing and growing backend server environments. Even as you read this the popularity of this server is rising. It is quite good for a mobile app backend, as these have lots of I/O.

We have already described all the advantages of NodeJS and gave you some hints on where and when to use it. Quite often it might become a life saver for developers.

In this article we’re gonna give you our list of top 5 npm libraries (and a framework) that will definitely help you save time when developing your mobile app backend.

Not only that, but we’re also gonna provide you with the examples of use! Also, the libraries are useful in general, not only in mobile apps domain!

Why wait? Let’s get started!

 

#1 – PassportJS

 

1376269369423

Number one on the list of mobile app development libraries is PassportJS! This library will handle all the authorization related stuff you’ll ever need! It has a hell lot of token-based oath integrations with almost any social network. So to say, all-purpose tool that can be used in any mobile app!

P. S. LunApps uses it all the time.

 

#2 – node-redis-pubsub

 

redis-300dpi

Meet redis! NodeJS is single-threaded, so running a bunch of node processes operating together is a usual thing. Also, you may have one process responding to user requests while another process would be doing calculations.

This was not a problem earlier, when all the apps were using traditional HTTP requests, but modern apps, especially mobile applications, need to be “lively”. For example, when a message arrives the user wants to get it on the screen instantly, not after a small delay.

In this case long-polling or websockets are used – these allow to push data from the server to its client. We’re definitely gonna write an article on this topic anytime soon.

This means that all NodeJS processes will need to notify each other when new data appears.
node-redis-pubsub simplifies this task through the use of redis key-value store.

Furthermore, it provides an EventEmitter-like API (EventEmitter is a default NodeJS construct), so it can be used almost like a native EventEmitter!
This lets you implement long-polling and/or websockets in a lot simpler and much more scalable way.

We use this one whenever we need to implement long-polling or websockets, which happens quite often.

 

#3 – express.js

 

68747470733a2f2f692e636c6f756475702e636f6d2f7a6659366c4c376546612d3330303078333030302e706e67

Express.js gets a bronze! This is a minimalistic web app framework that has lots and lots of ready-made plugins called “middleware”.

The plugin idea comes from another excellent library called Connect, which is used by express.js internally. In fact, passport.js can be natively used as express.js middleware.

LunApps are using express.js for all our projects.

A mobile app can benefit greatly from express.js. As an example we’ll throw in a description of 2 express.js middlewares that have proven to be mighty useful for us:

express-validator

Express-validator is a one-stop tool for data validation. It is used for security purposes, and it’s hard to overstate its importance. This library makes data validation as easy as cake! We are using it in practically each and every project.

express-session

Express-session simplifies your work with session management. In fact, if you use it along with PassportJS, you can have a ready-to-go decent authorization by simply utilizing those 2 middlewares together.

All you need is provide login, register and logout methods. Everything else related to authorization works out of the box. We are using this thing all the time!

We only described two libraries, however, you can find all kinds of useful middlewares in the NPM registry that would serve your purposes.

 

#4 – Grunt and related grunt tasks

 

grunt-logo

Grunt is a task-runner used for building automation.

Grunt does amazing compilation of static resources. If you’re working with mobile app backend – this one is a must-have for your admin panel!

Grunts automates all the stuff related to pre-deploy operations, e.g file copying, script minification, file compression, etc. This lets you save lots of time by not doing this annoying routine over and over again.

LunApps have recently started using Grunt for this purpose in our projects. So far we are happy with our choice.

Make sure to check out our article on how we build landing pages using Grunt. We share lots of practical advices and give some tips on how to decide whether Grunt is the right choice for your app.

 

#5 – Sequelize.js

 

sequelize

And last but not least – Sequelize.js. It’s an SQL ORM that supports all kinds of SQL-based databases.

In a nutshell, this library provides all the communication with your database, which is usually done manually, and gives out plain normal objects, handling most of errors that may possibly arise. It helps speeding up database development for mobile projects tremendously.

Currently we are using our own system for that purpose.

Its main upside is as follows: it provides direct SQL queries support. Thigh might be good for some projects that need getting something more complex than straight objects from the database, for example, calculated stats.

And here’s its main downside: some standard queries have to be done manually, which might slow down the development process.

However, we are planning to switch to Sequelize.js for the future projects.

 

Conclusion

 

As you can see, there are some really handy frameworks for mobile app backend development out there! We did our best to give you the best node package manager libraries we are constantly using in our every-day development process.

If you have any questions regarding your future project, feel free to contact us. We kick asses when it comes to developing apps with smart custom design!

Comments