
This video provides an overview of the entire course.
Introduction to the basic concepts of GraphQL by showing how the queries, response, and the type system look like and in the process, briefly comparing GraphQL to the existing standard REST and covering the benefits of the GraphQL type system.
Introduce GraphQL by showing its queries, responses, and type system
Show the advantages of having a strong type system
Show the GraphQL adoption usage patterns
Compare GraphQL to the existing data exchange standard REST, discuss why using a GraphQL client is better and compare two of the most popular GraphQL clients Relay and Apollo.
Discuss the advantages of GraphQL over REST
Show why is it better to use a GraphQL client
Compare Relay and Apollo
Setting up the code environment including frontend and backend to start building the blog.
Install create-react-app and build an initial react app
Setup the create-react-app environment for relay modern
Setup the code environment for backend by installing express and express-graphql
Introduce the fundamental building blocks of GraphQL backend including Schema, types, special root types, scalar types before diving in to build a small GraphQL backend.
Introduce basics of GraphQL Schema and type system
Introduction to GraphQL scalar types
Build a basic GraphQL backend
Introduce one of the best tools that you can leverage while building a GraphQL backend and explore its features like documentation explorer, typeahead queries/mutations, code prettifier history and share-ability.
Display and explanations of the GraphiQL interface and documentation explorer
Explore GraphiQL typeahead queries/mutation and live feedback
Explore how GraphiQL persists the IDE state in URL and in inherently shareable
Discuss the constraints put by Relay on GraphQL backend for it to be compliant including node interface, connections and mutation types.
Introduction to fragments and interface in GraphQL
Discuss the node interface and GraphQL connections used for pagination
Discuss the constraints relay put on mutation type including clubbing of input arguments and response payload specification
Introduce the constraints imposed by Relay on GraphQL backend queries.
Discuss the Relay specification for Queries
Implement the node interface as a object refetching mechanism
Implement connection type which is Relay abstraction over pagination
Introduce the constraints imposed by Relay on GraphQL backend mutations.
Discuss the Relay specification for mutations
Implement the input type arguments for mutations
Implement the response payload for mutations
Discuss the impact of complying to the Relay interface on GraphQL backend queries and mutations.
Basic discussion of Relay specification impact on backend
Explore the code of node definitions in graphql-relay package
Explore the code of connection definitions in graphql-relay package
Prepare the frontend code to connect to relay compliant backend using Relay client. This involves ejecting the create-react-app to add babel-plugin-relay and creating basic components to list and display posts.
Use yarn eject so that we can alter the create-react-app build process and add babel-plugin-relay
Create ListPage component to list multiple posts with mock data that has same structure as the data that would later come from Relay compliant GraphQL backend backend
Create Post component that displays title of one post and on click opens title and content in a react modal
With React and Relay frontend we still need some help in solving the routing mechanism and another component to create posts to live on a separate create-post route.
Install react-router-dom package and import it in the project
Create a component to create a post that has title and content fields along with a post button
Use the react router and define the routing to load CreatePost component when the browser hits create-post route
Connect the frontend components using mock data for now and relay compliant backend with each other. The process involves writing co-locating fragments with data and running relay compiler to render queries and mutations.
Define data requirements of Post component, ListPage component via fragments and removing mock data dependencies
Run the get-graphql-schama helper to get schema.graphql file to pass to relay-compiler and get listing from actual backend
Add CreatePostMutation mutation and use it in CreatePost component to create new posts from frontend
Discuss ways in which Authentication/Authorization can be handled in GraphQL which are implementations in full GraphQL, full outside GraphQL in the wrapper framework and hybrid of the two.
Discuss that how the spec is not rigid about the authentication strategies yet
Take a look at that strategies including full GraphQL, full framework and hybrid implementations
Talk about our implementation which is full GraphQL in nature
Prepare the GraphQL backend for authentication and add author to Post type. Also, create the mutations necessary for the authentication workflow.
Create a User type and extend node interface to support it
Add author field to Post type using the User model
Create CreateUserMutation and LoginUserMutation to complete the mutation workflow
Connect the frontend to newly created Authentication API. Limiting create post function only to logged in uses and implement login/logout workflow.
Add a Login+Signup component and connect it to CreateUserMutation and LoginUserMutation
Add route in ListPage component to access Login component. Also, implement logout
Add author id submission while post is being created
Discuss the pagination workflow with relay client and relay compliant backend by taking a look at the connect objects.
Take a look at edge type that has fields node and cursor
Take a look at PostInfo that has directional workflow for pagination
Take a look at the connection argument to control the pagination
Extend the base connection provided by the graphql-relay package and add an argument to implement post ordering.
Revisit the existing connection code including connectionDefinitions and connectionArgs
Extend the connectionArgs with spread operator to have an order field
Use the new order field in resolver and through it the post model and implement post ordering
Connect the frontend to use the pagination features provided by relay compliant backend by using createPaginationContainer in place of createFragment container.
Wrap the ListPage component in createPaginationContainer
Setup the createPaginationContainer with required pagination arguments
Create Load More button and use relay prop to control pagination
Explore what query batching is and why do we need it. Discuss one use case in our blog application where we can use query batching.
Update the backend code to a more production like code but it will break the frontend
Discuss query batching and how it can help us build auto login in GraphiQL
See a demo of mutation batching for create and login user in GraphiQL
Explore query batching in detail discussing the execution order of batched queries and mutations. Discuss how we can solve field conflicts in batched queries and mutations using GraphQL aliases.
Take a look at an example of query batching but with field conflict
Discuss how we can use aliases to resolve the field conflict
Update the batched queries and use aliases to resolve the field conflict
Explore how we can fix the frontend auto login workflow using query batching.
Update the frontend code to combing create user and login user mutation
Run relay-complier to regenerate the frontend queries
Demo the auto login workflow in the fixed frontend
Set up the environment for testing and explore react storybooks which are a tool to do visual testing and iterative component development.
Install and setup storybooks
Expose the post component without relay container for easier integration with storybooks
Write storybook stories for the post component
Writing test cases for a complex workflow in the GraphQL backend. We will setup automated test cases for authentication workflow.
Set up Jest as a dev dependency for the backend
Discuss briefly about Jest
Write test cases for creating user mutation and login user mutation covering authentication workflow
Writing automated test cases for react component including test cases for interactions like click.
Set up enzyme and related react testing dependencies
Discuss briefly about Enzyme and its features
Write test cases for post component title placement and click to open modal
This video will give you an overview about the course.
In this video, we will understand challenges with RESTful services.
Define GraphQL and understand What GraphQL is NOT
Learn the working of GraphQL
Understand GraphQL core concepts
In this video, we will understand Architectural case studies of GraphQL.
Learn about GraphQL with database
Get an Overview of GraphQL with different APIs, 3rd party services and legacy systems
In this video, we will understand Application stack for both client and server.
Understand Directory and file structures
Understand Node.js ecosystem
Install Packages
In this video, we will get an understanding about RESTful routes.
Requirement Understanding
Possible RESTful routes
In this video, we will see the setting up GraphQL default routes and databases.
Set up GraphQL routes
Set up MongoDB database
Import default collections
In this video, we will understand schema, type, queries, mutations and resolvers.
Get an overview of schema and types for restaurants app
Learn about Root Queries for restaurants and initial Mutation setup
Learn about resolver to get data from databases for restaurants
Using GraphQL debugger and introspect data.
Setup and Understand GraphiQL
Introspect restaurants data and queries
Setup and understand GraphQL-playground
In this video, we will understand how to choose GraphQL Client.
Understand about GraphQL clients
Choose GraphQL client
In this video, we will setup client side application routes.
Create restaurant page
Use React-Router to setup application routes
In this video, we will build react components and styling.
Create React components on client side
Apply component stylings
In this video, we will learn about queries and optimization.
Relay Modern basics and relay compiler and GraphQL Schema
Understand relay environment
Use Query to fetch data and render restaurants page
In this video, we will understand how to fetch data using queries and render data on details page.
Use Query to fetch data for details pages
Create details page
In this video, we will understand Authentications using GraphQL server.
Token generation and verification
Token generation and verification
Authenticate user password for sign-in
In this video, we will Setup Mutation for sign-up.
Create Mutation and Resolver for sign-up
Create sign-up form including form validation
Integrate by constructing Mutation and passing info to services
Let’s continue with the previous video where we were setting up Mutation for sign-up.
Jump into our client based module and create our signup component
In this video, we will understand Handling Client side routing for authentication and non-authentication users.
Create client side routes for authentication user
Create client side routes for non-authenticate user
Integrate by constructing Mutation and passing info to services
Let’s continue with the previous video where we were Handling Client side routing for authentication and non-authentication users.
Create sign-out component in Navbar component
Complie, Run and Test!
In this video, we will Setup client side components for restaurant following and rating.
Create client side component for following and integrate with Services
Create client side component for rating and integrate with Services
In this video, we will Setup queries for mutation for restaurant following and rating.
Create Queries and mutation for following
Create Queries and mutation for rating
Let’s continue with the previous video where we will Setup queries for mutation for restaurant following and rating.
Create rating and score grade types
Create rating query and mutation
Create rating resolvers for query and mutation
In this video, we will Setup client side components for restaurant following and rating.
Create client side component for following and integrate with Services
Create client side component for rating and integrate with Services
In this video, we will request field validation on server.
Add request field validation for sign up form
Add request field validation for sign in form
In this video, we will understand error handling.
Understand error handling using promise
Understand error handling using GraphQL error type
In this video, we will Understand about Security.
Learn about the Security risk
Learn a Few strategies to mitigate these risks
In this video, we will understand about caching and batching.
Understand about caching
Understand the concept of batching
Know more about available tools to handling caching and batching
In this video, we will understand about pagination.
Setup basic pagination on server
Setup basic pagination on client
Know more about different pagination approaches
In this video, we will understand about subscription.
Define subscription
Know more about GraphQL support got subscription
Know more about alternatives
This video gives an overview of the entire course.
In this video, we will create a web application, the communication via REST is not optimal. GraphQL is a modern approach without some limitations REST has.
Quick look into REST API of Trello and problems
Discover GraphQL fundamentals
See advantages of GraphQL
In this video, we will learn how the Graph cool will provides a cloud service for a full featured hosted managed database with graphql interface.
Discover features of provided service
Create account and login
Create our project
In this video, we will Start from the scratch and set up a GraphQL schema.
Add Types to Schema: Board, List, Card type
Add relations between Types
Add sample data into the database
In this video, we will learn, how to work with GraphQL operations, the built–inplayground could be used.
Query for boards, lists, details
Modify data with running mutations
Checkout built–in documentation explorer
In this video, to get our own server with our own GraphQL schema we can use cloud-based service “apollo–launchpad”.
Discover Apollo–launchpad and create a new pad
Add the schema of our board and run some GraphQL queries inbuilt–in GraphiQL
Learn about GraphQL and implement resolvers
In this video, instead of working with real data, we do rapid prototyping with fake data.
Activate auto–mocking with simple defaults values
Customize the generated fake data
In this video, we will learn how GraphQL service can load data from many different sources. We can access other REST services for the Board data.
Send REST calls to api.trello.com via node-fetch library
Extend resolvers for fetching board/ lists/card and run queries
Fetch the public data of a specific trellomember
In this video, to implement a GraphQL server we need to integrate our existing schema into a express.js server, for serving the http responses. There exist different libraries for that job. For better understanding, we will check them out and compare their features and how easy they can be used.
Run our server based on apollo-server-express
Run our server based on express-graphql
Run our server based on graphql-yoga
In this video, we will understand how while using the data from Trello per REST calls it still has the disadvantages of REST. We create server to get our own local full-feature realtimeGraphQL database.
Discover graphcool/ prisma: its architecture and its tooling
Setup the data model for running the local server
Start and run the server
In this video, we will learn how to bootstrap our React project for the Board web application.
Download and install node.js runtime
Create basic project structure with create-react-app
Open IDE/editor, configure coding style and linting
In this video, we will learn how to create the main building blocks for the web page, for the Component hierarchy.
Make a Board the new main application page
Create a List and Card component, add to the board
Separate state/data from our components
In this video, we will learn how to wrap our main application Component with Apollo client library. For simplicity we will use the mocked schema with fake data. Then add and run the GraphQL query.
Discover the neededparts of Apollo client library
Add the Apollo client with mocked schema link
Define and add theGraphQL query to fill the Board with data
In this video, we will learn how each UI component represent a specific type of our GraphQL schema. Fragments help to separate these parts in a GraphQL query.
Introduce the “fragment concept” per GraphiQL/playground
Split the GraphQL query into fragments for each UI component
Separate/move the fragments to their UI components
In this video, we will learn how to connect to any GraphQL server we adapt the linking of the Apollo client configuration. Additionally, let’s add query variables.
Use the endpoint URL from the GraphQL-playground, add Apollo-link-http
Adapt the GraphQL wrapping of our Board component with variable component
Select a specific Board by id
Until now we only showed staticData. In this video we will learn how to modify data we need toadapt some current and add extraelements to input texts and toTrigger actions.
Add semanticlibrary, improve CSSstyling to enable fullscreen and scrolling oflong task lists
Add button for a‘new list’ at end oflists
Add button for a‘new card’ at end ofeach list
We already know GraphQLmutations, In this video we will learn how we canintegrate calling them into the UIclient powered by Apollo.
Checkout basicmutations and how toembed with Apollo
Design mutationwith parameters inour playground
Customize forembedding as propsinto our Reactcomponents
Apollo client has a powerful clientside cache and can update theReact UI automatically, In this video we will learn howcan that be triggered andControlled.Find out how to have an optimisticUI.
Discover options fortrigger anyupdate query
Find out how anoptimistic UI can beimplemented to cutturnaround times
In this video, we will learn for editing the cards, we will havea modal dialog, which will havenew UI logic, and send its changesto the GraphQL server on closing.
Implement editablecards, make editor UI
Send update toserver
Update UI on serverresponse, + errordialog
In this video, we will learn for a kanban board we need to beAble to move cards. We need toadd this to the UI and trigger theright mutations on the server.
Add reactant libraryand adapt the UI,prepare
Implementcan drop check
Trigger the mutationfor adding/removingthe Card
GraphQL specification containssubscriptions.In this video we will learn how to use them. Ourprisma server has it enabledout-of-the-box, so we can try them out.
Open the serverplayground anddiscoversubscriptions inthe SchemaExplorer
Analyze asubscription forCards and Lists
Checkout the notification persubscription after Editing aCard
In this video, we will learn that Apollo Link needs to be configured toallow http and websockets connection.
Add Apollolibraries forws-connection
Configure ws link
Switching between both links
In this video, we will learn that When the Board has beenchanged/edited, we want to get itinstantly updated in any anotherbrowser session.
Add aBoard-change-subscription
Connectsubscription toreact component
Discover changes in Apollocache
In this video, we will learn when a Card or a List has been added,then its container needs to be updated. Also when moving a card, how cananother client be updated?
Add aList-subscriptionfor adding cardsor moving Cards
Add Cardsubscription forEditing a card
Adapt delete-all-lists mutation
In this video, we will learn what happens when a Card has beenedited simultaneously in differentclients. Who wins? How can we avoidlosing entered data? Can we givefeedback to a user while editing a Card?We need to check offline/orasynchronous changes on client/server.
Add aversion-field toour Card fortrackingconcurrentchanges
Add indicator foredited Card intoedit-dialog
Add checks and handling ofconflicts whensaving the edited Cardconcurrently
Access to our GraphQL server needs limitation, currently everybody can change anything. In this video we will add a dedicated GraphQL server with only the mutations and queries we need. For user account Mgmt we can use our DB to hold the login/passwords.
We create a newprisma advancedproject with fullfeatured server
Discovering thenew project, itsparts andstructure
Merge our existingdata model andproject database withnew one
In this video, we will learn how besides a login/logoff form on the clientside, we need User management on theserver, where users accounts withpasswords are stored. We will use thesame DB.
Add forms forlogin/ sign-in andadd routing to thispages
Add a navbarshowing thelogged-in user
Manage auth token on client and in server communication
Lets take a look at how the start page will contain the list of auser’s boards.Then he can select and open a specificboard.A user needs to create a board also.
Add board relationto user-data modeland server side,add mutation tocreate a new board
Replace startpage withlist-of-boards,add route andpage for specificboard
Enable all neededmutations to securedserver forauthenticated user
In this video, we will see how each collaboration platform stores and shows who did any change on the board.After authentication we always know whois logged-in and can track that information.
Extend graphqldata-model
Store the user oneach change
Extend the UI to showthe avatar of the lastauthor
In this video, we will learn how while developing, we should findand fix bugs quickly. Therefore weneed to get some insights.Error handling is essential andshould always give us full controland fast feedback.Graphql Error handling…Server error -> Client side.
Explore the tools and practices
Need to have debug logs or even debug our server
Add more feedback tothe user on errors,improved errormessage handling
In this video, we understand how does it always make sense, to loadthe whole board at the beginning?What are the advantages ofsplitting the queries into smallerrequests.
Add queryfor list-of-boards on theserver
Split coolboard component to only hold the ids of thelists
Adapt other parts,final discussion
GraphQL is a query language for APIs and a runtime for fulfilling those queries with your existing data. GraphQL provides a complete and understandable description of the data in your API.
One of the most common problems with REST is over and under fetching of data. GraphQL gives you the flexibility to think of the APIs as a graph and not as endpoints. Hence the execution becomes easier and quicker. GraphQL is a data-fetching API developed by Facebook, which has been using it for five years; it powers millions of devices and most components of the Facebook and Instagram website.
This comprehensive 3-in-1 course is packed with step-by-step instructions, working examples, and helpful advice about GraphQL. You will learn to build your Blog with GraphQL. This friendly course takes you through the use of GraphQL to develop better RESTful Web Services. In this course, you will get an introduction into GraphQL as a bridge for React client application to communicate with servers as the missing data-fetching or query language.
Contents and Overview
This training program includes 3 complete courses, carefully chosen to give you the most comprehensive training possible.
The first course, Learning GraphQL with React and Relay, covers mastering GraphQL by building a blog with React and Relay. In this course, we will learn about GraphQL and how we can use it to create truly decoupled client and server. Writing backend with GraphQL makes our code more declarative wherein the client demands certain data in a particular format and the server responds in a predictable manner. This enables us to evolve our API without versions and iterate on features faster. For front-end and networking, we will use Facebook’s React and Relay respectively. We will learn GraphQL by creating a backend for a blog platform. You will learn about GraphQL schema design, authentication, pagination, testing, query batching and more and how to connect a GraphQL backend to React and Relay client. The course will teach everything to get up and running with GraphQL and React.
The second course, Hands-on GraphQL for Better RESTful Web Services, covers use of GraphQL the new API standard to provide an alternative to REST. In this course, you will start with getting ready to install and explore GraphQL for a better RESTful experience. Explore the architecture and use cases to better understand the package setup and architecture involved. Learn more about the GraphQL server by coding its routes and constructing its schema. All the demonstrations in this video course will be shown through the development of a typical real-world restaurant rating application to better understand of users. Learn how to deal with validation, error handling, and security. Finally, you will learn and know more about caching & batching requests, pagination in GraphQL and so on.
The third course, Hands-on Application Building with GraphQL, covers rapidly building web applications using GraphQL. In this course, you will learn how to build your own Trello-like web application using GraphQL. Build a Graphql server and a client UI and connect this Apollo-based client to the server. You will then learn to add features to your board such as adding or editing a task. You will then see how to implement the shared whiteboard functionality by populating the changes into others sessions and how to solve the conflicts in this real-world scenario with concurrent changes from different users. . The course then shows you how to add authentication to your application to prevent unwanted access to it and user centric web service
Finally, you will learn troubleshooting typical problems that may occur while running your app, and how to fine-tune the schema and communication of client-server. By the end of the course, you will be able to build your own applications using GraphQL.
By the end of the course, you’ll rapidly build web applications, better RESTful Web Services, as well as create a blog using GraphQL, React, and Relay!
About the Authors
Divyendu is from the top part of India, a beautiful place called Jammu and Kashmir. He loves to write code both as a hobby and production level. He has been writing hobby code for over a decade and professionally for 4 years. When not coding he engages in football, reading, travels, food (not in order).
Ashwin Hegde is a Software Engineer and Full Stack JavaScript Engineer with around 7 years' experience in web, mobile and API development for both service and product software development companies. He has experience in Product development from scratch with end-2-end process. Maintenance projects, re-engineering, code review, uniting and Functional testing, enterprise application development, packaging, deployment, and troubleshooting issues related to projects. He learns from other experts across the community and loves open source development and contributions.
Robert Hostlowsky (@rhosts) has been gaining experience in various roles in software development. He currently works at codecentric AG as a senior consultant and as a developer and technical coach, following the goals of high quality and efficiency. Since 2012 He has been an enthusiastic supporter of the software crafts movement. For more than 2 years he has been working with GraphQL. As a speaker at various conferences and meetups, he has presented this topic to more than 500 people.