<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Divyendu Singh</title>
    <description>The latest articles on DEV Community by Divyendu Singh (@divyenduz).</description>
    <link>https://dev.to/divyenduz</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F31444%2Fb4306178-cf9b-4aef-92cc-23478298585a.jpeg</url>
      <title>DEV Community: Divyendu Singh</title>
      <link>https://dev.to/divyenduz</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/divyenduz"/>
    <language>en</language>
    <item>
      <title>CLI editor in Typescript</title>
      <dc:creator>Divyendu Singh</dc:creator>
      <pubDate>Tue, 17 Sep 2019 22:37:20 +0000</pubDate>
      <link>https://dev.to/divyenduz/cli-editor-in-typescript-1bad</link>
      <guid>https://dev.to/divyenduz/cli-editor-in-typescript-1bad</guid>
      <description>&lt;p&gt;Wrote a small buffer based CLI editor in Typescript. Was a great experience to implement a small buffer, cursor class. &lt;/p&gt;

&lt;p&gt;It even supports undo. Also, without any dependencies. &lt;/p&gt;

&lt;p&gt;Feedback 🙌🙏&lt;/p&gt;

&lt;p&gt;Code: &lt;a href="https://github.com/divyenduz/chi-editor"&gt;https://github.com/divyenduz/chi-editor&lt;/a&gt;&lt;/p&gt;

</description>
      <category>cli</category>
      <category>editor</category>
      <category>vim</category>
    </item>
    <item>
      <title>How does a software like full story or session stack work?</title>
      <dc:creator>Divyendu Singh</dc:creator>
      <pubDate>Wed, 17 Oct 2018 06:42:56 +0000</pubDate>
      <link>https://dev.to/divyenduz/how-does-a-software-like-full-story-or-session-stack-work-3gjd</link>
      <guid>https://dev.to/divyenduz/how-does-a-software-like-full-story-or-session-stack-work-3gjd</guid>
      <description>&lt;p&gt;They &lt;a href="https://www.fullstory.com/"&gt;capture the interactions&lt;/a&gt; on the web page and "replay" them later in a deep analytic-esque session. The console is also available.&lt;/p&gt;

&lt;p&gt;To me it looks like that the software is storing the whole document as state (including the mouse location) and uses some API to make the console available as well.&lt;/p&gt;

&lt;p&gt;The stored data is in time-series format.&lt;/p&gt;

&lt;p&gt;Later this stored data can be used to:-&lt;/p&gt;

&lt;p&gt;Create frames for a video that can be played by the admin.&lt;br&gt;
Play the document + interactions in browser itself (some how).&lt;br&gt;
I was wondering if anyone is already aware of how this is possible?&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>tracking</category>
    </item>
    <item>
      <title>Anyone here doing crazy stuff with Ableton and Javascript (or something else)</title>
      <dc:creator>Divyendu Singh</dc:creator>
      <pubDate>Tue, 16 Oct 2018 08:30:34 +0000</pubDate>
      <link>https://dev.to/divyenduz/anyone-here-doing-crazy-stuff-with-ableton-and-javascript-or-something-else-43c</link>
      <guid>https://dev.to/divyenduz/anyone-here-doing-crazy-stuff-with-ableton-and-javascript-or-something-else-43c</guid>
      <description>

&lt;p&gt;I recently did &lt;a href="https://divu.in/music-theory-and-generation-13965ba83eb9"&gt;some experiments with music theory&lt;/a&gt; and found out that Ableton also has a TCP interface.&lt;/p&gt;

&lt;p&gt;I was curious to know if people are doing something with that. Would love to collaborate.&lt;/p&gt;


</description>
      <category>music</category>
      <category>javascript</category>
      <category>ableton</category>
      <category>generativeart</category>
    </item>
    <item>
      <title>Prisma — Deep Dive</title>
      <dc:creator>Divyendu Singh</dc:creator>
      <pubDate>Sat, 10 Feb 2018 19:33:12 +0000</pubDate>
      <link>https://dev.to/divyenduz/prisma--deep-dive-384o</link>
      <guid>https://dev.to/divyenduz/prisma--deep-dive-384o</guid>
      <description>&lt;h4&gt;
  
  
  Cloud Native — GraphQL — Database API Layer
&lt;/h4&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--udWQUjy7--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/1024/1%2AoK0VF4K-Z1JsxsKytP54nA.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--udWQUjy7--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/1024/1%2AoK0VF4K-Z1JsxsKytP54nA.png" alt=""&gt;&lt;/a&gt;A futuristic Cloud Native — GraphQL Database API Layer&lt;/p&gt;

&lt;p&gt;P.S. This post is intended to be a giant deep dive into &lt;a href="https://www.prismagraphql.com/"&gt;Prisma&lt;/a&gt;. If you think any part is missing OR is not clear OR can be improved in any way. Reach out to me via comments or &lt;a href="https://twitter.com/divyenduz"&gt;tweet to me&lt;/a&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  Table of Contents
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;Introduction&lt;/li&gt;
&lt;li&gt;Setup&lt;/li&gt;
&lt;li&gt;Prisma init Command Breakdown&lt;/li&gt;
&lt;li&gt;Directory Structure&lt;/li&gt;
&lt;li&gt;Run the Application Server&lt;/li&gt;
&lt;li&gt;Access the database&lt;/li&gt;
&lt;li&gt;Teach a Man How to Fish&lt;/li&gt;
&lt;li&gt;Permissions&lt;/li&gt;
&lt;li&gt;Advanced Queries&lt;/li&gt;
&lt;li&gt;Advanced Mutations&lt;/li&gt;
&lt;li&gt;Subscriptions&lt;/li&gt;
&lt;li&gt;Export/Import Data&lt;/li&gt;
&lt;li&gt;Monitoring&lt;/li&gt;
&lt;li&gt;Advanced Prisma and GraphQL Stuff&lt;/li&gt;
&lt;li&gt;Gotchas&lt;/li&gt;
&lt;li&gt;Plugs&lt;/li&gt;
&lt;li&gt;Further Reading&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;
  
  
  Introduction
&lt;/h3&gt;

&lt;p&gt;This post talks about one of the most fascinating GraphQL tools I have come across.&lt;/p&gt;

&lt;h4&gt;
  
  
  &lt;strong&gt;What is Prisma?&lt;/strong&gt;
&lt;/h4&gt;

&lt;p&gt;&lt;a href="https://blog.graph.cool/introducing-prisma-1ff423fd629e"&gt;Prisma&lt;/a&gt; is a tool (&lt;a href="https://blog.graph.cool/graphql-databases-a-preview-into-the-future-of-graphcool-c1d4981383d9"&gt;read product that has evolved after a lot of production experience&lt;/a&gt;) that converts your database into a very powerful GraphQL API.&lt;/p&gt;

&lt;p&gt;Think of Prisma as a “cloud native”, “GraphQL first” database but it is more than that as we will see.&lt;/p&gt;

&lt;p&gt;Prisma is at the frontier of a very powerful &lt;a href="https://www.prismagraphql.com/docs/graphql-ecosystem/"&gt;GraphQL ecosystem&lt;/a&gt;.&lt;/p&gt;

&lt;h4&gt;
  
  
  &lt;strong&gt;Where does Prisma sit in my setup?&lt;/strong&gt;
