Beyond REST: Coursera’s Journey to GraphQL Bryan Kane � @bryanskane � bryan-coursera
Chapter One Site speed issues Chapter Two Intro to GraphQL Chapter Three Migrating to GraphQL Chapter Four Learnings and retrospective 4
Load Courses Chapter One Site speed issues Chapter Two Intro to GraphQL Chapter Three Migrating to GraphQL Chapter Four Learnings and retrospective 5
Load Instructors Chapter One Site speed issues Chapter Two Intro to GraphQL Chapter Three Migrating to GraphQL Chapter Four Learnings and retrospective 6
Load Universities Chapter One Site speed issues Chapter Two Intro to GraphQL Chapter Three Migrating to GraphQL Chapter Four Learnings and retrospective 7
Load University Profile Chapter One Site speed issues Chapter Two Intro to GraphQL Chapter Three Migrating to GraphQL Chapter Four Learnings and retrospective 8
Chapter One Site speed issues Chapter Two Intro to GraphQL Chapter Three Migrating to GraphQL Chapter Four Learnings and retrospective 9
Backend Client Chapter One Site speed issues Chapter Two Intro to GraphQL Chapter Three Migrating to GraphQL APIs Chapter Four Learnings and retrospective 10
Backend Client Chapter One Site speed issues Chapter Two Intro to GraphQL Catalog Discussion Courservice Growth Payment Catalog Discussion Courservice Growth Payment Learning Asset Hierarchy Service Emails Recs Enterprise Learning Asset Emails Recs Enterprise Hierarchy Service Chapter Three Migrating to Translations Learning Eventing Auth Users Items GraphQL Learning Translations Items Eventing Auth Users APIs Chapter Four Learnings and retrospective 11
Backend Client Chapter One Site speed issues Chapter Two Intro to GraphQL Catal Discu Cours Grow Paym Learn Asset Email Recs Enter Chapter Three Migrating to GraphQL Transl Learn Event Auth Users APIs Chapter Four Learnings and retrospective 12
Chapter One Site speed partners.v1 instructors.v1 enrollments.v1 issues Chapter Two Intro to GraphQL Catalog courseGrades.v1 enrollments.v2 Chapter Three Migrating to GraphQL Chapter Four Learnings and quizzes.v1 courseVideos.v1 courses.v1 retrospective 13
Chapter One Site speed partners.v1 instructors.v1 enrollments.v1 issues Chapter Two Intro to GraphQL Catalog courseGrades.v1 enrollments.v2 Chapter Three Migrating to GraphQL Chapter Four Learnings and quizzes.v1 courseVideos.v1 courses.v1 retrospective 14
Chapter One Site speed partners.v1 instructors.v1 enrollments.v1 issues Chapter Two Intro to GraphQL Catalog courseGrades.v1 enrollments.v2 Chapter Three Migrating to GraphQL Chapter Four Learnings and quizzes.v1 courseVideos.v1 courses.v1 retrospective 15
Chapter One Site speed partners.v1 instructors.v1 enrollments.v1 issues Chapter Two Intro to GraphQL Catalog courseGrades.v1 enrollments.v2 Chapter Three Migrating to GraphQL Chapter Four Learnings and quizzes.v1 courseVideos.v1 courses.v1 retrospective 16
Backend Client Chapter One Site speed issues Chapter Two Intro to GraphQL Catal Discu Cours Grow Paym Catalog Discussion Courservice Growth Payment Learn Asset Email Recs Enter Learning Asset Emails Recs Enterprise Hierarchy Service Chapter Three Migrating to Translations Learning Eventing Auth Users Items GraphQL Transl Learn Event Auth Users APIs Chapter Four Learnings and retrospective 17
Chapter One Site speed issues Chapter Two We didn’t break up the monolith — Intro to GraphQL Chapter Three we just moved it to the clients. Migrating to GraphQL Chapter Four Learnings and retrospective 18
Chapter One Site speed issues Chapter Two Intro to GraphQL Chapter Three Migrating to GraphQL Chapter Four Learnings and retrospective 19
GraphQL is a Chapter One Site speed issues Chapter Two Intro to GraphQL query language , Chapter Three Migrating to GraphQL not a library. Chapter Four Learnings and retrospective 20
query MyCoursesQuery { myCourses(limit: 5, sortBy: RECENT) { name Chapter One Site speed slug issues instructors { firstName Chapter Two Intro to GraphQL lastName university(filter: VISIBLE_TO_LEARNERS) { name Chapter Three Migrating to country GraphQL slug } Chapter Four Learnings and } retrospective } } 21
query MyCoursesQuery { myCourses(limit: 5, sortBy: RECENT) { name Chapter One Site speed slug issues instructors { firstName Chapter Two Intro to GraphQL lastName university(filter: VISIBLE_TO_LEARNERS) { name Chapter Three Migrating to country GraphQL slug } Chapter Four Learnings and } retrospective } } 22
query MyCoursesQuery { myCourses(limit: 5, sortBy: RECENT) { name Chapter One Site speed slug issues instructors { firstName Chapter Two Intro to GraphQL lastName university(filter: VISIBLE_TO_LEARNERS) { name Chapter Three Migrating to country GraphQL slug } Chapter Four Learnings and } retrospective } } 23
query MyCoursesQuery { myCourses(limit: 5, sortBy: RECENT) { name Chapter One Site speed slug issues instructors { firstName Chapter Two Intro to GraphQL lastName university(filter: VISIBLE_TO_LEARNERS) { name Chapter Three Migrating to country GraphQL slug } Chapter Four Learnings and } retrospective } } 24
query MyCoursesQuery { myCourses(limit: 5, sortBy: RECENT) { name Chapter One Site speed slug issues instructors { firstName Chapter Two Intro to GraphQL lastName university(filter: VISIBLE_TO_LEARNERS) { name Chapter Three Migrating to country GraphQL slug } Chapter Four Learnings and } retrospective } } 25
{ "myCourses": [ { Chapter One "name": "Machine Learning", Site speed issues "slug": "machine-learning", "instructors": [ Chapter Two { Intro to GraphQL "firstName": "Andrew", "lastName": "Ng" Chapter Three "university": { Migrating to GraphQL "name": "Stanford University", "country": "United States", Chapter Four "slug": "stanford" Learnings and } retrospective }] }] } 26
Chapter One Site speed query MyCoursesQuery { { issues myCourses(limit: 5, sortBy: RECENT) { "myCourses": [{ name "name": "Machine Learning", Chapter Two slug "slug": "machine-learning", Intro to GraphQL instructors { "instructors": [{ firstName "firstName": "Andrew", lastName "lastName": "Ng" university(filter: VISIBLE_TO_LEARNERS) { "university": { name "name": "Stanford University", Chapter Three Migrating to country "country": "United States", GraphQL slug “slug": "stanford" } } } }] Chapter Four } }] Learnings and } } retrospective 27
Chapter One Site speed issues Chapter Two Intro to GraphQL Chapter Three Migrating to GraphQL Chapter Four Learnings and retrospective 28
Chapter One Site speed <Course /> issues query CoursePage { course(slug: "machine-learning") { title Chapter Two description } Intro to GraphQL } Chapter Three Migrating to GraphQL Chapter Four Learnings and retrospective 29
Chapter One Site speed <Course /> issues query CoursePage { course(slug: "machine-learning") { title Chapter Two description <University /> Intro to GraphQL university { name logo } } Chapter Three } Migrating to GraphQL Chapter Four Learnings and retrospective 30
Chapter One Site speed <Course /> issues query CoursePage { course(slug: "machine-learning") { title Chapter Two description <University /> Intro to GraphQL university { name logo } instructor { <Instructor /> Chapter Three name Migrating to title } GraphQL } } Chapter Four Learnings and retrospective 31
Chapter One Site speed <Course /> issues query CoursePage { course(slug: machine-learning") { title Chapter Two description <University /> Intro to GraphQL university { name logo } instructor { <Instructor /> Chapter Three name Migrating to title <ProfilePhoto /> profile { GraphQL photo } } Chapter Four } Learnings and } retrospective 32
Chapter One Site speed issues All queries are backed Chapter Two Intro to GraphQL by a typed schema Chapter Three Migrating to GraphQL Chapter Four Learnings and retrospective 33
type root { myCourses(limit: Int, sortBy: COURSE_SORT): [Course] } Chapter One Site speed enum COURSE_SORT { issues RECENT ENROLL_DATE Chapter Two } Intro to GraphQL type Course { name: String Chapter Three slug: String Migrating to GraphQL instructors: [Instructor] } Chapter Four Learnings and type Instructor { retrospective firstName: String lastName: String university(filter: VISIBILITY_FILTER): University } 34
Recommend
More recommend