Skip to content

Instantly share code, notes, and snippets.

View nikolasburk's full-sized avatar
😑

Nikolas nikolasburk

😑
View GitHub Profile

Get Your Own Prisma Client Explorer

This project uses a hosted database that has writes disabled. Follow these steps to set up your own demo database that lets you perform database writes:

1. Fork the CodeSandbox

To get your own version of this sandbox, click the Fork button in the top-left corner (then wait until the embedded browser in the new Sandbox ):

Personal response to this Twitter thread

I've just been taking a hard look at prisma. and to me it seems like crutch, rather than a solution. my guess is that it works for very simple stuff, but it's not usable for anything more or less "serious".

There are many serious developers and larger companies using Prisma in production today, such as adidas, HyreCar (recently IPOed) or Labelbox (just raised 10mio series A). We have no doubt that Prisma can be used for "serious" applications!

The docs are basically marketing material. "under the hood" doc provides no information I was hoping to find at least there. starting from "how queries are optimized"? some tutorial says there's a dataloader, but that's about it.

You're definitely right that our docs are lacking behind at the moment! We are working on the nex

Get Your Own Prisma Client Explorer

To get your own Prisma client explorer on CodeSandbox that allows for database writes, you need to perform the following steps:

1. Fork the CodeSandbox

2. Open new Terminal tab

input AddProjectInput {
name: String!
stage: String!
secrets: [String!]
clientMutationId: String
}
type AddProjectPayload {
project: Project
clientMutationId: String

Data model vs Prisma database schema

When starting out with GraphQL and Prisma, the amount of .graphql-files you're working with can be confusing. Yet, it's crucial to understand what the role of each of them is.

Looking only at Prisma, there are two .graphql-files that are relevant:

  • The data model containing the model definitions for your service's APIs, typically called datamodel.graphql.
  • The Prisma database schema defining the actual CRUD/realtime operations of the service's API, typically called prisma.graphql.
@nikolasburk
nikolasburk / stitching.graphql
Last active June 29, 2018 12:07
stitching.graphql
query myMenu {
menu {
burger {
bun
cheese
patty
}
salad {
romaine
tomato
@nikolasburk
nikolasburk / instructions.md
Last active March 7, 2020 17:50
Use the Contentful GraphQL API inside a GraphQL Playground

Use the Contentful GraphQL API inside a GraphQL Playground

The Contentful GraphQL API ships with GraphiQL by default. To get even better workflows (such as multiple tabs, speciyfing HTTP headers or work with multiple GraphQL APIs side-by-side), you can use a GraphQL Playground.

1. Get the endpoint for your Contentful GraphQL API

The endpoint of your Contentful GraphQL API has the following structure: https://cdn.contentful.com/spaces/{SPACE}/graphql/alpha/explore?access_token={CDA_TOKEN}

There are two placeholders that need to be replaced:

import { GraphQLServer } from 'graphql-yoga'
const typeDefs = `
type Query {
hello: String!
}
`
const resolvers = {
Query: {
const resolvers = {
Query: {
user: (root, args) => db.getUser(argd.id),
users: () => db.getUsers(),
},
Mutation: {
createUser: (root, args) => db.createUser(args.name),
updateUser: (root, args) => db.updateUser(args.id, args.name),
deleteUser: (root, args) => db.deleteUser(args.id),
}
const resolvers = {
Query: {
user: (root, args) => db.getUser(argd.id),
users: () => db.getUsers(),
},
Mutation: {
createUser: (root, args) => db.createUser(args.name),
updateUser: (root, args) => db.updateUser(args.id, args.name),
deleteUser: (root, args) => db.deleteUser(args.id),
},