How to quickly create an MVP

Written by Nadir on Saturday, November 3, 2018

How to quickly create an MVP

As a junior developer looking for the best ways to build APIs, this article is just a quick overview of different javascript frameworks available to quickly create MVP solutions. It is not a deep review, but only my first thoughts after manipulating and testing them.

Introduction

Creating a Node.Js API is time consuming because developers have to create a lot of functionalities which are often always the same : authentication, role and permissions, administration interfaces, database management and so on.

Last years, the huge javascript open source community released some interesting frameworks based on Node.Js aiming to save a lot of time by creating full customisable API’s and interfaces in a few minutes.

This table introduce an overview of the five I choose to compare :

User interface Admin interface Based on Optimized supported databases Push Notifications
Loopback (advanced) No CLI ExpressJs / NodeJs MongoDb, MySQL, Oracle, PostgreSQL, more… iOs / Android
Strapi No UI + CLI Koa.js/NodeJs MongoDb, MySQL No
Parse Server No UI ExpressJs / NodeJs MongoDb iOs / Android
Reaction Commerce Yes UI + CLI MeteorJs / NodeJs MongoDb SMS

 

After a quick review of each one of them I’ll implement the same use cases of sending an email and edit permissions ACL to compare their different workflow.

 

Looback

This framework built on top of Express.Js is the easiest way to quickly create dynamic end-to-end REST APIs.

In practice, once your project is initialized, create your first model and instantly find the following page on your browser, connecting on the Loopback API explorer.

Loopback API Explorer

As you can see, Loopback implements all CRUD operations as a set of methods of persisted models.
Using these APIs, apps can query databases, store data, upload files, send emails, create push notifications, register users, and perform other actions provided by data sources and services.

By the time this article is published, there are officially supported connectors for all the following databases :

Then, it only takes a few minutes via the commands lines to define your datasource and to create your models with their relations and permissions.

Loopback CLI

Once these few steps are done, go further by creating your own logic inside your models.

What about push notifications ? Loopback handles both iOs and Android by simply configuring your app as shown in the documentation https://loopback.io/doc/en/lb2/Push-notifications.html.

This well documented Loopback is focused on REST APIs and using it without administrator interface requires more skills than others.

 

Send an email with loopback :
When creating a model, Loopback generates two files name yourModel.js and yourModel.json. The first one comes as an exported module where you can add any of your logic. To send a mail, I simply add a new method in there and when saving the file it automatically add its endpoint in the swagger. Done.
loopback-mail-logic.jpg

loopback-send-Email-swagger.png

The second file, yourModel.json is an object of all the properties, relations, permissions of your model.

Edit permissions ACL with loopback :
Loopback offer a nice and easy CLI flow to manage the different permissions of you API. Just by typing lb acl you will be drived to all the process from selecting the model you want to edit, the method you want to restrict, the action you want to authorize, to which type of user.
loopback-acl.png

Vendor lockin with loopback :
No problem to have access to your data or to export it, loopback is made for this purpose. The swagger presenting all your endpoints allow you and your team to stay up to date even with your custom methods, as sayed before. Don’t forget to edit your permissions according to your need.

 

So let’s see what worth these other frameworks.

Strapi

Let’s start with the most halfway between a pure Node.js framework and a headless CMS.

Such as Loopback, Strapi offer to quickly create an API based on your database and to manage everything from a nice UI.

The Strapi Dashboard

The documentation is very clear and easy to follow, you should definitely check ou the quickstart guide

Forget your terminal and your text editor and create your models, roles & permissions, relations and everything you need to customize your API. It has never been easier to get so many features so quickly.

Supported by a small passionated team, Strapi is always improving with new updates and features. Involved in more than 5000 new applications per month, the community around the project is not about to give up, making comfortable to choose it to start a new project.

 

Send an email with Strapi :
By default Strapi comes with its email plugin based on nodemailer.
The POST endpoint /email and a bunch of methods come with it to manage all the mailing system.
Don’t forget to give permissions, as explained below, to all the actions you need via the UI admin panel and finally call the API, as required by https://nodemailer.com/usage, to get it done.

Edit permissions ACL with Strapi :

As expected, Strapi offer a nice panel to manage roles and permissions of your app. Initialized with “Administrator”, “Authenticated” and “Public” user, you simply have to check boxes of your different methods to allow or disable them for the category you are in. Also, everything is already set to create a new role if needeed.
strapi-acl.png

