Seems there are quite a few posts in different blogs and forums about loopback benefits. I have been using loopback since a while now and have noticed, the other articles probably didn’t give a two way view.
It’s always subjective to compare frameworks. So, please don’t take my words as a final commitment, rather analyse them with your own scenario, use case and feasibility.
What is Loopback.js?
Though majority of the readers of this article will already know what exactly loopback is; but for the people who don’t have a clear picture yet, here is a small description.
Before giving a detailed information, here is a small table showing a glance of the pros and cons of Loopback to make your life easier.
|FullStack development||Monolithic architecture|
|Built in models & features||Steep learning curve|
|Very fast development||Hard to use in huge and long term projects|
|Code is moduler & structured||The opinionated architecture may not serve all|
|Baked by IBM||Less community strength than express|
|Helps to kickoff very easily||Not recommended to start JS learning with it|
|Lot of additional tools given by StrongLoop||They are majorly paid|
|Great ORM with lot of available connectors in the community||Common disadvantage with all ORMs are, you end of the day end up using raw sql in many places|
|Built in user & access role feature|
|Built in API swagger|
Advantages of Loopback
You may get frameworks for client side development and so can be found for server side. But loopback gives you the power of a full-stack development. You can share your same model with both client and server. The rest api functions in the server are also available in the client side.
This, not only helps i faster development and lesser codebase, but also gives a client side developer to develop an entire app without doing anything specific to server (considering only CRUD operations). Even for custom REST apis, the consumption in the client side is really simple.
Built in models & features
Loopback gives you a lot of things out of the box. You can create CRUD apis of any model with a simple flag. Very common needs like user management with role based api access are already available.
Loopback gives you api swagger where you can easily get the api contract and can also interact with them.
Code is moduler & structured
This is an advantage with any opinionated framework. You have the project architecture in place; you know how to place the new codes; handy level of abstraction and as a result a quick but structured project.
Quick scaffold & fast development
Using the strongloop cli you can easily scaffold your loopback project with all its out of the box functionalities and can also develop your project in a very fast pace.
Full-time team is developing it now and Strongloop is acquired by IBM. This gives the framework a stability and maturity to become a major player in this field.
Built in ORM
The concept of adding a separate json file for defining models and relations are really awesome and an example of clean code. Querying databases has been made simple. And due to the fullstack architecture, you can query your database from your client side directly with filters.
Disadvantages of Loopback
Fullstack development with shared models somewhere make the architecture monolithic. You can avoid that by using loopback only for your server; but that mean you are avoiding the full-stack feature.
Steep learning curve
With abstraction comes learning curve; it’s a fact and loopback is not an exception. At the end of the day to work with it, you need to know how exactly to use those given features. The more out of the box features, the more the learning. Thus a steep learning curve.
Not recommended for huge long term projects
This point is probably very subjective and draws my personal experience and opinion.
Loopback tries to do drive everything with a model. Your router and controller both are your models. You can create services, but still interacting with them will be via the models.
When your project grows with time and you start developing more and more features; the project and codebase starts getting a little messy. You may try to distribute it by making more files and modules; but won’t get a feeling of strong code architectures like MVC.
Even my suggestion is for any long term project, you shouldn’t go with any opinionated framework.
Libraries like express have become almost a standard for node.js and have a huge amount of community support. Loopback has a good amount of community but can’t be compared with that of express.
It’s always easier to google and stackoverflow an express issue rather a loopback one.
Common ORM issues
No matter how great the ORM is, but it can never serve all your purposes. You end ur writing a lot of sql queries and converting the results in your defined models.