Build a GraphQL App with React

Rate this content
Bookmark

In this workshop, we'll build a React app from zero to one using a GraphQL API from Nhost.

Table of contents:
- Sign up to Nhost and create a Nhost app
- Create database table
- Set up React app
- Install Nhost and GraphQL dependencies
- Display data in React app
- Let users sign in
- Add GraphQL API permissions

This workshop has been presented at GraphQL Galaxy 2021, check out the latest edition of this Tech Conference.

FAQ

NHost is a serverless backend for web and mobile apps, providing a database with GraphQL, real-time sync, permissions, file storage, authentication, and serverless functions.

You need to clone the NHost repository from GitHub, install dependencies with npm or yarn, and start the React application.

You can access the Hasura console by copying the admin secret from the Data tab in your application and clicking 'Open Hasura'.

The workshop covers building a React app with GraphQL and TypeScript.

You can create an account by going to app.beta.nls.io and signing in with GitHub.

Yes, there is a free tier available, and you don't need to enter any card details.

You can choose Frankfurt, Germany as the hosting region. Multi-regional support will be added later.

You can create a new table by going to the Data tab in Hasura, selecting the public schema, and adding columns and frequently used columns like ID, created_at, and name.

You enable real-time data sync by using GraphQL subscriptions in your React application.

You can enable third-party sign-in methods like GitHub by configuring OAuth settings in the NHost dashboard and adding the sign-in provider in your React application.

Johan Eliasson
Johan Eliasson
98 min
08 Dec, 2021

Comments

Sign in or register to post your comment.

Video Summary and Transcription

In this Workshop, participants learned how to build a React app with GraphQL and TypeScript using NHost as a serverless backend. They set up the app, explored NHost features, created a Postgres database with a GraphQL API, implemented authentication, and protected the dashboard. Real-time data synchronization was also demonstrated, and participants learned how to enable third-party sign-in methods. Overall, the Workshop covered a range of topics and provided a comprehensive overview of building a full-stack application.

1. Building React App with GraphQL and TypeScript

Short description:

We're gonna start building a React app with GraphQL and TypeScript. To follow along, go to app.beta.io, create an account, and choose Frankfurt, Germany as the location. No card details required. If you have any questions or encountered any issues, please let me know.

And we're gonna start building a React app with GraphQL and TypeScript. So, actually what I will ask everybody who's already joined, so, this is my idea here is do a workshop and you will be able to follow along.

And so, what I will ask you to do is go to let's see if I can get this working. We can go to beta. I'll get the app.beta.io and create an account. Easiest way is just to sign in with GitHub if you want to follow along. So let me make this a little smaller, and so you can just log out and sign up with GitHub, and that should open this view and you should have like a default workspace being created for you.

So you can just click on a workspace and click on new app or click a new app here and create a new app, and we have a free tier, so you don't need to enter any card details or anything. So if you want to follow along this workshop, you go to app.beata.nls.io, create an account, a workspace should be automatically created for you, and you can go ahead and create a new app over here. You can pick a location that's close to you, but you're only allowed to pick Frankfurt in Germany for now. We have multi-regional support coming maybe later this week, so we're going to add a few more data centers, but for now, the illusion of choice, you can choose Frankfurt, Germany.

So I'm just going to ask everybody who just if you have a question... Because I don't see any feedback here. So if you created an account and were successful doing so, just do a thumbs up in the Zoom chat. So I can see some feedback if it's working. Maybe the infrastructure team at NHOS is sweating right now. I don't know. How do I do a thumbs up? Why can't I do it? Yes, we have the Discord in my think. Okay. So I don't see any thumbs up in the chat.

2. Follow Along and Set Up

Short description:

If you just want to follow along and see what I do, that's totally fine. But if you want to follow along, set up in progress. Thumbs up. We've got one. One thumb up. That's nice. So if you just joined, you can go to app.beta.nos.IO. You can see some people are now able to create accounts and create applications. That's perfect. So everybody who just made a thumb up, they were able to create an account here and a new application. And they now have their own Postgres database. They now have a GraphQL API and authentication and storage ready. I'm going to talk to you how you can use that in just a second. Right, I'm not sure how I do do I?

Does it mean you just want to follow along and see what I do or do you have some issues? It's totally fine. If you just want to follow along and see what I do, that's totally fine as well. But if you want to follow along, set up in progress. Thumbs up. We've got one. One thumb up. That's nice.

So if you just joined. Yeah. Totally fine. So if you just joined, you can go to app.beta.nos.IO. I'm going to send the link in the Zoom chat. You can see some people are now able to create accounts and create applications. That's perfect. So everybody who just made a thumb up, they were able to create an account here and a new application. And they now have their own Postgres database. They now have a GraphQL API and authentication and storage ready. I'm going to talk to you how you can use that in just a second. Right, I'm not sure how I do do I?

Okay, so I saw some time up we're good to go. We should be good to go? So, what you can do now is, let's see I have some notes.

QnA