NHOST: AN INTRODUCTION TO BACK-END AS A SERVICE.
Tags: javascript, beginners, sql, database
Published: 2022-11-19 09:02:35

Are you having trouble as a front-end or back-end developer creating a single app from scratch? If so, worry no longer. Many products and services have entered the market over the forecast period, which lessens the power of this.

In this article, you will learn about Nhost as an open-source [firebase](https://firebase.google.com/) alternative with [GraphQL](https://graphql.org/) that deploys both web and mobile apps seamlessly, and we will consider the following subject.

[What is Nhost](#what-is-nhost)
[Installation](#how-to-get-started-with-nhost)
[Nhost services](#what-are-the-nhost-services)
[How to create a database in Nhost](#how-to-create-a-database-in-nhost)
[Why Nhost](#why-nhost)
[Nhost vs Netlify](#nhost-vs-netlify)
[Conclusion](#conclusion)

# What is Nhost?

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/qmw4ti6ez2srkbc6nglh.png)

[Nhost](https://docs.nhost.io/) is a serverless back-end application that allows you to build a web and mobile application without having to worry about [infrastructure ](https://www.suse.com/suse-defines/definition/it-infrastructure-management/#:~:text=Infrastructure%20management%20is%20the%20management,network%20management%20and%20storage%20management.)management. It includes the GraphQL backend and full development; a cloud-based system that allows you to create mobile, web, and digital products.
 
Nhost is seamlessly integrated, and incorporated with innovative front-end technologies such as ReactJS, Next.js, Vue.js, flutter, and many others.

## How to Get Started with Nhost

Nhost is a user-friendly software application that allows anyone to navigate through freely; you can [sign up](https://app.nhost.io/signup) either with your GitHub credentials or your email address.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/hashoyd4ey6fdngnklyg.png)

Now look at the image above; you will see an arrow that bears no.1 and will ask you to sign up through your GitHub account. While the second arrow with no.2 will ask you to sign up with your email address; click on the first arrow (one), which will take you to the next page:

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/tqikhrwhhdyejwxlyvbg.png)

Once done with authorizing the Nhost and the signing up process, the next step is to visit: The [nhost](https://app.nhost.io/) site to access the workspace; that will take you to the next page. See below!

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/4hz6bf4biyjbn4zilwtp.png)

Congratulations, you are set to kickstart your first project; click on the button and start building.

Now, let's look at how to set up our first project on Nhost:

## How to set up a new project on Nhost

To do that, you must first provide the following details:

1. Project name (e.g: countApp)
2. Workspace, where the project will be created (e.g: WisdomUdo)
3. Password. (e.g: “123$%Uryis”)
4. Region (e.g “ London”).
5. Plan (e.g: “Free or Pro”)

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/r68slbbs6yw4edu690j0.png)

Once, provided the above details, click  “Create Project”.

## What are the Nhost Services?

Here, we will list out the basics services provided by Nhost; see

- [Postgres database](https://aws.amazon.com/rds/postgresql/what-is-postgresql/)
- [Authentication](https://www.postgresql.org/docs/9.3/client-authentication.html)
- [Hasura GraphQL](https://hasura.io/docs/latest/index/)
- [File Storage](https://www.ibm.com/cloud/learn/file-storage)
- [Serverless Functions](https://blog.hubspot.com/website/serverless-functions#:~:text=A%20serverless%20function%20is%20a,new%20code%20faster%20and%20easier.)
- [GitHub code Integration](https://docs.nhost.io/platform/github-integration#:~:text=The%20GitHub%20integration%20allows%20you,push%20code%20to%20the%20repo.)

## How to create a Database in Nhost

Here we will look at how to create a database with the Postgres database in Nhost. Postgres is an open-source database that supports relational (SQL) and non-relational (JSON) querying.

I will illustrate how to create a “**CarHire Database**” and show you step-by-step guides on how to get it done. 

Let's get our hands dirty;

- Login to the nhost site either with your Github credential or email address.
- Click on create new project

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/hp6zn194ajrgkzj4xr47.png)

- Set up your “**Project Name**” ( E.g ‘carHire’ )

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/1r3qefrpqt5bz21kh7fu.png)

Thereafter, click on “**Create Project**” and wait awhile for the system to finish the configuration process. Having done that, it’ll take you to the next page, as shown below!

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/x6gn5oyux8hgqgu7gsmv.png)

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/gcc9zqusp392t33t5pxx.png)

- Click on the “**Database**” to create a Table. 


- Once, that’s done you’ve to give your table a “**Name**”


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/8jjly8omzvxkdufcle6e.png)

- Add columns
- Specify a primary key (that’ll be your id columns)
- Add foreign key ( is optional)
- Finally, click on the create button.

       See the image below!

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/zw8zk61k6l05601oi0ul.png)

From the image above, you’ll see number four (4) once you click on it, it’ll create a new table. See the image below.


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/kle1k26tw6cutobdeebx.png)

Congratulations, you've successfully added a “New Table” called “**gallery**”.

## Why Nhost

According to [Johan Eliasson](https://www.crunchbase.com/person/johan-eliasson), the founder of Nhost in one of his interviews; he said " _I realized building a new backend for every app was not time well spent. when looking for the perfect backend, I found out it didn't exist. Now, this is the beauty of being an engineer. If you want something that does not exist, you can build it yourself, which I did.

In the early days of Nhost, I received a lot of traction from other developers who also wanted to have a ready-to-use backend. The feedback kept me motivated to build a fantastic experience for other developers who, just like me, love to develop._" [read more](https://survivejs.com/blog/nhost-interview/)..

## Nhost vs Netlify

Here, we’ll look at the comparison of both technologies.

|SN    |  Nhost  | Netlify | 
|------ |-------- |--------- |
|1    |  Firebase alternative (open-source)with GraphQl. | Build, deploy and host your static site or app with a drag-and-drop interface and automatic deploys from GitHub or Bitbucket. |
|2    | Back-end as a service (Baas). | Platform-as-a-service (Paas). | 
|3    | All permission is handled by Hasura. | Permission is handled with two systems ( file storage & GraphQL). |
|4    |  Unlimited free access to all features. | Limited access to most features. |
|5    | It Comes with developer tools. | Cloud computing. |

## Conclusion
Nhost is a back-end web-based development platform that allows developers to build web and mobile apps without bothering about the infrastructure; because it comes with GraphQL technology.

However, in this article, we have been able to share with you the meaning of Nhost, and also present a table of comparison between Nhost and Netlify: then the services that come with it, and further show you how to create your first database with Nhost.

Finally, it will be nice to seize this opportunity to learn more about Nhost and take advantage of it.