&lt;/h4&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--bq2AMAi6--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/1024/1%2A3cqtoZ02tki_CYffhA2snQ.jpeg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--bq2AMAi6--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/1024/1%2A3cqtoZ02tki_CYffhA2snQ.jpeg" alt=""&gt;&lt;/a&gt;What does (can) Prisma do?&lt;/p&gt;

&lt;p&gt;You can be in following situations:-&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;You are starting from scratch&lt;/strong&gt;&lt;br&gt;&lt;br&gt;
Prisma can be used to automagically build tables and a powerful GraphQL API on top of it (this is what we will majorly cover in this post). You can then &lt;a href="https://www.prismagraphql.com/docs/reference/data-import-and-export/data-import-ol2eoh8xie"&gt;import your data into Prisma&lt;/a&gt; and be merry.&lt;/p&gt;

&lt;p&gt;Prisma can already do this with very effectively with MySQL and others (MongoDB, ElasticSearch, Postgres etc) are &lt;a href="https://github.com/graphcool/prisma#supported-databases"&gt;coming soon&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;You have an existing database but you want to expose it via a GraphQL API&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Either you can also do this task at the application server level or Prisma can act as a thin GraphQL wrapper on top of your existing database.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;You rely on 3rd party GraphQL and REST APIs for information&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;At the application server level you can use REST API as the source of data. The community is actively &lt;a href="https://github.com/graphql-binding/graphql-binding-openapi"&gt;working on tools&lt;/a&gt; to make this experience much better.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Any combination of the above 3.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Prisma is not limited to one setup, it can effectively combine any permutation and combination of the above at the application layer.&lt;/p&gt;

&lt;p&gt;On top of this, Prisma is &lt;a href="https://www.prismagraphql.com/docs/quickstart/"&gt;language agnostic&lt;/a&gt;. All we need to do it come up with “GraphQL bindings” in the corresponding language. “What are GraphQL bindings?” is a question answered very well in &lt;a href="https://blog.graph.cool/reusing-composing-graphql-apis-with-graphql-bindings-80a4aa37cff5"&gt;this&lt;/a&gt; post.&lt;/p&gt;
&lt;h3&gt;
  
  
  Setup
&lt;/h3&gt;

&lt;p&gt;Let us start with baby steps, installation first.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;npm install -g prisma
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;This should give you a globally installed prisma command (can be installed via npm in a scoped way as well). Help available at prisma help or prisma help &amp;lt;command&amp;gt;.&lt;/p&gt;

&lt;p&gt;You will also need to install &lt;a href="https://docs.docker.com/install/"&gt;docker&lt;/a&gt;, &lt;a href="https://docs.docker.com/compose/install/"&gt;docker-compose&lt;/a&gt;, and &lt;a href="https://github.com/creationix/nvm"&gt;node&lt;/a&gt; for the setup to work.&lt;/p&gt;
&lt;h3&gt;
  
  
  Prisma init Command Breakdown
&lt;/h3&gt;

&lt;p&gt;Now we can use the prisma init command to get started. Run the command, go go go… did you do it yet. Let us explore the options it provides:&lt;br&gt;
&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;divyendusingh [prisma-examples]$ prisma init

? How to set up a new Prisma service? (Use arrow keys)

❯ Minimal setup: database-only
  GraphQL server/fullstack boilerplate (recommended)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;Let us go with the recommended option in this step.&lt;br&gt;
&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Running $ graphql create ...
? Directory for new GraphQL project (.)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;It is running a CLI command called graphql — Wait what? — Remember your training (read as &lt;a href="https://www.prismagraphql.com/docs/graphql-ecosystem/"&gt;GraphQL Ecosystem&lt;/a&gt; — &lt;a href="https://www.prismagraphql.com/docs/graphql-ecosystem/graphql-cli/overview-quaidah9pj"&gt;GraphQL CLI&lt;/a&gt;) soldier.&lt;/p&gt;

&lt;p&gt;Straight from the docs: 📟 &lt;a href="https://github.com/graphql-cli/graphql-cli"&gt;graphql-cli&lt;/a&gt; is a command line tool for common GraphQL development workflows.&lt;/p&gt;

&lt;p&gt;Knowing this is helpful, prisma for many operations uses underlying graphql command.&lt;/p&gt;

&lt;p&gt;We can specify the directory and move on, note that if you choose the current directory (via .), it must be empty.&lt;/p&gt;

&lt;p&gt;The next question it asks you is to choose a &lt;a href="https://blog.graph.cool/graphql-boilerplates-graphql-create-how-to-setup-a-graphql-project-6428be2f3a5"&gt;boilerplate&lt;/a&gt;:&lt;br&gt;
&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;? Choose GraphQL boilerplate project:
  node-basic Basic GraphQL server (incl. database)
❯ node-advanced GraphQL server (incl. database &amp;amp; authentication)
  typescript-basic Basic GraphQL server (incl. database)
  typescript-advanced GraphQL server (incl. database &amp;amp; authentication)
  react-fullstack-basic React app + GraphQL server (incl. database )
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;Let us go with node-advanced. Although, you can go with whatever you feel like, concepts won’t vary much.&lt;/p&gt;

&lt;p&gt;We will notice the it gets the boilerplate(s) from a &lt;a href="https://github.com/graphql-boilerplates"&gt;specific repository&lt;/a&gt;.&lt;br&gt;
&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;? Choose GraphQL boilerplate project: node-advanced GraphQL server (incl. database &amp;amp; authentication)
[graphql create] Downloading boilerplate from https://github.com/graphql-boilerplates/node-graphql-server/archive/master.zip...
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;Which brings us to the next question. &lt;strong&gt;Can you create your own boilerplates?&lt;/strong&gt;  &lt;strong&gt;Absolutely!! — &lt;/strong&gt; &lt;a href="https://twitter.com/divyenduz"&gt;ping me&lt;/a&gt; or &lt;a href="http://graphcool.slack.com"&gt;join the community&lt;/a&gt; if you want to explore this further.&lt;/p&gt;

&lt;p&gt;Moving on to the next question:&lt;br&gt;
&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;? Please choose the cluster you want to deploy "deep-dive@dev" to (Use arrow keys)

❯ prisma-eu1 Public development cluster (hosted in EU on Prisma Cloud)
  prisma-us1 Public development cluster (hosted in US on Prisma Cloud)
  local Local cluster (requires Docker)

Log in or create new account on Prisma Cloud

Note: When not logged in, service deployments to Prisma Cloud expire after 7 days.
  You can learn more about deployment in the docs: http://bit.ly/prisma-graphql-deployment
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;The CLI prompts you to select a cluster to which your Prisma service should be deployed. At the time of writing, there are two public clusters, however, we will use the local cluster (docker based) for this post. Again, feel free to choose any — concepts don’t change much.&lt;/p&gt;

&lt;p&gt;Aha! Selecting a cluster runs a few more commands, here is the output printed by the CLI:&lt;br&gt;
&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;? Please choose the cluster you want to deploy "deep-dive@dev" to
Added cluster: local to prisma.yml
Creating stage dev for service deep-dive ✔
Deploying service `deep-dive` to stage `dev` on cluster `local` 1.7s