Vendor lockin with Strapi :
All your data is accessible via GraphQl. Not installed by default but available, a GraphQl package provides an playground interface (accessing via /graphql) to help you visualize the different request you may need.

 

But it is not the only one offering such features, let’s see another framework quite similar.

Parse Server

Often compared to the Google online database Firebase, Parse Server is a great alternative for those who prefer keeping fully control of their database.

Even if Firebase offer you great possibilities, having your data saved on google’s server can sometimes lift a red flag.

Parse, the company behind this new technology has been acquired, and closed by Facebook in 2016. The code was open-sourced and it allowed the community to take over the project. Real time database, storage, notifications, everything you expect from a great API is provided by Parse Server.

The Parse Server Dashboard

Parse Server Dashboard

The big advantage it has compared to others tool like Strapi, is its availabilities as embedable SDK. Whatever the plateform or the language you choose, Parse has an SDK for it. Here is the list :

  • iOS
  • Android
  • Javascript
  • .net + Xamarin
  • macOS
  • Unity
  • PHP
  • Arduino
  • Embedded C

See the “Push” on the dashboard ? Well, the dashboard provide a ready to use interface to send push notifications:

Parse server push

When Parse Server seem to be more advanced than Strapi in term of functionnalities and compatibilities, I recommend it for more advanced user while strapi seems more easy to start with for beginners.

 

Sending an email with Parse Server :
According to the SDK you use, sending an email with Parse server can be more or less tricky. At this time not supported with JS, you can create your custom logic using Cloud Codeor plugin a provider like Mailgun to add this functionality.

Edit permissions ACL with Parse Server :
Edit both your roles or your classes with ACLs or CLPs via the dashboard to lock down your app.

Parse server push

Vendor lockin with Parse Server :

Parse server provides an API documentation for each one of the SDKs listed above. Also, all the data is available through a documentated rest API. There is even an API console available in the dashoboard to be able to quickly test it. Again, you can also customize this API with your own endpoint thanks to Cloud Code

Parse server API console

 

The key is to choose the right framework for the right project. So what about the only one is this is list with both an backoffice and a ready to use frontend ?

Reaction Commerce

Integrated with the most famous payment providers such as Stripe, Paypal, Braintree, Reaction Commerce is a responsive full stack e-commerce platform.

Reactioncommerce

Firstly targeting web application, it can also be configured in a iOS or Android app.

Supported by a large open-source community, this framework based on Meteor & Node.Js is fully customizable to adapt to any project.

The built-in UI allow you to:

  • easily manage your products and orders
  • custom user profiles
  • send them notifications
  • localize language and currency
  • adapt shipping rates
  • make discounts

Of course, it comes with a very opinionated structure. It is 100% customizable, but the more you do, the more you have to adapt your logic to fit the framework.

 

Send an email with Reaction Commerce :

Obviously, sending an email with Reaction Commerce flow is also handled by Nodemailer.

First, configure the email section in the dashboard with your credentials.

reaction-commerce-emailing.png

Two mails services are already set up into your application: the signup welcome and the forgotten password mails.
Go and edit them into your project at the following path /imports/plugins/core/accounts.
If you need more, you can still use the Meteor.Js api to add your custom logic https://docs.meteor.com/api/email.html.

Edit permissions ACL with Reaction Commerce :
Pretty easy from the UI, the dashboard offer the possibility to add shop managers or owner just by adding their email (and inviting them at the same time).
You also have a custom menu to allow or deny different group of users/admins to interact with your app. A whole permissions system is natively availale through the dashboard.

reaction-commerce-acl.png

Vendor lockin with Reaction Commerce :
Like Strapi, Reaction Commerce offer a whole GraphQL API to manipulate the data from outside.
Of course if your want to build custom components, you have to follow the flow already used to enjoy all the benefits of this API and as usual, edit your permissions before trying opening your app to the internet.

 

Conclusion

One thing is sure, you don’t really need to build APIs from scratch anymore. Of course you can, but really great tools come to save you lot of time and provide you with quality of services.

As a junior developer I still want to create APIs from scratch on my projects to get used to, but those frameworks are not just alternatives to people who don’t know how to build scalable APIs but real Backend As A Service tools for small, medium or big projects.

As no framework is better than another one, they just all fit certain needs depending on your project.

This article came from the need to understand and find great developpement solutions in order to build APIs. Summarizing it is just a bonus to keep track and share the knowledges.

 

Documentations

Get in touch

  • 33 rue Lafayette,
    75009 Paris
  • (+33) 664898779
  • contact@x-squad.com