Intro To Facebook AccountKit And GraphQL

DZone 's Guide to

Intro To Facebook AccountKit And GraphQL

Check out this quick reference piece about Facebook Account Kit, GraphQL, and RelayJS.

· Web Dev Zone ·
Free Resource

This article serves as a quick reference piece about Facebook Account Kit, GraphQL, and RelayJS. Be sure to comment if you have anything to add!

Facebook Account Kit

Image title

According to Facebook “Account Kit helps you quickly register for apps using just your phone number or email address — no password needed. It’s reliable, easy to use and gives you a choice about how you sign up for apps”. This is going make your app passwordless. a new trend coming soon. Users of your app just sign up with either their phone number or e-mail address. With this now, your users don’t even need to have a unique username or have to remember a complicated password. Facebook will send a confirmation SMS to the phone number or a confirmation email to the email. Make sure you use this on your next project. For the Laravel guys, Surajudeen Akande has a blog post on implementing Account Kit on your Laravel project. Facebook Account Kit SDKs are available for IOS, Android, Mobile and Website.

GraphQL and RelayJS

Image title

What exactly is GraphQL?

GraphQL is simply an API language whereby you ask for what you need and you get exactly that. It’s totally different from the REST. In REST, the client gets all the response data from the API, if it needs more data based on the data response it already has, it goes back again and hit your server for that data which can become a performance issue but with GraphQl, the client just specifies the data it wants and it gets it. For example, you can have a mobile app, web app, Facebook Messenger bot that needs to get to a resource. Your mobile app or bot app might not need all the data in the response but the web app might need all, so instead of creating different endpoints for handling this issue, the individual clients just specifies the data it needs from your backend and it gets exactly that. Apart from data fetching, you can also do data manipulation. The first image below is the client request while the second image below is the response. See how cool that is.

  authors {
  "data": {
    "authors": [
        "_id": "arunoda",
        "name": "Arunoda Susiripala"
        "_id": "pahan",
        "name": "Pahan Sarathchandra"
        "_id": "indi",
        "name": "Kasun Indi"

Many different programming languages support GraphQL such as Javascript, Java, PHP. You can find the complete list here. GraphQL is compatible with any backend service, you might be requesting data directly from your database or using an ORM on top of it such as Doctrine or Eloquent. You can also connect your existing APIs or a third-party API to GraphQL. Major flaws with REST is that it is not really flexible, if you want to do data joins it becomes messy, REST can over-fetch unnecessary data. Github has moved from REST to GraphQL in their API architecture, you can read about it here. Is the end of REST coming soon?

If you want to learn and practice the awesomeness of GraphQl? visit https://learngraphql.com.

What is Relay?

Relay is a new framework from Facebook that provides data-fetching functionality for React applications. It was announced at React.js Conf (January 2015). Each component specifies its own data dependencies declaratively using a query language called GraphQL. The data is made available to the component via properties on this.props according.

This awesome list of GraphQL & Relay has a lot of resources such libraries in different programming languages, tools, services etc on GraphQL.

We this info at your disposal, especially on the GraphQL you will be strongly considering using GraphQL for your next project or convert your existing REST APIs to GraphQL (if you have any objection(s) kindly say so in the comment section) and using Facebook Account Kit for your new passwordless app which your users would love but if security is a major priority in your app, you might want to consider other options.

References and further reading:


api, graphql, rest api

Published at DZone with permission of Chike Mgbemena . See the original article here.

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}