Changes:
... (many changes, not listed for brevity)

Applying changes 3.8s

Hooks:
Importing seed dataset from `seed.graphql` 733ms

Your GraphQL database endpoint is live:

HTTP: http://localhost:4466/deep-dive/dev
WS: ws://localhost:4466/deep-dive/dev

Checking, if schema file changed 366ms
Writing database schema to `src/generated/prisma.graphql` 1ms
Running $ graphql prepare...

Next steps:
  1. Change directory: `cd deep-dive`
  2. Start local server and open Playground: `yarn dev`
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;Let us explore this output, bit by bit.&lt;br&gt;
&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Deploying service `deep-dive` to stage `dev` on cluster `local` 1.7s
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;Internally, this is running the prisma deploy command (we will be using this command very often). The three keywords we can see in this line of the output are &lt;strong&gt;service&lt;/strong&gt; , &lt;strong&gt;stage&lt;/strong&gt; ,  &lt;strong&gt;cluster&lt;/strong&gt;.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Service&lt;/strong&gt;  — A GraphQL endpoint that is mapping requests to an underlying database.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Stage &lt;/strong&gt; — A service can have multiple stages (think dev, prod etc).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Cluster &lt;/strong&gt; — A service@stage can be deployed to &lt;a href="https://www.prismagraphql.com/docs/reference/clusters/overview-eu2ood0she"&gt;cluster(s)&lt;/a&gt;. As mentioned about “local docker” for this post and two shared clusters are available. You can also create your own cluster (say on &lt;a href="https://m.do.co/c/efabde48fb30"&gt;DigitalOcean&lt;/a&gt;) and add that to prisma by using prisma cluster add command. &lt;a href="https://twitter.com/divyenduz"&gt;Ping me&lt;/a&gt; or &lt;a href="http://graphcool.slack.com"&gt;join the community&lt;/a&gt; if you want to explore this further.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Interestingly, all of this can be set/changed in &lt;a href="https://www.prismagraphql.com/docs/reference/service-configuration/prisma.yml/overview-and-example-foatho8aip"&gt;prisma.yml&lt;/a&gt; file. We have one such file via the boilerplate that is being used here.&lt;br&gt;
&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Changes:
... (many changes, not listed for brevity)

Applying changes 3.8s
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;The prisma deploy command also takes a diff of the already deployed service (in this case there is none, because we are deploying the service for the first time) and applies the relevant changes.&lt;br&gt;
&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Hooks:
Importing seed dataset from `seed.graphql` 733ms

Your GraphQL database endpoint is live:

HTTP: http://localhost:4466/deep-dive/dev
WS: ws://localhost:4466/deep-dive/dev
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;If you want a service to have some initial data, you can use the seed option in &lt;a href="https://www.prismagraphql.com/docs/reference/service-configuration/prisma.yml/overview-and-example-foatho8aip"&gt;prisma.yml&lt;/a&gt; file.&lt;/p&gt;

&lt;p&gt;As suggested by the output, the Prisma endpoint is live and you have built-in web sockets (GraphQL Subscriptions support, wow! wow!).&lt;br&gt;
&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Checking, if schema file changed 366ms
Writing database schema to `src/generated/prisma.graphql` 1ms
Running $ graphql prepare...
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;Aha! Next up is the generated prisma.graphql file, this is essentially the full GraphQL API prisma provides for you based on your datamodel.graphql file. It defines the CRUD operations for the types in datamodel.graphql file.&lt;/p&gt;

&lt;p&gt;Again, Prisma is using the underlying graphql prepare command which in GraphQL CLI docs is described as following :—&lt;br&gt;
&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;graphql prepare Bundle schemas and generate bindings
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;More on this later in the post — This is very important.&lt;/p&gt;

&lt;p&gt;Lastly, the output suggests you to cd into the directory cd deep-dive. Let us do that and explore the directory structure before running yarn dev command.&lt;/p&gt;
&lt;h3&gt;
  
  
  Directory Structure
&lt;/h3&gt;


&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;divyendusingh [deep-dive]$ tree -I node_modules
.
├── README.md
├── database
│ ├── datamodel.graphql
│ ├── prisma.yml
│ └── seed.graphql
├── package.json
├── src
│ ├── generated
│ │ └── prisma.graphql
│ ├── index.js
│ ├── resolvers
│ │ ├── AuthPayload.js
│ │ ├── Mutation
│ │ │ ├── auth.js
│ │ │ └── post.js
│ │ ├── Query.js
│ │ └── index.js
│ ├── schema.graphql
│ └── utils.js
└── yarn.lock

5 directories, 15 files
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;Let us explore the most important bits and see how they connect together.&lt;/p&gt;

&lt;p&gt;The &lt;strong&gt;database &lt;/strong&gt; folder:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;prisma.yml — This is where we define service, stage, cluster and &lt;a href="https://www.prismagraphql.com/docs/reference/service-configuration/prisma.yml/overview-and-example-foatho8aip"&gt;other options&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;datamodel.graphql — Define your desired GraphQL types here and refer this file in prisma.yml file.&lt;/li&gt;
&lt;li&gt;seed.graphql — As discussed above, initialize your service with some data, this is the file to setup and referred in prisma.yml file.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The &lt;strong&gt;src&lt;/strong&gt;  folder:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;index.js — This is where we setup the application server (in this case with &lt;a href="https://github.com/graphcool/graphql-yoga"&gt;graphql-yoga&lt;/a&gt; but generally flexible) that will sit in front of the prisma service. The setup includes linking graphql-yoga with prisma and all the files in resolver folder are used here, check it out.&lt;/li&gt;
&lt;li&gt;schema.graphql — This is GraphQL API of the application server. This is also known as the application schema. Note that prisma gives you a extensive API based on your datamodel.graphql but you can choose to expose a subset/combination of it in whatever shape you want by using this file. This is what makes this whole setup super flexible.&lt;/li&gt;
&lt;li&gt;resolvers — Definition of resolvers of Queries and Mutations used by index.js file. But why is “AuthPayload” at top level? — glad that you asked. &lt;a href="https://blog.graph.cool/graphql-server-basics-demystifying-the-info-argument-in-graphql-resolvers-6f26249f613a"&gt;Here is why!&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;h3&gt;
  
  
  Run the Application Server
&lt;/h3&gt;

&lt;p&gt;Now, after taking a brief look at the directory structure, we can run the yarn dev command to run the application server. Now, we have the following endpoints available.&lt;/p&gt;

&lt;p&gt;&lt;a href="http://localhost:4000"&gt;http://localhost:4000&lt;/a&gt; — Application server with custom schema that we just explored. This is for the GraphQL API defined by schema.graphql.&lt;/p&gt;

&lt;p&gt;&lt;a href="http://localhost:4466/deep-dive/dev"&gt;http://localhost:4466/deep-dive/dev&lt;/a&gt; — Prisma service with generated GraphQL schema, this was setup by initial prisma deploy. This is for the GraphQL API defined by database schema in prisma.graphql (also known as Prisma database schema) file.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://github.com/graphcool/graphql-playground"&gt;GraphQL Playground&lt;/a&gt; should be available if you open these links in browser.&lt;/p&gt;

