Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.
GraphQL + Neo4j
Full Stack Development With
William Lyon
@lyonwj
lyonwj.com
William Lyon
DevRel Engineering @neo4j
will@neo4j.com
@lyonwj
lyonwj.com
GraphQL + Neo4j
● An overview of GraphQL
● Building a GraphQL service
● Neo4j-GraphQL integration(s)
@lyonwj | lyonwj.com
An Overview Of GraphQL
● A new paradigm for buildings APIs
● Schema definition
○ Types
○ GraphQL entry points (Query & Mut...
bit.ly/_graphiql
Building A GraphQL Service
1) Define a schema
2) Implement resolver functions
○ Fetch data from data layer
@lyonwj | lyonw...
Building A GraphQL Service
https://dzone.com/refcardz/an-overview-of-graphql
@lyonwj | lyonwj.com
GraphQL First Development
1. Design API schema
2. Build UI and backend
3. Deploy!
• Schema is your friend
• GraphQL Schema...
IDL Schema Syntax
type Movie {
movieId: ID!
title: String
year: Int
plot: String
poster: String
imdbRating: Float
genres: ...
GraphQL Resolver Functions
https://github.com/grand-stack/grand-stack-movies-workshop/blob/master/graphql/end/src/schema.js
GraphQL Resolver Functions
https://github.com/grand-stack/grand-stack-movies-workshop/blob/master/graphql/end/src/schema.js
Apollo Launchpad
https://launchpad.graphql.com/x57134qwl
A GraphQL - Neo4j Integration?
● Developer productivity
● Translate GraphQL → Cypher?
● Improve performance?
● Expose Cyph...
neo4j-graphql
github.com/neo4j-graphql/neo4j-graphql-js
neo4j.com/developer/graphql/
github.com/neo4j-graphql/neo4j-graphql
Use The Schema, Luke
Use The Schema, Luke
https://github.com/neo4j-graphql/
Improved Performance
● N+1 query problem
○ Batching
● GraphQL → single Cypher query
○ Single round trip to database
@lyonw...
Expose Cypher in GraphQL
● GraphQL directives
● @cypher schema directive
○ Map GraphQL fields to a Cypher query
@lyonwj | ...
@cypher Schema Directives
● Still a single Cypher query / single round-trip
○ @cypher annotated query becomes a sub-query
...
neo4j-graphql-js
github.com/neo4j-graphql/neo4j-graphql-jshttps://launchpad.graphql.com/7kp8l0p4j
Auto-generate Cypher que...
The GRAND stack
grandstack.io
The GRAND stack
grandstack.io
Looking Forward
● Active development
○ Feedback driven :-)
● Features
○ Subscriptions
○ Authentication / Authorization
○ ?...
(you)-[:HAVE]->(questions)<-[:ANSWERS]-(will)
@lyonwj | lyonwj.com
Upcoming SlideShare
Loading in …5
×

Full Stack Development with Neo4j and GraphQL

Training materials from the GraphQL training session at GraphConnect NYC 2017.

  • Login to see the comments

Full Stack Development with Neo4j and GraphQL

  1. 1. GraphQL + Neo4j Full Stack Development With William Lyon @lyonwj lyonwj.com
  2. 2. William Lyon DevRel Engineering @neo4j will@neo4j.com @lyonwj lyonwj.com
  3. 3. GraphQL + Neo4j ● An overview of GraphQL ● Building a GraphQL service ● Neo4j-GraphQL integration(s) @lyonwj | lyonwj.com
  4. 4. An Overview Of GraphQL ● A new paradigm for buildings APIs ● Schema definition ○ Types ○ GraphQL entry points (Query & Mutation types) ● Query language for APIs ○ Limited support for “queries” (aggregations, filtering, …) ● Community of tools ○ GraphiQL ○ Mocking ○ Performance monitoring @lyonwj | lyonwj.com
  5. 5. bit.ly/_graphiql
  6. 6. Building A GraphQL Service 1) Define a schema 2) Implement resolver functions ○ Fetch data from data layer @lyonwj | lyonwj.com
  7. 7. Building A GraphQL Service https://dzone.com/refcardz/an-overview-of-graphql @lyonwj | lyonwj.com
  8. 8. GraphQL First Development 1. Design API schema 2. Build UI and backend 3. Deploy! • Schema is your friend • GraphQL Schema is the API spec • Allows for simultaneous frontend and backend development • Enables introspection • Build other tools (graphiql) https://dev-blog.apollodata.com/navigating-your-transition-to-graphql-28a4dfa3acfb
  9. 9. IDL Schema Syntax type Movie { movieId: ID! title: String year: Int plot: String poster: String imdbRating: Float genres: [String] similar(first: Int=3, offset:Int=0): [Movie] } type Query { moviesByTitle(subString: String!, first: Int=3, offset: Int=0): [Movie] }
  10. 10. GraphQL Resolver Functions https://github.com/grand-stack/grand-stack-movies-workshop/blob/master/graphql/end/src/schema.js
  11. 11. GraphQL Resolver Functions https://github.com/grand-stack/grand-stack-movies-workshop/blob/master/graphql/end/src/schema.js
  12. 12. Apollo Launchpad https://launchpad.graphql.com/x57134qwl
  13. 13. A GraphQL - Neo4j Integration? ● Developer productivity ● Translate GraphQL → Cypher? ● Improve performance? ● Expose Cypher through GraphQL? @lyonwj | lyonwj.com
  14. 14. neo4j-graphql github.com/neo4j-graphql/neo4j-graphql-js neo4j.com/developer/graphql/ github.com/neo4j-graphql/neo4j-graphql
  15. 15. Use The Schema, Luke
  16. 16. Use The Schema, Luke https://github.com/neo4j-graphql/
  17. 17. Improved Performance ● N+1 query problem ○ Batching ● GraphQL → single Cypher query ○ Single round trip to database @lyonwj | lyonwj.com
  18. 18. Expose Cypher in GraphQL ● GraphQL directives ● @cypher schema directive ○ Map GraphQL fields to a Cypher query @lyonwj | lyonwj.com
  19. 19. @cypher Schema Directives ● Still a single Cypher query / single round-trip ○ @cypher annotated query becomes a sub-query @lyonwj | lyonwj.com
  20. 20. neo4j-graphql-js github.com/neo4j-graphql/neo4j-graphql-jshttps://launchpad.graphql.com/7kp8l0p4j Auto-generate Cypher queries Works with apollo-server, graphql-tools, graphql-js,...
  21. 21. The GRAND stack grandstack.io
  22. 22. The GRAND stack grandstack.io
  23. 23. Looking Forward ● Active development ○ Feedback driven :-) ● Features ○ Subscriptions ○ Authentication / Authorization ○ ???? will@neo4j.com neo4j.com/developer/graphql/ grandstack.io/ @lyonwj | lyonwj.com
  24. 24. (you)-[:HAVE]->(questions)<-[:ANSWERS]-(will) @lyonwj | lyonwj.com

×