Full Stack GraphQL Applications: With React, Node.js, and Neo4j

This document was uploaded by one of our users. The uploader already confirmed that they had the permission to publish it. If you are author/publisher or own the copyright of this documents, please report to us by using this DMCA report form.

Simply click on the Download Book button.

Yes, Book downloads on Ebookily are 100% Free.

Sometimes the book is free on Amazon As well, so go ahead and hit "Search on Amazon"

Build hyper-fast and hyper-efficient web applications with GraphQL! This practical, comprehensive guide introduces the powerful GRANDStack for developing full stack web applications based in graph data structures. In Full Stack GraphQL Applications you will learn how to: • Build backend functionalities for GraphQL applications • Model a GraphQL API with GraphQL type definitions • Utilize Neo4j as a backend database • Handle authentication and authorization with GraphQL • Implement pagination and rate limiting in a GraphQL API • Develop a GraphQL service with Apollo Server • Install Neo4j Database on different platforms • Create a basic frontend application using React and Apollo Client • Deploy a full stack GraphQL application to the cloud The GraphQL query language radically reduces over-fetching or under-fetching of data by constructing precise graph-based data requests. In Full Stack GraphQL Applications you’ll learn how to build graph-aware web applications that take full advantage of GraphQL’s amazing efficiency. Neo4j’s William Lyon teaches you everything you need to know to design, deploy, and maintain a GraphQL API from scratch. He reveals how you can build your web apps with GraphQL, React, Apollo, and Neo4j Database, aka “the GRANDstack,” to get maximum performance out of GraphQL. About the technology The GraphQL API query language radically streamlines data exchanges with backend servers by representing application data as easy-to-understand graphs. You can amplify GraphQL’s benefits by using graph-aware tools and data stores, like React, Apollo, and Neo4j, throughout your application. A full stack graph approach provides a consistent data model end to end, reducing friction in data fetching and increasing developer productivity. About the book Full Stack GraphQL Applications teaches you to build graph-aware web applications using GraphQL, React, Apollo, and the Neo4j database, collectively called “the GRANDstack.” Practical, hands-on examples quickly develop your understanding of how the GRANDstack fits together. As you go, you’ll create and deploy to the cloud a full-featured web application that includes search, authentication, and more. Soon, you’ll be ready to deploy end-to-end applications that take full advantage of GraphQL’s outstanding performance. What's inside • Building a GraphQL backend using Neo4j • Authentication and authorization with GraphQL • Pagination and GraphQL abstract types • A basic frontend application using React and Apollo Client • Deploying to the cloud with Netlify, AWS Lambda, Auth0, and Neo4j Aura About the reader For full stack web developers. No experience with GraphQL or graph databases required. About the author William Lyon is a Staff Developer Advocate at Neo4j and blogger at lyonwj.com. Full Stack GraphQL Applications teaches you to leverage the power of GraphQL to create modern APIs that streamline data loads by allowing client applications to selectively fetch only the data required.

Over-fetching or under-fetching data from REST APIs can make your applications slow and unreliable. The GraphQL query language offers a solution with a new API paradigm, reducing loads by constructing precise graph-based data requests. In Full
Stack GraphQL Applications you’ll learn to build graph-aware end-to-end web applications using GraphQL, React, Apollo, and the Neo4j graph database.

Full Stack GraphQL Applications teaches you to leverage the power of GraphQL to create modern APIs that streamline data loads by allowing client applications to selectively fetch only the data required. By the end, you’ll be able to deploy all of the components of a serverless full stack application in a secure and cost-effective way that takes full advantage of GraphQL’s performance capabilities.

Purchase of the print book includes a free eBook in PDF, Kindle, and ePub formats from Manning Publications.

Author(s): William Lyon
Edition: 1
Publisher: Manning Publications
Year: 2022

Language: English
Commentary: Vector PDF
Pages: 264
City: Shelter Island, NY
Tags: JavaScript; Web Applications; GraphQL; Neo4j; Node.js; AWS Lambda; Serverless Applications; Full-Stack Development; React.js; Apollo

