effortless graphql with transactional nosql · 2019-09-19 · confidential © fauna, inc. 2019...
TRANSCRIPT
![Page 1: Effortless GraphQL with Transactional NoSQL · 2019-09-19 · Confidential © Fauna, Inc. 2019 Agenda • What is GraphQL? • What is FaunaDB? • The GraphQL Ecosystem • Get Started](https://reader033.vdocuments.us/reader033/viewer/2022042300/5eca98d82fcc5c7ee06896bd/html5/thumbnails/1.jpg)
Confidential © Fauna, Inc. 2019
Effortless GraphQL
with Transactional
NoSQL
![Page 2: Effortless GraphQL with Transactional NoSQL · 2019-09-19 · Confidential © Fauna, Inc. 2019 Agenda • What is GraphQL? • What is FaunaDB? • The GraphQL Ecosystem • Get Started](https://reader033.vdocuments.us/reader033/viewer/2022042300/5eca98d82fcc5c7ee06896bd/html5/thumbnails/2.jpg)
Confidential © Fauna, Inc. 2019
Founded in 2012 by the team that scaled Twitter’s infrastructure
$25M Series A, largest ever by an OLTP database company
Headquartered in Boston, MA and San Francisco, CA
FaunaDB : A cloud-first operational database for enterprises
Fauna: Overview
2
Our Angels
Kevin Scott
CTO, Microsoft
Olivier Pomel
CEO, Datadog
Mazen Al-Rawashdeh
VP, eBay
Larry Gadea
CEO, Envoy Our Investors
![Page 3: Effortless GraphQL with Transactional NoSQL · 2019-09-19 · Confidential © Fauna, Inc. 2019 Agenda • What is GraphQL? • What is FaunaDB? • The GraphQL Ecosystem • Get Started](https://reader033.vdocuments.us/reader033/viewer/2022042300/5eca98d82fcc5c7ee06896bd/html5/thumbnails/3.jpg)
Confidential © Fauna, Inc. 2019
Agenda
• What is GraphQL?
• What is FaunaDB?
• The GraphQL Ecosystem
• Get Started (So Easy!)
• FaunaDB’s GraphQL API
![Page 4: Effortless GraphQL with Transactional NoSQL · 2019-09-19 · Confidential © Fauna, Inc. 2019 Agenda • What is GraphQL? • What is FaunaDB? • The GraphQL Ecosystem • Get Started](https://reader033.vdocuments.us/reader033/viewer/2022042300/5eca98d82fcc5c7ee06896bd/html5/thumbnails/4.jpg)
Confidential © Fauna, Inc. 2019 4
• Unified API
• Decouples Backend and Frontend
• Specify the shape of data you want on the
front end, and let the backend decide how to
get it
• GraphQL engine handles composing queries
and data
What is GraphQL?
![Page 5: Effortless GraphQL with Transactional NoSQL · 2019-09-19 · Confidential © Fauna, Inc. 2019 Agenda • What is GraphQL? • What is FaunaDB? • The GraphQL Ecosystem • Get Started](https://reader033.vdocuments.us/reader033/viewer/2022042300/5eca98d82fcc5c7ee06896bd/html5/thumbnails/5.jpg)
Confidential © Fauna, Inc. 2019
• One request, any data
• One endpoint
• Opinionated– in a good way
• Self documenting
• Pairs well with FaunaDB
Why GraphQL
5
![Page 6: Effortless GraphQL with Transactional NoSQL · 2019-09-19 · Confidential © Fauna, Inc. 2019 Agenda • What is GraphQL? • What is FaunaDB? • The GraphQL Ecosystem • Get Started](https://reader033.vdocuments.us/reader033/viewer/2022042300/5eca98d82fcc5c7ee06896bd/html5/thumbnails/6.jpg)
Confidential © Fauna, Inc. 2019
• Serverless & globally distributed
• Relational NoSQL
• ACID transactions
• Temporal data retention
• Security / RBAC
• SaaS multi-tenancy
Why FaunaDB
6
![Page 7: Effortless GraphQL with Transactional NoSQL · 2019-09-19 · Confidential © Fauna, Inc. 2019 Agenda • What is GraphQL? • What is FaunaDB? • The GraphQL Ecosystem • Get Started](https://reader033.vdocuments.us/reader033/viewer/2022042300/5eca98d82fcc5c7ee06896bd/html5/thumbnails/7.jpg)
Confidential © Fauna, Inc. 2019
GraphQL Ecosystem
7
![Page 8: Effortless GraphQL with Transactional NoSQL · 2019-09-19 · Confidential © Fauna, Inc. 2019 Agenda • What is GraphQL? • What is FaunaDB? • The GraphQL Ecosystem • Get Started](https://reader033.vdocuments.us/reader033/viewer/2022042300/5eca98d82fcc5c7ee06896bd/html5/thumbnails/8.jpg)
Confidential © Fauna, Inc. 2019
GraphQL Stack
8
![Page 9: Effortless GraphQL with Transactional NoSQL · 2019-09-19 · Confidential © Fauna, Inc. 2019 Agenda • What is GraphQL? • What is FaunaDB? • The GraphQL Ecosystem • Get Started](https://reader033.vdocuments.us/reader033/viewer/2022042300/5eca98d82fcc5c7ee06896bd/html5/thumbnails/9.jpg)
Confidential © Fauna, Inc. 2019
GraphQL, Simplified
9
![Page 10: Effortless GraphQL with Transactional NoSQL · 2019-09-19 · Confidential © Fauna, Inc. 2019 Agenda • What is GraphQL? • What is FaunaDB? • The GraphQL Ecosystem • Get Started](https://reader033.vdocuments.us/reader033/viewer/2022042300/5eca98d82fcc5c7ee06896bd/html5/thumbnails/10.jpg)
Confidential © Fauna, Inc. 2019
FaunaDB GraphQL API
10
https://fauna.com/blog/getting-started-with-graphql-part-1-importing-and-querying-your-
schema
![Page 11: Effortless GraphQL with Transactional NoSQL · 2019-09-19 · Confidential © Fauna, Inc. 2019 Agenda • What is GraphQL? • What is FaunaDB? • The GraphQL Ecosystem • Get Started](https://reader033.vdocuments.us/reader033/viewer/2022042300/5eca98d82fcc5c7ee06896bd/html5/thumbnails/11.jpg)
Confidential © Fauna, Inc. 2019
type Todo {
title: String!
completed: Boolean!
list: List
}
type List {
title: String!
todos: [Todo] @relation
}
type Query {
allTodos: [Todo!]
todosByCompletedFlag(completed: Boolean!): [Todo!]
allLists: [List!]
}
Import a Schema
11
![Page 12: Effortless GraphQL with Transactional NoSQL · 2019-09-19 · Confidential © Fauna, Inc. 2019 Agenda • What is GraphQL? • What is FaunaDB? • The GraphQL Ecosystem • Get Started](https://reader033.vdocuments.us/reader033/viewer/2022042300/5eca98d82fcc5c7ee06896bd/html5/thumbnails/12.jpg)
Confidential © Fauna, Inc. 2019
input ListTodosRelation {
create: [TodoInput]
connect: [ID]
disconnect: [ID]
}
input TodoInput {
title: String!
completed: Boolean!
list: TodoListRelation
}
See the Generated Schema
12
![Page 13: Effortless GraphQL with Transactional NoSQL · 2019-09-19 · Confidential © Fauna, Inc. 2019 Agenda • What is GraphQL? • What is FaunaDB? • The GraphQL Ecosystem • Get Started](https://reader033.vdocuments.us/reader033/viewer/2022042300/5eca98d82fcc5c7ee06896bd/html5/thumbnails/13.jpg)
Confidential © Fauna, Inc. 2019
FaunaDB Schema Elements
13
• The Generated FaunaDB schema can be queried via FQL or GraphQL
• CQL, SQL coming soon
![Page 14: Effortless GraphQL with Transactional NoSQL · 2019-09-19 · Confidential © Fauna, Inc. 2019 Agenda • What is GraphQL? • What is FaunaDB? • The GraphQL Ecosystem • Get Started](https://reader033.vdocuments.us/reader033/viewer/2022042300/5eca98d82fcc5c7ee06896bd/html5/thumbnails/14.jpg)
Confidential © Fauna, Inc. 2019
Create Documents
14
mutation CreateAListWithTodos {
createList(data: {
title: "The Basics",
todos: { create: [
{completed: false, title: "Water"},
{completed: false, title: "Food"},
{completed: false, title: "Shelter"}]},
}) {
title
_id
todos {
data {
title
}
}
}
}
![Page 15: Effortless GraphQL with Transactional NoSQL · 2019-09-19 · Confidential © Fauna, Inc. 2019 Agenda • What is GraphQL? • What is FaunaDB? • The GraphQL Ecosystem • Get Started](https://reader033.vdocuments.us/reader033/viewer/2022042300/5eca98d82fcc5c7ee06896bd/html5/thumbnails/15.jpg)
Confidential © Fauna, Inc. 2019
Query a List with Todos
15
query FindAListByID {
findListByID(id: "235692310689481217") {
title
todos {
data {
title
completed
_id
}
}
}
}
![Page 16: Effortless GraphQL with Transactional NoSQL · 2019-09-19 · Confidential © Fauna, Inc. 2019 Agenda • What is GraphQL? • What is FaunaDB? • The GraphQL Ecosystem • Get Started](https://reader033.vdocuments.us/reader033/viewer/2022042300/5eca98d82fcc5c7ee06896bd/html5/thumbnails/16.jpg)
Confidential © Fauna, Inc. 2019
Mark a Todo as Completed
16
mutation UpdateATodo {
updateTodo(id: "235692310694724097", data: {
title: "Build an awesome app!"
completed: true
}) {
title
completed
}
}
![Page 17: Effortless GraphQL with Transactional NoSQL · 2019-09-19 · Confidential © Fauna, Inc. 2019 Agenda • What is GraphQL? • What is FaunaDB? • The GraphQL Ecosystem • Get Started](https://reader033.vdocuments.us/reader033/viewer/2022042300/5eca98d82fcc5c7ee06896bd/html5/thumbnails/17.jpg)
Confidential © Fauna, Inc. 2019
Query for Completed Todos
17
query FindAllCompletedTodos {
todosByCompletedFlag(completed: true) {
data {
title
}
}
}
![Page 18: Effortless GraphQL with Transactional NoSQL · 2019-09-19 · Confidential © Fauna, Inc. 2019 Agenda • What is GraphQL? • What is FaunaDB? • The GraphQL Ecosystem • Get Started](https://reader033.vdocuments.us/reader033/viewer/2022042300/5eca98d82fcc5c7ee06896bd/html5/thumbnails/18.jpg)
Confidential © Fauna, Inc. 2019
Query for Completed Todos (FQL)
18
Map(Paginate(
Match(
Index("todosByCompletedFlag"), true)),
(todo) => Get(todo))
![Page 19: Effortless GraphQL with Transactional NoSQL · 2019-09-19 · Confidential © Fauna, Inc. 2019 Agenda • What is GraphQL? • What is FaunaDB? • The GraphQL Ecosystem • Get Started](https://reader033.vdocuments.us/reader033/viewer/2022042300/5eca98d82fcc5c7ee06896bd/html5/thumbnails/19.jpg)
Confidential © Fauna, Inc. 2019
clearDone(id: ID!): [Todo!] @resolver(name: "clear_done")
CreateFunction({
name: "clear_done",
body: Query(Lambda(["list_id"],
Map(Paginate(Match(Index("list_todos_by_list"), Var("list_id"))),
(todoRef) => Let({ todo : Get(todoRef)},
If(Select(["data", "completed"], Var("todo")),
Delete(todoRef),
Var("todo")
)))
))
})
Let’s Get Transactional
19
![Page 20: Effortless GraphQL with Transactional NoSQL · 2019-09-19 · Confidential © Fauna, Inc. 2019 Agenda • What is GraphQL? • What is FaunaDB? • The GraphQL Ecosystem • Get Started](https://reader033.vdocuments.us/reader033/viewer/2022042300/5eca98d82fcc5c7ee06896bd/html5/thumbnails/20.jpg)
Confidential © Fauna, Inc. 2019
Next Steps
FaunaDB Cloud
• GraphQL tutorial:
https://docs.fauna.com/fauna/current/graphql
• Free database signup: https://fauna.com
![Page 21: Effortless GraphQL with Transactional NoSQL · 2019-09-19 · Confidential © Fauna, Inc. 2019 Agenda • What is GraphQL? • What is FaunaDB? • The GraphQL Ecosystem • Get Started](https://reader033.vdocuments.us/reader033/viewer/2022042300/5eca98d82fcc5c7ee06896bd/html5/thumbnails/21.jpg)
Confidential © Fauna, Inc. 2019
Thank You