Skip to content
Code and examples from my talk - Curious Cases of GraphQL
Branch: master
Clone or download
Dabit
Latest commit cb67d47 Jul 25, 2019
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
README.md updated readme Jul 26, 2019
header.png initial commit Jun 12, 2019

README.md

Curious Cases of GraphQL

Case 1: Real-time collaborative drawing canvas with GraphQL & AWS AppSync

GitHub repo

Base schema:

type Canvas @model {
  id: ID!
  clientId: String!
  data: String!
}

type Mutation {
  createCanvas(input: CreateCanvasInput!): Canvas
  updateCanvas(input: UpdateCanvasInput!): Canvas
  deleteCanvas(input: DeleteCanvasInput!): Canvas
}

type Query {
  getCanvas(id: ID!): Canvas
  listCanvass(filter: ModelCanvasFilterInput, limit: Int, nextToken: String): ModelCanvasConnection
}


type Subscription {
  onCreateCanvas: Canvas @aws_subscribe(mutations: ["createCanvas"])
  onUpdateCanvas: Canvas @aws_subscribe(mutations: ["updateCanvas"])
}

Case 2: GraphQL Image Rekognition

GitHub repo

Base schema

type ImageData {
  data: String!
}

type Query {
  fetchImage(imageInfo: String!): ImageData
}

Case 3: SpeakerChat - Real-time event comment platform with markdown support

GitHub repo

Base schema:

type Talk @model {
  id: ID!
  title: String!
  speakerName: String!
  clientId: ID
  speakerImage: String
  comments: [Comment] @connection(name: "TalkComments")
}

type Comment @model {
  id: ID!
  talkId: ID!
  clientId: ID
  talk: Talk @connection(sortField: "createdAt", name: "TalkComments", keyField: "talkId")
  text: String
  createdAt: String
  createdBy: String
}

type ModelCommentConnection {
  items: [Comment]
  nextToken: String
}

type Subscription {
  onCreateCommentWithId(talkId: ID!): Comment
		@aws_subscribe(mutations: ["createComment"])
}

type Query {
  listCommentsForTalk(talkId: ID!): ModelCommentConnection
}

Case 4: Hype Beats

GitHub repo

Base schema:

type DrumMachine @model {
  id: ID!
  clientId: ID!
  beats: String!
  name: String!
}

type Query {
  getDrumMachine(id: ID!): DrumMachine
  listDrumMachines(filter: ModelDrumMachineFilterInput, limit: Int, nextToken: String): ModelDrumMachineConnection
}

type Mutation {
  createDrumMachine(input: CreateDrumMachineInput!): DrumMachine
  updateDrumMachine(input: UpdateDrumMachineInput!): DrumMachine
  deleteDrumMachine(input: DeleteDrumMachineInput!): DrumMachine
}

type Subscription {
  onCreateDrumMachine: DrumMachine @aws_subscribe(mutations: ["createDrumMachine"])
  onUpdateDrumMachine: DrumMachine @aws_subscribe(mutations: ["updateDrumMachine"])
}

Case 5: GraphQL text to audio translation

GitHub repo

Base schema:

type Query {
  getTranslatedSentence(sentence: String!, code: String!): TranslatedSentence
}

type TranslatedSentence {
  sentence: String!
}

Case 6: Infra as code with Conference app in a box

GitHub repo

Base schema:

type Talk @model {
  id: ID!
  name: String!
  speakerName: String!
  speakerBio: String!
  time: String
  timeStamp: String
  date: String
  location: String
  summary: String!
  twitter: String
  github: String
  speakerAvatar: String
  comments: [Comment] @connection(name: "TalkComments")
}

type Comment @model {
  id: ID!
  talkId: ID
  talk: Talk @connection(sortField: "createdAt", name: "TalkComments", keyField: "talkId")
  message: String
  createdAt: String
  createdBy: String
  deviceId: ID
}

type Report @model {
	id: ID!
	commentId: ID!
	comment: String!
	talkTitle: String!
	deviceId: ID
}

type ModelCommentConnection {
	items: [Comment]
	nextToken: String
}

type Query {
  listCommentsByTalkId(talkId: ID!): ModelCommentConnection
}

type Subscription {
  onCreateCommentWithId(talkId: ID!): Comment
		@aws_subscribe(mutations: ["createComment"])
}

Case 7 - GraphQL SMS in Markdown

GitHub repoithub.com/dabit3/sms-graphql-ui/settings

Base schema:

type SMS {
	originationNumber: String!
	messageBody: String!
  id: ID!
}

type Query {
	getSMS(originationNumber: String!): SMS
	listSMS(filter: TableSMSFilterInput, limit: Int, nextToken: String): SMSConnection
}

type Subscription {
	onCreateSMS(originationNumber: String, messageBody: String): SMS
		@aws_subscribe(mutations: ["createSMS"])
	onUpdateSMS(originationNumber: String, messageBody: String): SMS
		@aws_subscribe(mutations: ["updateSMS"])
	onDeleteSMS(originationNumber: String, messageBody: String): SMS
		@aws_subscribe(mutations: ["deleteSMS"])
}

type Mutation {
	createSMS(input: CreateSMSInput!): SMS
	updateSMS(input: UpdateSMSInput!): SMS
	deleteSMS(input: DeleteSMSInput!): SMS
}

Case 8 - Write With Me

Real-come collaborative document editing

GitHub repo

Base schema:

type Post @model {
  id: ID!
  clientId: ID!
  markdown: String!
  title: String!
  createdAt: String
}
You can’t perform that action at this time.