&lt;p&gt;Resolvers in application server use the underlying prisma service by using bindings.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://blog.graph.cool/reusing-composing-graphql-apis-with-graphql-bindings-80a4aa37cff5"&gt;Reusing &amp;amp; Composing GraphQL APIs with GraphQL Bindings&lt;/a&gt;&lt;/p&gt;
&lt;h3&gt;
  
  
  Teach a Man How to Fish
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--wywkGygM--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/1024/1%2Ay_FrAGK1g-nYf3lCpmHM4Q.jpeg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--wywkGygM--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/1024/1%2Ay_FrAGK1g-nYf3lCpmHM4Q.jpeg" alt=""&gt;&lt;/a&gt;Teach a man how to fish — Photo by &lt;a href="https://unsplash.com/photos/ahKO5IOXFDM?utm_source=unsplash&amp;amp;utm_medium=referral&amp;amp;utm_content=creditCopyText"&gt;Nathaniel Shuman&lt;/a&gt; on &lt;a href="https://unsplash.com/search/photos/fish?utm_source=unsplash&amp;amp;utm_medium=referral&amp;amp;utm_content=creditCopyText"&gt;Unsplash&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Let us discuss more about the generated prisma.graphql file (which is also known as Prisma database schema) in this section.&lt;/p&gt;

&lt;p&gt;This file contains the full API of what prisma offers you against the current state of your datamodel.graphql file. Given this information and the nature of a GraphQL schema.&lt;/p&gt;

&lt;p&gt;You can start to explore the potential use of documented and undocumented feature here. I am a strong believer of &lt;a href="https://martinfowler.com/bliki/CodeAsDocumentation.html"&gt;“code as documentation”&lt;/a&gt; and this is what I used when Prisma was in beta and documentation was not up to date (it is in excellent shape now).&lt;/p&gt;

&lt;p&gt;For example, for our deployed service so far, you can go to prisma.graphql and search for type Query, type mutation, type Subscription to explore the full exposed potential of this API (note that this information is also available in the &lt;a href="https://github.com/graphcool/graphql-playground"&gt;GraphQL Playground&lt;/a&gt;, remember the &lt;a href="https://www.prismagraphql.com/docs/graphql-ecosystem/"&gt;ecosystem&lt;/a&gt; soldier) and drill down on various input types from there. Doing so, will give you a solid understanding of the API and the undocumented features.&lt;/p&gt;
&lt;h3&gt;
  
  
  Access the Database
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Where is my data?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;In this service, it is in a &lt;a href="https://www.prismagraphql.com/docs/tutorials/database/database-access-(sql)-eechaeth3l"&gt;MySQL hosted using Docker&lt;/a&gt; but it can be in your own database as well.&lt;/p&gt;

&lt;p&gt;To access the database, run the following command&lt;br&gt;
&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;docker exec -it prisma-db mysql -u root --host 127.0.0.1 --port 3306 --password=graphcool
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;Notice that the password can be either graphcool or prisma by default.&lt;br&gt;
&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;mysql&amp;gt; show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| deep-dive@dev |
| graphcool |
| mysql |
| performance_schema |
| sys |
+--------------------+
8 rows in set (0.00 sec)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;Notice that our database has the name in the shape of @&lt;br&gt;
&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;mysql&amp;gt; show tables;
+-------------------------+
| Tables_in_deep-dive@dev |
+-------------------------+
| Post |
| User |
| _PostToUser |
| _RelayId |
+-------------------------+
4 rows in set (0.00 sec)

mysql&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;And we have tables matching types in our datamodel.graphql file. Prisma did all of this for us. Nice.&lt;/p&gt;
&lt;h3&gt;
  
  
  Permissions
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;How do I authenticate requests in this system?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;We have two services, the application server and the Prisma service and both will need authentication (and possibly authorization of sorts).&lt;/p&gt;

&lt;p&gt;Let’s talk about the Prisma service first, you might have noticed a secret field in prisma.yml file and the same secret again in src/index.js in your application server part of things. As &lt;a href="https://www.prismagraphql.com/docs/reference/prisma-api/concepts-utee3eiquo#service-token"&gt;documented here&lt;/a&gt;, that secret is used to sign a JWT token that we have to pass to authenticate the requests.&lt;/p&gt;

&lt;p&gt;Which is why you need to mention the secret in application server part for it to be able to talk to Prisma service and in playground of Prisma service, you manually need to send &lt;a href="https://www.prismagraphql.com/docs/reference/prisma-api/concepts-utee3eiquo#service-token"&gt;HTTP Authorization header as documented&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;You might also be interested in the prisma token command. Find out more about it in &lt;a href="https://www.prismagraphql.com/docs/reference/cli-command-reference/database-service/prisma-token-shoo8cioto"&gt;docs&lt;/a&gt; or by typing prisma help token.&lt;/p&gt;

&lt;p&gt;Next is the application server part. It is unauthenticated by default and you need to add it yourself like you would do for any node service.&lt;/p&gt;

&lt;p&gt;Since, we have installed the node-advanced boilerplate, we have the raw material to do this already.&lt;/p&gt;

&lt;p&gt;Check out the src/utils.js file, it mentions how you can get the user id from an in coming JWT token HTTP Authorization header.&lt;/p&gt;

&lt;p&gt;Then you can check how the exposed function getUserId is used in query resolvers file at src/resolvers/Query.js to get the user id and fetch drafts for the “logged in” user.&lt;/p&gt;
&lt;h3&gt;
  
  
  Advanced Queries
&lt;/h3&gt;

&lt;p&gt;The d&lt;a href="https://www.prismagraphql.com/docs/reference/prisma-api/queries-ahwee4zaey"&gt;ocumentation&lt;/a&gt; covers the queries and limitations very well but let us use our “Teach a man how to fish” method to explore queries. Dive into the generated prisma.graphql file and search for type Query. You will land on the following.&lt;/p&gt;


&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;



&lt;p&gt;And you can see the whole Prisma API (WRT to your current deployed datamodel.graphql file) in front of you.&lt;/p&gt;

&lt;p&gt;Let us explore the posts field (and related input type PostWhereInput) further: —&lt;/p&gt;


&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;


&lt;p&gt;Just by looking at this snippet, you understand that you can do AND and OR operations recursively in the where argument. It argument supports filtering by scalar and nested fields.&lt;/p&gt;

&lt;p&gt;Similarly, you can explore the input type for orderBy i.e. by searching input PostOrderByInput in the generated prisma.graphql file.&lt;/p&gt;

&lt;p&gt;Pagination support is provided by Prisma by providing a &lt;a href="https://www.prismagraphql.com/docs/reference/prisma-api/queries-ahwee4zaey#connection-queries"&gt;relay style connection object&lt;/a&gt;. Take a look at the &lt;a href="https://www.prismagraphql.com/docs/reference/prisma-api/queries-ahwee4zaey#connection-queries"&gt;documentation&lt;/a&gt; or just look for “connection” in the generated prisma.graphql file.&lt;/p&gt;