Full Stack GraphQL Applications
brief contents
contents
preface
acknowledgments
about this book
Who should read this book?
How this book is organized: A roadmap
About the code
Software/hardware requirements
liveBook discussion forum
Other online resources
about the author
about the cover illustration
Part 1: Getting started with full stack GraphQL
Chapter 1: What is full stack GraphQL?
1.1 A look at full stack GraphQL
1.2 GraphQL
1.2.1 GraphQL type definitions
1.2.2 Querying with GraphQL
1.2.3 Advantages of GraphQL
1.2.4 Disadvantages of GraphQL
1.2.5 GraphQL tooling
1.3 React
1.3.1 React components
1.3.2 JSX
1.3.3 React tooling
1.4 Apollo
1.4.1 Apollo Server
1.4.2 Apollo Client
1.5 Neo4j Database
1.5.1 Property graph data model
1.5.2 Cypher query language
1.5.3 Neo4j tooling
1.6 How it all fits together
1.6.1 React and Apollo Client: Making the request
1.6.2 Apollo Server and GraphQL backend
1.6.3 React and Apollo Client: Handling the response
1.7 What we will build in this book
1.8 Exercises
Chapter 2: Graph thinking with GraphQL
2.1 Your application data is a graph
2.2 Graphs in GraphQL
2.2.1 API modeling with type definitions: GraphQL-first development
2.2.2 Resolving data with resolvers
2.2.3 Our first resolver
2.3 Combining type definitions and resolvers with Apollo Server
2.3.1 Using Apollo Server
2.3.2 Apollo Studio
2.3.3 Implementing resolvers
2.3.4 Querying using Apollo Studio
2.4 Exercises
Chapter 3: Graphs in the database
3.1 Neo4j overview
3.2 Graph data modeling with Neo4j
3.2.1 The property graph model
3.2.2 Database constraints and indexes
3.3 Data modeling considerations
3.3.1 Node vs. property
3.3.2 Node vs. relationship
3.3.3 Indexes
3.3.4 Specificity of relationship types
3.3.5 Choosing a relationship direction
3.4 Tooling: Neo4j desktop
3.5 Tooling: Neo4j Browser
3.6 Cypher
3.6.1 Pattern matching
3.6.2 Properties
3.6.3 CREATE
3.6.4 MERGE
3.6.5 Defining database constraints with cypher
3.6.6 MATCH
3.6.7 Aggregations
3.7 Using the Neo4j client drivers
3.8 Exercises
Chapter 4: The Neo4j GraphQL Library
4.1 Common GraphQL problems
4.1.1 Poor performance and the n + 1 query problem
4.1.2 Boilerplate and developer productivity
4.2 Introducing GraphQL database integrations
4.3 The Neo4j GraphQL Library
4.3.1 Project setup
4.3.2 Generated GraphQL schema from type definitions
4.4 Basic GraphQL queries
4.5 Ordering and pagination
4.6 Nested queries
4.7 Filtering
4.7.1 where argument
4.7.2 Nested filter
4.7.3 Logical operators: AND, OR
4.7.4 Filtering in selections
4.8 Working with temporal fields
4.8.1 Using a Date type in queries
4.8.2 Date and DateTime filters
4.9 Working with spatial data
4.9.1 The Point type in selections
4.9.2 Distance filter
4.10 Adding custom logic to our GraphQL API
4.10.1 The @cypher GraphQL schema directive
4.10.2 Implementing custom resolvers
4.11 Introspecting GraphQL schema from an existing database
4.12 Exercises
Part 2: Building the frontend
Chapter 5: Building user interfaces with React
5.1 React overview
5.1.1 JSX and React elements
5.1.2 React components
5.1.3 Component hierarchy
5.2 Create React App
5.2.1 Creating a React application with Create React App
5.3 State and React Hooks
5.4 Exercises
Chapter 6: Client-side GraphQL with React and Apollo Client
6.1 Apollo Client
6.1.1 Adding Apollo Client to our React Application
6.1.2 Apollo Client hooks
6.1.3 GraphQL variables
6.1.4 GraphQL fragments
6.1.5 Caching with Apollo Client
6.2 GraphQL mutations
6.2.1 Creating nodes
6.2.2 Creating relationships
6.2.3 Updating and deleting
6.3 Client state management with GraphQL
6.3.1 Local-only fields and reactive variables
6.4 Exercises
Part 3: Full stack considerations
Chapter 7: Adding authorization and authentication
7.1 Authorization in GraphQL: A naive approach
7.2 JSON Web Tokens
7.3 The @auth GraphQL schema directive
7.3.1 Rules and operations
7.3.2 The isAuthenticated authorization rule
7.3.3 The roles authorization rule
7.3.4 The allow authorization rule
7.3.5 The where authorization rule
7.3.6 The bind authorization rule
7.4 Auth0: JWT as a service
7.4.1 Configuring Auth0
7.4.2 Auth0 React
7.5 Exercises
Chapter 8: Deploying our full stack GraphQL application
8.1 Deploying our full stack GraphQL application
8.1.1 Advantages of this deployment approach
8.1.2 Disadvantages of our deployment approach
8.1.3 Overview of our approach to full stack GraphQL
8.2 Neo4j Aura database as a service
8.2.1 Creating a Neo4j Aura cluster
8.2.2 Connecting to a Neo4j Aura cluster
8.2.3 Uploading data to Neo4j Aura
8.2.4 Exploring the graph with Neo4j Bloom
8.3 Deploying a React application with Netlify Build
8.3.1 Adding a site to Netlify
8.3.2 Setting environment variables for Netlify builds
8.3.3 Netlify deploy previews
8.4 Serverless GraphQL with AWS Lambda and Netlify Functions
8.4.1 Serving a GraphQL API as a Lambda function
8.4.2 The Netlify dev CLI
8.4.3 Converting our GraphQL API to a Netlify function
8.4.4 Adding a custom domain in Netlify
8.5 Our deployment approach
8.6 Exercises
Chapter 9: Advanced GraphQL considerations
9.1 GraphQL abstract types
9.1.1 Interface types
9.1.2 Union types
9.1.3 Using abstract types with the Neo4j GraphQL library
9.2 Pagination with GraphQL
9.2.1 Offset pagination
9.2.2 Cursor pagination
9.3 Relationship properties
9.3.1 Interfaces and the @relationship GraphQL schema directive
9.3.2 Creating relationship properties
9.4 Wrapping up Full Stack GraphQL
9.5 Exercises
index
Symbols
Numerics
A
B
C
D
E
F
G
H
I
J
L
M
N
O
P
Q
R
S
T
U
W
Y