&lt;p&gt;Limitations are clearly documented in the docs, most notably they are: —&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;orderBy not available for &lt;a href="https://github.com/graphcool/prisma/issues/62"&gt;multiple fields&lt;/a&gt; or by &lt;a href="https://github.com/graphcool/prisma/issues/95"&gt;related fields&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;In the where clause, &lt;a href="https://github.com/graphcool/prisma/issues/1275"&gt;scalar list filters&lt;/a&gt; or &lt;a href="https://github.com/graphcool/prisma/issues/148"&gt;JSON filters&lt;/a&gt; are not available.&lt;/li&gt;
&lt;li&gt;A maximum of 1000 nodes can be returned per pagination field on the public cluster. This limit can be increased on other clusters using &lt;a href="https://github.com/graphcool/framework/issues/748"&gt;the cluster configuration&lt;/a&gt;.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Best part is that you can join in the discussion or even write code to make it happen.&lt;/p&gt;

&lt;h3&gt;
  
  
  Advanced Mutations
&lt;/h3&gt;

&lt;p&gt;Again, the &lt;a href="https://www.prismagraphql.com/docs/reference/prisma-api/mutations-ol0yuoz6go"&gt;documentation&lt;/a&gt; covers this really well but let us stick to use our “Teach a man how to fish” method to explore mutations. Dive into the generated prisma.graphql file and search for type Mutation. You will land on the following.&lt;/p&gt;


&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;


&lt;p&gt;Let us explore the type User for mutations. We can notice that we have the following methods for mutation of the type User.&lt;/p&gt;


&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;


&lt;p&gt;We can see that we have the ability to createUser, updateUser, deleteUser, upsertUser, updateManyUsers, and deleteManyUsers.&lt;/p&gt;

&lt;p&gt;Not only that if we drill down and explore input UserCreateInput type.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;input UserCreateInput {
  email: String!
  password: String!
  name: String!
  posts: PostCreateManyWithoutAuthorInput
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;We can see that we have another input type for creating/connecting posts for a user. Let us explore that by searching for input PostCreateManyWithoutAuthorInput.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;input PostCreateManyWithoutAuthorInput {
  create: [PostCreateWithoutAuthorInput!]
  connect: [PostWhereUniqueInput!]
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;We have the following fields available: —&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;create — To create a post while creating a user&lt;/li&gt;
&lt;li&gt;connect — To connect an existing post to this newly created user.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Similarly, we have input PostUpdateManyWithoutAuthorInput in input UserUpdateInput which looks like this: —&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;input PostUpdateManyWithoutAuthorInput {
  create: [PostCreateWithoutAuthorInput!]
  connect: [PostWhereUniqueInput!]
  disconnect: [PostWhereUniqueInput!]
  delete: [PostWhereUniqueInput!]
  update: [PostUpdateWithoutAuthorInput!]
  upsert: [PostUpsertWithoutAuthorInput!]
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Here we have more options than in input UserCreateInput and it makes sense intuitively. While creating a user you can only do create and connect but while updating a user you can perform create, connect, disconnect, delete, update, and upsert on a post.&lt;/p&gt;

&lt;p&gt;A good though experiment is why can’t we do an upsert while creating a post. &lt;a href="https://twitter.com/divyenduz"&gt;Ping me&lt;/a&gt; or &lt;a href="http://graphcool.slack.com"&gt;join the community&lt;/a&gt; if you want to explore this further.&lt;/p&gt;

&lt;h3&gt;
  
  
  Subscriptions
&lt;/h3&gt;

&lt;p&gt;To be honest, I have not used them yet but it is documented here! I will update the post once I use them in production. The purpose of subscriptions is to implement &lt;a href="https://martinfowler.com/articles/201701-event-driven.html"&gt;event-based&lt;/a&gt; business logic using serverless functions.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://www.prismagraphql.com/docs/reference/prisma-api/subscriptions-aey0vohche"&gt;Prisma Docs&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Export/Import Data
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://www.prismagraphql.com/docs/reference/data-import-and-export/data-export-pa0aip3loh"&gt;Exporting&lt;/a&gt; and &lt;a href="https://www.prismagraphql.com/docs/reference/data-import-and-export/data-import-ol2eoh8xie"&gt;importing&lt;/a&gt; data is built into the CLI. This can be also used to perform automated backups.&lt;/p&gt;

&lt;p&gt;It can be as simple as running prisma export to export the data file.&lt;/p&gt;

&lt;p&gt;And prisma import --data &amp;lt;data file path&amp;gt;&lt;/p&gt;

&lt;p&gt;I have used this in production and did not face any issues.&lt;/p&gt;

&lt;h3&gt;
  
  
  Monitoring
&lt;/h3&gt;

&lt;p&gt;Monitoring is another very important aspect of moving a service to production and I am a &lt;a href="https://github.com/muatik/flask-profiler/pull/45"&gt;fan of monitoring in production&lt;/a&gt;. GraphQL Yoga has built-in support for &lt;a href="https://github.com/graphcool/graphql-yoga"&gt;tracing&lt;/a&gt;. We can also link our service to &lt;a href="https://engine.apollographql.com"&gt;Apollo engine&lt;/a&gt; for production monitoring (and more).&lt;/p&gt;

&lt;p&gt;I used this guide to set it up for my application. Please follow it.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://www.apollographql.com/docs/engine/setup-node.html"&gt;Set up Engine with Node | Apollo Engine&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://twitter.com/divyenduz"&gt;Ping me&lt;/a&gt; or &lt;a href="http://graphcool.slack.com"&gt;join the community&lt;/a&gt; if you want to explore this further.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--dFE0q1Mt--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/1024/1%2APFVq08VeAGiT0iaeSmHxpQ.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--dFE0q1Mt--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/1024/1%2APFVq08VeAGiT0iaeSmHxpQ.png" alt=""&gt;&lt;/a&gt;Such Wow — Dashboard of Apollo engine setup for &lt;a href="https://www.divyendusingh.com"&gt;&lt;/a&gt;&lt;a href="https://www.divyendusingh.com"&gt;https://www.divyendusingh.com&lt;/a&gt; powered by &lt;a href="https://github.com/divyenduz/ds"&gt;DS&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;This is how it is looks like (wow, field level performance insights) when setup. I have done it for my &lt;a href="https://www.divyendusingh.com"&gt;personal site&lt;/a&gt; which is powered by &lt;a href="https://github.com/divyenduz/ds"&gt;DS&lt;/a&gt; which is powered by Prisma and Next.js.&lt;/p&gt;

&lt;h3&gt;
  
  
  Advanced Prisma and GraphQL Stuff
&lt;/h3&gt;

&lt;p&gt;Resolver forwarding: —&lt;/p&gt;

&lt;p&gt;&lt;a href="https://github.com/graphcool/prisma/tree/master/examples/resolver-forwarding"&gt;graphcool/prisma&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Deployment best practices: —&lt;/p&gt;

&lt;p&gt;&lt;a href="https://www.graph.cool/forum/t/advice-on-best-practise-deploying-graphql-yoga-server-w-prisma-in-production/2348"&gt;Advice on best practise? - Deploying graphql-yoga server w/ Prisma in production&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Rest bindings: —&lt;/p&gt;

&lt;p&gt;&lt;a href="https://github.com/graphql-binding/graphql-binding-openapi#graphql-config-support"&gt;graphql-binding/graphql-binding-openapi&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Testing: —&lt;/p&gt;


&lt;blockquote class="ltag__twitter-tweet"&gt;

  &lt;div class="ltag__twitter-tweet__main"&gt;
    &lt;div class="ltag__twitter-tweet__header"&gt;
      &lt;img class="ltag__twitter-tweet__profile-image" src="https://res.cloudinary.com/practicaldev/image/fetch/s--oVN8Phr3--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://pbs.twimg.com/profile_images/871555682608136205/yMs8Gnot_normal.jpg" alt="Guillermo Rauch profile image"&gt;
      &lt;div class="ltag__twitter-tweet__full-name"&gt;
        Guillermo Rauch
      &lt;/div&gt;
      &lt;div class="ltag__twitter-tweet__username"&gt;
        @rauchg
      &lt;/div&gt;
      &lt;div class="ltag__twitter-tweet__twitter-logo"&gt;
        &lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--ir1kO05j--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev.to/assets/twitter-f95605061196010f91e64806688390eb1a4dbc9e913682e043eb8b1e06ca484f.svg" alt="twitter logo"&gt;
      &lt;/div&gt;
    &lt;/div&gt;
    &lt;div class="ltag__twitter-tweet__body"&gt;
      Write tests. Not too many. Mostly integration.
    &lt;/div&gt;
    &lt;div class="ltag__twitter-tweet__date"&gt;
      16:43 PM - 10 Dec 2016
    &lt;/div&gt;


    &lt;div class="ltag__twitter-tweet__actions"&gt;
      &lt;a href="https://twitter.com/intent/tweet?in_reply_to=807626710350839808" class="ltag__twitter-tweet__actions__button"&gt;
        &lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--fFnoeFxk--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev.to/assets/twitter-reply-action-238fe0a37991706a6880ed13941c3efd6b371e4aefe288fe8e0db85250708bc4.svg" alt="Twitter reply action"&gt;
      &lt;/a&gt;
      &lt;a href="https://twitter.com/intent/retweet?tweet_id=807626710350839808" class="ltag__twitter-tweet__actions__button"&gt;
        &lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--k6dcrOn8--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev.to/assets/twitter-retweet-action-632c83532a4e7de573c5c08dbb090ee18b348b13e2793175fea914827bc42046.svg" alt="Twitter retweet action"&gt;
      &lt;/a&gt;
      &lt;a href="https://twitter.com/intent/like?tweet_id=807626710350839808" class="ltag__twitter-tweet__actions__button"&gt;
        &lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--SRQc9lOp--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev.to/assets/twitter-like-action-1ea89f4b87c7d37465b0eb78d51fcb7fe6c03a089805d7ea014ba71365be5171.svg" alt="Twitter like action"&gt;
      &lt;/a&gt;
    &lt;/div&gt;
  &lt;/div&gt;
&lt;/blockquote&gt;


&lt;p&gt;&lt;a href="https://medium.com/entria/testing-a-graphql-server-using-jest-4e00d0e4980e"&gt;Testing a GraphQL Server using Jest&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Examples: —&lt;/p&gt;

&lt;p&gt;&lt;a href="https://github.com/graphcool/prisma/tree/master/examples"&gt;graphcool/prisma&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Gotchas
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Public shared clusters have a limit of &lt;a href="https://github.com/graphcool/prisma/issues/1863"&gt;1 request per second&lt;/a&gt;. Soon™ to be increased to 10 requests per 10 seconds.&lt;/li&gt;
&lt;li&gt;There might still be a connection leak in &lt;a href="https://github.com/graphcool/prisma/issues/1779"&gt;subscriptions connection&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;The # import on top of your schema.graphql is not a comment but a &lt;a href="https://github.com/graphcool/graphql-import"&gt;graphql-import&lt;/a&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Plugs
&lt;/h3&gt;

&lt;p&gt;And that is all for this post, it was a great experience working on this. If you like my work and would like to subscribe to interesting future posts, please subscribe below.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://medium.com/media/e9d4dcab1161d9df16e59865831303d1/href"&gt;&lt;/a&gt;&lt;a href="https://medium.com/media/e9d4dcab1161d9df16e59865831303d1/href"&gt;https://medium.com/media/e9d4dcab1161d9df16e59865831303d1/href&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;You can also find me &lt;a href="https://www.divyendusingh.com"&gt;here&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Thanks to &lt;a href="https://twitter.com/nikolasburk"&gt;Nikolas&lt;/a&gt; and &lt;a href="https://twitter.com/_marktani"&gt;Nilan&lt;/a&gt; (&lt;a href="https://www.graph.cool/forum/t/thank-you-nilan/2436/12?u=divyenduz"&gt;legend says he is Master Yoga&lt;/a&gt;) from Graphcool team for detailed feedback on this post.&lt;/p&gt;

&lt;h3&gt;
  
  
  Further Reading
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://blog.graph.cool/graphql-boilerplates-graphql-create-how-to-setup-a-graphql-project-6428be2f3a5"&gt;GraphQL Boilerplates &amp;amp; &lt;code&gt;graphql create&lt;/code&gt;: How to Setup a GraphQL Project&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://blog.graph.cool/graphql-server-basics-demystifying-the-info-argument-in-graphql-resolvers-6f26249f613a"&gt;GraphQL Server Basics: Demystifying the &lt;code&gt;info&lt;/code&gt; Argument in GraphQL Resolvers&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://blog.graph.cool/reusing-composing-graphql-apis-with-graphql-bindings-80a4aa37cff5"&gt;Reusing &amp;amp; Composing GraphQL APIs with GraphQL Bindings&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.prismagraphql.com/docs"&gt;Prisma Docs&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://facebook.github.io/graphql/"&gt;GraphQL Specification&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;




</description>
      <category>graphcool</category>
      <category>prisma</category>
      <category>graphql</category>
      <category>baas</category>
    </item>
    <item>
      <title>Learning GraphQL with React and Relay - Video</title>
      <dc:creator>Divyendu Singh</dc:creator>
      <pubDate>Fri, 08 Dec 2017 17:40:29 +0000</pubDate>
      <link>https://dev.to/divyenduz/learning-graphql-with-react-and-relay---video-dfl</link>
      <guid>https://dev.to/divyenduz/learning-graphql-with-react-and-relay---video-dfl</guid>
      <description>

&lt;p&gt;Hello! So, I have been cooking this course for the last two months and finally, it is ready! &lt;/p&gt;

&lt;p&gt;Tadaaa! - &lt;a href="https://www.producthunt.com/posts/learning-graphql-with-react-and-relay-video"&gt;Learning GraphQL with React and Relay [Video]&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I have put a ton of effort in this one, we will be covering the following:- &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Understand the working of a GraphQL server in a language agnostic way&lt;/li&gt;
&lt;li&gt;Use React and Relay with GraphQL backend&lt;/li&gt;
&lt;li&gt;Create your own GraphQL API with a blog&lt;/li&gt;
&lt;li&gt;Test a client and GraphQL backend&lt;/li&gt;
&lt;li&gt;Implementing scaling/pagination for a GraphQL API coupled with Relay client&lt;/li&gt;
&lt;li&gt;Write test cases for backend and frontend (Bonus: React Storybooks)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;I will also be posting a ton of content on a site I have been cooking - &lt;a href="https://graphql.in"&gt;GraphQL.in&lt;/a&gt;&lt;/p&gt;


</description>
      <category>react</category>
      <category>relay</category>
      <category>graphql</category>
    </item>
    <item>
      <title>CodeSandbox — React Scraping Protection</title>
      <dc:creator>Divyendu Singh</dc:creator>
      <pubDate>Thu, 30 Nov 2017 20:29:10 +0000</pubDate>
      <link>https://dev.to/divyenduz/codesandbox--react-scraping-protection-527</link>
      <guid>https://dev.to/divyenduz/codesandbox--react-scraping-protection-527</guid>
      <description>

&lt;h4&gt;
  
  
  TL;DR; This is a fanboy post for CodeSandbox!
&lt;/h4&gt;

&lt;h3&gt;
  
  
  Introduction
&lt;/h3&gt;

&lt;p&gt;One of the primary aims of CodeSandbox was to provide a completely native offline development experience in the browser and I just wrote a small component and made a &lt;a href="https://github.com/divyenduz/React-Scraping-Protection"&gt;Github repository&lt;/a&gt; out of it, all in CodeSandBox.&lt;/p&gt;

&lt;p&gt;&lt;iframe width="710" height="399" src="https://www.youtube.com/embed/5lR29NsJKW8"&gt; &lt;/iframe&gt;&lt;/p&gt;

&lt;p&gt;I just gave it a go and it looks pretty solid to me. This is an embed of the component (again using, yes, you guessed it! CodeSandbox):-&lt;/p&gt;

&lt;p&gt;&lt;a href="https://medium.com/media/ec59550d7c5be9ce0bd95e1922ef6f55/href"&gt;&lt;/a&gt;&lt;a href="https://medium.com/media/ec59550d7c5be9ce0bd95e1922ef6f55/href"&gt;https://medium.com/media/ec59550d7c5be9ce0bd95e1922ef6f55/href&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I also changed the underlying repository name and CodeSandbox was able to take care of that.&lt;/p&gt;

&lt;p&gt;Notable things:-&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;All commits were made through CodeSandbox.&lt;/li&gt;
&lt;li&gt;The Github integration (albeit, in beta) looks solid.&lt;/li&gt;
&lt;li&gt;It has an integration for &lt;a href="https://zeit.co/now"&gt;deploying to Now!&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://github.com/Microsoft/monaco-editor"&gt;Monaco editor&lt;/a&gt; (based on VSCode) is sleek and provides a solid — offline like experience with auto-complete and click-to-jump functionality.&lt;/li&gt;
&lt;li&gt;Integration with Medium (the above link is a CodeSandbox link pasted into Medium).&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://hackernoon.com/how-we-make-npm-packages-work-in-the-browser-announcing-the-new-packager-6ce16aa4cee6"&gt;Ability to add npm modules through a web interface&lt;/a&gt;.&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;
  
  
  Component — ReactScrapingProtection
&lt;/h3&gt;

&lt;p&gt;The component itself is pretty basic. The aim is to be able to render strings lazily for it to be protected from bot scraping.&lt;/p&gt;

&lt;p&gt;Of course, this applies less to client side only apps, albeit, it is widely belived that &lt;a href="https://news.ycombinator.com/item?id=13294779"&gt;Google can understand Javascript&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;This component is made for situation when React components are being rendered on the server side with frameworks like &lt;a href="https://github.com/zeit/next.js"&gt;next.js&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;I have not tested the component yet in SSR environment (both locally and in production)! I was just playing around with CodeSanbox and the API might change.&lt;/p&gt;

&lt;p&gt;That’s all for now! Happy coding!&lt;/p&gt;





</description>
      <category>bots</category>
      <category>developerexperience</category>
      <category>codesandbox</category>
      <category>webscraping</category>
    </item>
    <item>
      <title>A Comprehensive Guide to Google Cloud Functions</title>
      <dc:creator>Divyendu Singh</dc:creator>
      <pubDate>Sun, 27 Aug 2017 09:11:53 +0000</pubDate>
      <link>https://dev.to/divyenduz/a-comprehensive-guide-to-google-cloud-functions-b02</link>
      <guid>https://dev.to/divyenduz/a-comprehensive-guide-to-google-cloud-functions-b02</guid>
      <description>&lt;h3&gt;
  
  
  Introduction
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://cloud.google.com/functions/" rel="noopener noreferrer"&gt;Cloud Functions&lt;/a&gt; allow us to write business logic without provisioning any infrastructure. In this post, we will talk about the flavors of &lt;a href="https://cloud.google.com/functions/" rel="noopener noreferrer"&gt;cloud functions&lt;/a&gt; available at our disposal, limitations, development/deployment workflow, local development with cloud functions emulator and code.&lt;/p&gt;

&lt;p&gt;Google describes &lt;a href="https://cloud.google.com/functions/" rel="noopener noreferrer"&gt;Cloud Functions&lt;/a&gt; as following: –&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Google Cloud Functions is a lightweight, event-based, asynchronous compute solution that allows you to create small, single-purpose functions that respond to cloud events without the need to manage a server or a runtime environment&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Without further ado, let’s dive in.&lt;/p&gt;

&lt;h3&gt;
  
  
  Cloud Functions Runtime and Dependencies
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://cloud.google.com/functions/" rel="noopener noreferrer"&gt;Cloud Function&lt;/a&gt; are modules written in Javascript and run in a &lt;a href="https://nodejs.org/en/" rel="noopener noreferrer"&gt;Node runtime&lt;/a&gt;. The &lt;a href="https://cloud.google.com/functions/" rel="noopener noreferrer"&gt;Cloud Functions&lt;/a&gt; execution environment follows the &lt;a href="https://nodejs.org/en/" rel="noopener noreferrer"&gt;Node&lt;/a&gt; “LTS” releases, the current Node version running in &lt;a href="https://cloud.google.com/functions/" rel="noopener noreferrer"&gt;Cloud Functions&lt;/a&gt; is &lt;a href="https://nodejs.org/en/" rel="noopener noreferrer"&gt;Node&lt;/a&gt; v6.11.1.&lt;/p&gt;

&lt;p&gt;For dependencies, there is only good news as you can use the powers of &lt;a href="https://cloud.google.com/functions/docs/writing/dependencies" rel="noopener noreferrer"&gt;npm and package.json&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;P.S. when deploying from local machine as we will see further in this post, you can deploy configuration files/credential keys for access (not advised to version control the credential keys though). Use &lt;a href="https://cloud.google.com/deployment-manager/" rel="noopener noreferrer"&gt;Google Cloud Deployment Manager&lt;/a&gt; for provisioning configuration.&lt;/p&gt;

&lt;h3&gt;
  
  
  Types of Cloud Functions
&lt;/h3&gt;

&lt;p&gt;Google Cloud Functions come in two flavors: –&lt;/p&gt;

&lt;h4&gt;
  
  
  Foreground (HTTP) Functions
&lt;/h4&gt;

&lt;p&gt;These functions get an HTTP URL to be invoked from out in the wild. Like the one below, check it out.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://us-central1-divu-178107.cloudfunctions.net/hello-world" rel="noopener noreferrer"&gt;https://us-central1-divu-178107.cloudfunctions.net/hello-world&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Writing an HTTP Cloud Function is pretty straight forward, you export a function with the request, response arguments (like express). This is how the code for the above function looks like: –&lt;/p&gt;


&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;


&lt;h4&gt;
  
  
  Background Functions
&lt;/h4&gt;

&lt;p&gt;This flavor of Cloud Functions allows us to handle events from our cloud infrastructure, such as listening to messages on a Pub/Sub topic or changes in a Google Cloud Storage bucket. Suppose you want to write a cloud function that resizes images to different variations on upload to Google Cloud Storage. That function would look something like this.&lt;/p&gt;


&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;


&lt;p&gt;Important note from the &lt;a href="https://cloud.google.com/functions/docs/writing/background" rel="noopener noreferrer"&gt;docs&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Note: You should always either invoke the callback argument, or return a Promise when your function has completed. Otherwise, your function may continue to run and be forcibly terminated by the system.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Also, refer to the docs for details on event parameters and more information on the callback.&lt;/p&gt;

&lt;h4&gt;
  
  
  How to create Foreground (HTTP), Background Function
&lt;/h4&gt;

&lt;p&gt;You get to choose the type of function you want to create while creating a Cloud Function via choosing a trigger and this is how you choose between creating different types of functions.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F300%2F1%2AyqttFy9zxC8X5UOIVWDG-A.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F300%2F1%2AyqttFy9zxC8X5UOIVWDG-A.png"&gt;&lt;/a&gt;Choose trigger while creating a CloudÂ Function&lt;/p&gt;

&lt;p&gt;The same can be done from command line as well using gcloud utility as follows: –&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;gcloud beta functions deploy &amp;lt;function-name&amp;gt; --stage-bucket &amp;lt;bucket-to-store-the-function-to&amp;gt; --trigger-http # Deploy HTTP function

gcloud beta functions deploy &amp;lt;function-name&amp;gt; --stage-bucket &amp;lt;bucket-to-store-the-function-to&amp;gt; --trigger-bucket=&amp;lt;bucket-on-which-we-want-to-listen-events&amp;gt; # Deploy background function
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You can also call functions from command line to test them as follows: –&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;functions call &amp;lt;function-name&amp;gt; --data='{"message":"Hello World"}' # HTTP function

functions call &amp;lt;function-name&amp;gt; --data='{"name":"&amp;lt;file-name-that-fake-triggered-this-event&amp;gt;","bucket":"&amp;lt;bucket-name-that-fake-triggered-this-event&amp;gt;"}' # Background function
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Lastly, cloud functions have &lt;a href="https://cloud.google.com/functions/quotas" rel="noopener noreferrer"&gt;quotas&lt;/a&gt; that we should be aware of.&lt;/p&gt;

&lt;h4&gt;
  
  
  &lt;strong&gt;Meta information about cloud functions&lt;/strong&gt;
&lt;/h4&gt;

&lt;p&gt;I added this as a bonus in this section because I feel this is important. You have access to /tmp to store temporary files according to the &lt;a href="https://cloud.google.com/functions/pricing" rel="noopener noreferrer"&gt;docs&lt;/a&gt;.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Local Disk

Cloud Functions provides access to a local disk mount point (/tmp) which is known as a "tmpfs" volume in which data written to the volume is stored in memory. There is no specific fee associated with this however writing data to the /tmp mountpoint will consume memory resources provisioned for the function.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This is really handy if you want to process files and need a temporary storage before putting it in Google Cloud Storage bucket.&lt;/p&gt;

&lt;p&gt;Also, to upload files, you need to convert them to base64 encoded strings (I could not find ability to upload files otherwise in &lt;a href="https://cloud.google.com/functions/docs/writing/http" rel="noopener noreferrer"&gt;docs&lt;/a&gt;, please correct me if I am wrong). Cloud Functions use &lt;a href="https://github.com/expressjs/body-parser" rel="noopener noreferrer"&gt;body-parser&lt;/a&gt; and hence the limitation.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F1024%2F1%2AokxdNTvXBbmwAPb6CwyiHA.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F1024%2F1%2AokxdNTvXBbmwAPb6CwyiHA.png"&gt;&lt;/a&gt;Description of parsing done by HTTP functions&lt;/p&gt;

&lt;p&gt;Ending the meta information section with &lt;a href="https://mhaligowski.github.io/blog/2017/05/15/serving-functions-express.html" rel="noopener noreferrer"&gt;this nice blog post&lt;/a&gt;, that talks about sharing functions between Google Cloud and Express.&lt;/p&gt;

&lt;h3&gt;
  
  
  Development and Deployment Workflow
&lt;/h3&gt;

&lt;p&gt;While it is possible to write cloud functions from the google developer console, deploy it and test it from there, it would make for a terrible developer experience as a cloud function may take up to 2 minutes to deploy.&lt;/p&gt;

&lt;p&gt;Enter &lt;a href="https://cloud.google.com/functions/docs/emulator" rel="noopener noreferrer"&gt;Cloud Functions Emulator&lt;/a&gt;, whilst still in alpha at the time of this writing, it is a great tool that helped me a ton while working with Cloud Functions. You can install the emulator using the following command.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;yarn global add @google-cloud/functions-emulator
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Once setup, the emulator can be used with functions command. Here is a list of commands (not exhaustive) available at your disposal.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;functions --help
functions &amp;lt;command&amp;gt; --help
functions start
functions stop
functions kill
functions deploy helloWorld --trigger-http
functions call helloWorld --data='{"message":"Hello World"}'
functions list
functions status
functions debug &amp;lt;function-name&amp;gt;
functions inspect &amp;lt;function-name&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Notice how closely the functions emulator follows the syntax of gcloud command to deploy and call functions. This caters for an amazing development experience as now you can write, test, automate-tests for your functions locally and version control them before actual deployment.&lt;/p&gt;

&lt;p&gt;You can also deploy Cloud Function directly from &lt;a href="https://cloud.google.com/functions/docs/deploying/repo" rel="noopener noreferrer"&gt;source control&lt;/a&gt;.&lt;/p&gt;

&lt;h4&gt;
  
  
  Next steps
&lt;/h4&gt;

&lt;p&gt;Play around with Google Cloud Function for fun and glory and jump to &lt;a href="https://serverless.com/" rel="noopener noreferrer"&gt;serverless frameworks&lt;/a&gt; for writing production grade code.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://serverless.com/" rel="noopener noreferrer"&gt;Serverless - The Serverless Application Framework powered by AWS Lambda and API Gateway&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;And that’s all for this post, I would really appreciate feedback via comments or &lt;a href="https://twitter.com/divyenduz" rel="noopener noreferrer"&gt;twitter&lt;/a&gt; and claps.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://medium.com/media/e9d4dcab1161d9df16e59865831303d1/href" rel="noopener noreferrer"&gt;&lt;/a&gt;&lt;a href="https://medium.com/media/e9d4dcab1161d9df16e59865831303d1/href" rel="noopener noreferrer"&gt;https://medium.com/media/e9d4dcab1161d9df16e59865831303d1/href&lt;/a&gt;&lt;/p&gt;




</description>
      <category>serverlessarchitect</category>
      <category>googlecloudplatfor</category>
      <category>serverless</category>
      <category>serverlessapps</category>
    </item>
  </channel>
</rss>
