<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Open GraphQL - Medium]]></title>
        <description><![CDATA[Anything &amp; Everything GraphQL - Medium]]></description>
        <link>https://medium.com/open-graphql?source=rss----2541ed02c698---4</link>
        <image>
            <url>https://cdn-images-1.medium.com/proxy/1*TGH72Nnw24QL3iV9IOm4VA.png</url>
            <title>Open GraphQL - Medium</title>
            <link>https://medium.com/open-graphql?source=rss----2541ed02c698---4</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 30 Nov 2026 11:45:27 GMT</lastBuildDate>
        <atom:link href="https://medium.com/feed/open-graphql" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com" rel="hub"/>
        <item>
            <title><![CDATA[Build a SpringBoot powered GraphQL Java Server in under 10 mins]]></title>
            <link>https://medium.com/open-graphql/build-a-springboot-powered-graphql-java-server-in-under-10-mins-eba8770453c4?source=rss----2541ed02c698---4</link>
            <guid isPermaLink="false">https://medium.com/p/eba8770453c4</guid>
            <category><![CDATA[spring-boot]]></category>
            <category><![CDATA[java]]></category>
            <category><![CDATA[graphql]]></category>
            <category><![CDATA[software-engineering]]></category>
            <category><![CDATA[programming]]></category>
            <dc:creator><![CDATA[Prithviraj Pawar]]></dc:creator>
            <pubDate>Mon, 02 Aug 2021 09:40:40 GMT</pubDate>
            <atom:updated>2021-08-02T09:40:39.914Z</atom:updated>
            <content:encoded><![CDATA[<h3>Build a GraphQL Server With Java Spring Boot</h3><h4>Learn how to build Spring Boot powered GraphQL server in under 10 minutes</h4><figure><img alt="Laptop on a desk" src="https://cdn-images-1.medium.com/max/1024/1*h4TLlisFk7XvtREAsS7C7Q.jpeg" /><figcaption>Photo by <a href="https://unsplash.com/@cgower?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Christopher Gower</a> on <a href="https://unsplash.com/s/photos/laptop?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Unsplash</a></figcaption></figure><p>GraphQL is being used every day by all the users of Facebook and Instagram. GraphQL is a query language for fetching data over the internet. Since its public announcement by Facebook in 2015, it has sparked interest in many minds. <a href="http://graphql.org/">GraphQL</a> has primarily been used in JavaScript. In fact, Facebook released the reference implementation for it in JavaScript (<a href="https://github.com/graphql/graphql-js">graphql-js</a>).</p><p>But this blog post will focus on the development of the GraphQL server in Java. <a href="https://github.com/graphql-java/graphql-java"><strong>GraphQL-Java</strong></a> is the corresponding GraphQL implementation in Java, and it gets updated and version improvements almost every month. Features like instrumentation, asynchronous calls to the backend, the dataloader, directives, and many more make it a very interesting and powerful repository in Java.</p><figure><img alt="GraphQL Logo" src="https://cdn-images-1.medium.com/max/1000/1*55Tp4JdXkjmDk06cofn6qg.png" /></figure><h3>How to build a GraphQL Java Server in springboot</h3><p>Let’s take the example of a magic school from the <strong>Harry Potter Universe</strong>. The magic school’s data is as follows:</p><figure><img alt="Data model" src="https://cdn-images-1.medium.com/max/1024/1*2gvxcj9BkFx-A07zZTbdrQ.jpeg" /></figure><p>Here the DataStores can be backend servers or even Databases. A RESTful fetching will look like below.</p><pre>GET: /student?{parameters}<br>GET: /House?{parameters}</pre><p>Basically, expose an interface for a service. Thus if <strong>Professors</strong> are added to the above model, then a new endpoint has to be opened and the client has to take multiple round trips. Also if the client wants nested data like <strong>Harry’s wand</strong><em> </em><strong>origin</strong><em> </em>or<em> </em><strong>Ron’s house color,</strong><em> </em>then the API server has to call the backend twice. It will also result in some unwanted House and wand information.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fblue-sea-697d.quartiers047.workers.dev%3A443%2Fhttps%2Fgiphy.com%2Fembed%2F3o6YfYvk4uB415sOTm%2Ftwitter%2Fiframe&amp;display_name=Giphy&amp;url=https%3A%2F%2Fblue-sea-697d.quartiers047.workers.dev%3A443%2Fhttps%2Fmedia.giphy.com%2Fmedia%2F3o6YfYvk4uB415sOTm%2Fgiphy.gif&amp;image=https%3A%2F%2Fblue-sea-697d.quartiers047.workers.dev%3A443%2Fhttps%2Fi.giphy.com%2Fmedia%2F3o6YfYvk4uB415sOTm%2Fgiphy.gif&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=giphy" width="435" height="224" frameborder="0" scrolling="no"><a href="https://medium.com/media/8a4114958934b8693a64900379701811/href">https://medium.com/media/8a4114958934b8693a64900379701811/href</a></iframe><p><strong>Enter GraphQL</strong>: GraphQL is a schema-driven approach to fetching data. It models the data as graphs, and you have to issue a query to fetch the data. It works like SQL, but for web objects. So, a graphQL query for <strong>Harry</strong> looks like this:</p><pre>query{<br>Magic School{<br>Student{<br>name<br>wand{<br>origin<br>}}}}</pre><p>Before going into GraphQL, we need to set up a Spring MVC. The easiest way to do this is <a href="https://start.spring.io/">SpringBootStarter</a>. You can select your desired build automation tool. This gives a package of spring embedded Tomcat ready to run on port 8080. To test Tomcat, run:</p><pre>$gradle clean build<br>$java -jar ./build/libs/graphql-demo-0.0.1-SNAPSHOT.jar</pre><p>By default, Gradle names your JAR “project_name-version-SNAPSHOT.jar”. Check <a href="http://localhost:8080/"><em>http:localhost:8080</em></a><em> </em>to see Tomcat running on port 8080.</p><p>Let’s now add a <a href="https://github.com/graphql-java/graphql-java">GraphQL-Java</a> dependency in our <strong>build.gradle</strong><em>.</em></p><pre>dependencies {<br>compile(&#39;com.graphql-java:graphql-java:{version}&#39;)<br>compile group: &#39;org.json&#39;, name: &#39;json&#39;, version: &#39;20170516&#39;<br>}</pre><p>Add the current version as found in the <a href="https://mvnrepository.com/artifact/com.graphql-java/graphql-java">mavenCentral</a> repository. Currently, the latest version is 8.0. Also add <strong>org.json,</strong> which is a handy library as GraphQL handles the request-response in JSON.</p><p>As I mentioned earlier, GraphQL is a schema-driven language. It asks users to select objects in the query against the schema.</p><p>Let’s dive right in:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/25c5426cd0f2828146deb99c7b6fa06f/href">https://medium.com/media/25c5426cd0f2828146deb99c7b6fa06f/href</a></iframe><p>We have opened a <strong>/graphql</strong><em> </em>interface for GraphQL POST requests<em>. </em>We need to create a schema for representing data.</p><ul><li><strong>SchemaGenerator</strong> parses the schema and creates an <a href="https://en.wikipedia.org/wiki/Abstract_syntax_tree">Abstract Syntax Tree </a>with field names as the child nodes.</li><li>Then the fields are assigned types by <strong>TypeDefinitionRegistry,<em> </em></strong>for example, Int, String, and so on. GraphQL has a nice <a href="http://graphql-java.readthedocs.io/en/latest/scalars.html">Type system</a> wherein we can have custom types in the schema including enum, interfaces, unions, Lists, and more.</li><li>Take a look at the <strong>RuntimeWiring()</strong> step where the field “MagicSchool” is mapped to “Hogwarts” by a <strong>StaticDataFetcher</strong><em>.</em></li><li>Every field is backed up by a <strong>datafetcher,</strong> and it is the job of datafetcher to resolve the data and return it to GraphQL.</li><li>Then GraphQL wires it with the defined schema names, whether it’s a nested map of lists or a generic Map. GraphQL does it as long as you define the proper schema.</li><li>After Sending this data to<strong> ExecutionInput</strong>, the GraphQL engine parses-&gt; validates-&gt;fetches-&gt;executes the query and returns you a JSON output of the response using <strong>.toSpecifiation()</strong></li></ul><p>Let’s issue a query using <a href="https://github.com/graphql/graphiql">GraphiQL</a>. Add this extension to your browser and set the endpoint.</p><figure><img alt="Graphiql editor" src="https://cdn-images-1.medium.com/max/1024/1*CKJMKjvUEv4B4j-zjvc6XA.png" /></figure><p>Look how the shape of your query determines the shape of the response. The schema can be visualized neatly because of the introspective nature of GraphQL. This enables the Validation and Syntax checking of the schema automatically due to the Abstract Syntax Tree created while parsing the schema.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fblue-sea-697d.quartiers047.workers.dev%3A443%2Fhttps%2Fgiphy.com%2Fembed%2FXreQmk7ETCak0%2Ftwitter%2Fiframe&amp;display_name=Giphy&amp;url=https%3A%2F%2Fblue-sea-697d.quartiers047.workers.dev%3A443%2Fhttps%2Fmedia.giphy.com%2Fmedia%2FXreQmk7ETCak0%2Fgiphy.gif&amp;image=https%3A%2F%2Fblue-sea-697d.quartiers047.workers.dev%3A443%2Fhttps%2Fmedia1.giphy.com%2Fmedia%2Fv1.Y2lkPTc5MGI3NjExZTFxbnduOW05Mnp4bHVnbDhhMWIzN3ViNzZzYmhxaWwwOXF2YnAxeSZlcD12MV9naWZzX2dpZklkJmN0PWc%2FXreQmk7ETCak0%2Fgiphy.gif&amp;key=d04bfffea46d4aeda930ec88cc64b87c&amp;type=text%2Fhtml&amp;schema=giphy" width="435" height="326" frameborder="0" scrolling="no"><a href="https://medium.com/media/bdff1834dc43b94b4017faebc6e61d88/href">https://medium.com/media/bdff1834dc43b94b4017faebc6e61d88/href</a></iframe><p>Let’s add some more fields in the schema. We’ll build a<a href="http://graphql-java.readthedocs.io/en/latest/schema.html"> Schema Definition Language</a>. Create a file named <strong>magicSchool.graphql.</strong></p><pre>type Query{<br>magicSchool:MagicSchool<br>}<br>type MagicSchool{<br>name: String<br>HeadMaster:String<br>student:Student<br>}<br>type Student{<br>name:String<br>wand:Wand<br>house:House<br>}<br>type House{<br>name:String<br>color:String<br>points:Int<br>}<br>type Wand{<br>name:String<br>origin:String<br>}</pre><p>Modify the schema source in the code and check the new schema in GraphiQL</p><pre>File schemaFile = loadSchema(&quot;magicSchool.graphql&quot;);</pre><pre>TypeDefinitionRegistry typeRegistry=schemaParser.parse(schemaFile);</pre><p>The runtimeWiring for the schema and fetchers changes significantly to include the other Types. Each type has its independent DataFetcher.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/4333ef39141cb565ee58e171a4e811c5/href">https://medium.com/media/4333ef39141cb565ee58e171a4e811c5/href</a></iframe><p>Here we have <strong>@Autowired</strong> all the fetchers to get us the data. Every GraphQL type is backed up by a type resolver (data fetcher). These resolvers are independent of each other and can have different sources. Every DataFetcher here has a <strong>DatafetchingEnvironment,</strong> which is an interface into the GraphQL query execution. It contains the <strong>query-arguments</strong><em>, </em><strong>context</strong><em>, </em><strong>executionId</strong><em>, </em><strong>field-specific parameters, </strong>and so on<em>.</em></p><p>Take a look at StudentFetcher and the Output of our query (ignore the Extensions):</p><pre>public DataFetcher getData() {<br>    return environment -&gt; {<br>        Map&lt;String, Object&gt; student = new HashMap&lt;&gt;();<br>        if (&quot;1&quot;.equalsIgnoreCase(environment.getArgument(&quot;id&quot;))) {<br>            student.put(&quot;name&quot;, &quot;Harry Potter&quot;);<br>        }<br>        return student;<br>    };<br>}</pre><figure><img alt="GraphiQL Output" src="https://cdn-images-1.medium.com/max/1024/1*IHNWKg07X-IssEV5Ixefbw.png" /><figcaption>GraphiQL Output</figcaption></figure><p>Reminds you of SQL, doesn’t it? Also, see how <strong>Underfetching</strong> and <strong>Overfetching</strong> get eliminated, and the control of the data is all in the client’s hands. Now we can get Harry and Ron’s information neatly and in one call to the server!</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fblue-sea-697d.quartiers047.workers.dev%3A443%2Fhttps%2Fgiphy.com%2Fembed%2FAylNEiYGiIDg4%2Ftwitter%2Fiframe&amp;display_name=Giphy&amp;url=https%3A%2F%2Fblue-sea-697d.quartiers047.workers.dev%3A443%2Fhttps%2Fmedia.giphy.com%2Fmedia%2FAylNEiYGiIDg4%2Fgiphy.gif&amp;image=https%3A%2F%2Fblue-sea-697d.quartiers047.workers.dev%3A443%2Fhttps%2Fi.giphy.com%2Fmedia%2FAylNEiYGiIDg4%2Fgiphy.gif&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=giphy" width="435" height="271" frameborder="0" scrolling="no"><a href="https://medium.com/media/78b2dea62e3ae7f64b8a3e06246905a3/href">https://medium.com/media/78b2dea62e3ae7f64b8a3e06246905a3/href</a></iframe><h3>GraphQL Execution Strategy and Instrumentation</h3><p>Each query execution is Asynchronous in graphql-java. When you call <strong>build.execute(executionInput)</strong><em>, </em>it returns a <a href="https://docs.oracle.com/javase/8/docs/api/java/util/concurrent/CompletableFuture.html">CompletableFuture</a> object which gets completed when the query completes its flow of execution.</p><p>Also, as the fields are resolved separately, in the above example the <strong>Wand</strong> and <strong>House</strong> information are fetched and executed in parallel. The default ExecutionStrategy uses Java’s fork-join pool, but you can add your custom threadpool using the Executor Class.</p><pre>ExecutorService executorService = new ThreadPoolExecutor(<br>            128, /* core pool size 128 threads */<br>            256, /* max pool size 256 threads */<br>            10, TimeUnit.<em>SECONDS</em>,<br>            new LinkedBlockingQueue&lt;Runnable&gt;(),<br>            new ThreadPoolExecutor.CallerRunsPolicy());</pre><pre>    return GraphQL.<em>newGraphQL</em>()<br>            .instrumentation(new TracingInstrumentation ()) <br>            .queryExecutionStrategy(new ExecutorServiceExecutionStrategy(executorService))<br>            .build();<br>}</pre><p>graphql-java allows you to instrument the query execution at every point: <strong>beforeExecution</strong><em>, </em><strong>beforeParsing</strong><em>, </em>and<em> </em><strong>beforeFetching</strong><em>.</em> You can extend the <strong>Instrumentation</strong> class and provide your own action at each step — for example, logging the queries and returning the time of each step.</p><p>The instrumentation output provides an extensions map in <a href="https://www.apollographql.com/engine/">Apollo Tracing format</a> by default. This can later be used by a certain client to visualize the execution data (for example, using elastic-search and Grafana). Now you know what the extensions in the above picture mean!</p><p>The complete code of the above example can be accessed from <a href="https://github.com/prithvi10/GraphQL-Java-Spring">here</a>.</p><h3>Wrapping up</h3><p>There are many more features in graphql-java, like <a href="http://graphql-java.readthedocs.io/en/latest/batching.html"><strong>Dataloader</strong></a> (which solves the N+1 fetching problem), <strong>directives</strong> (which make schema writing easier), and so on. GraphQL is an emerging technology that makes the client’s life easier and can change how we do things on the Internet. That is why many companies like Facebook, Twitter, GitHub, and Coursera have already adopted it.</p><p>I would love to hear your comments about GraphQL. Please share your views. Also if you like the blog post, don’t forget to clap.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=eba8770453c4" width="1" height="1" alt=""><hr><p><a href="https://medium.com/open-graphql/build-a-springboot-powered-graphql-java-server-in-under-10-mins-eba8770453c4">Build a SpringBoot powered GraphQL Java Server in under 10 mins</a> was originally published in <a href="https://medium.com/open-graphql">Open GraphQL</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Monitoring Graphene Django Python GraphQL API Using Sentry]]></title>
            <description><![CDATA[<div class="medium-feed-item"><p class="medium-feed-image"><a href="https://medium.com/open-graphql/monitoring-graphene-django-python-graphql-api-using-sentry-c0b0c07a344f?source=rss----2541ed02c698---4"><img src="https://cdn-images-1.medium.com/max/2600/0*qG9Pxnf8ZhbvYkfz" width="5184"></a></p><p class="medium-feed-snippet">Read About How To Set Up Sentry With Your Python GraphQL API In 5 Minutes</p><p class="medium-feed-link"><a href="https://medium.com/open-graphql/monitoring-graphene-django-python-graphql-api-using-sentry-c0b0c07a344f?source=rss----2541ed02c698---4">Continue reading on Open GraphQL »</a></p></div>]]></description>
            <link>https://medium.com/open-graphql/monitoring-graphene-django-python-graphql-api-using-sentry-c0b0c07a344f?source=rss----2541ed02c698---4</link>
            <guid isPermaLink="false">https://medium.com/p/c0b0c07a344f</guid>
            <category><![CDATA[error-handling]]></category>
            <category><![CDATA[api]]></category>
            <category><![CDATA[graphql]]></category>
            <category><![CDATA[django]]></category>
            <category><![CDATA[monitoring]]></category>
            <dc:creator><![CDATA[Jerry Ng]]></dc:creator>
            <pubDate>Mon, 15 Mar 2021 03:54:11 GMT</pubDate>
            <atom:updated>2022-03-22T14:42:06.293Z</atom:updated>
        </item>
        <item>
            <title><![CDATA[Solving N+1 Problem With Dataloader in Python Graphene Django]]></title>
            <description><![CDATA[<div class="medium-feed-item"><p class="medium-feed-image"><a href="https://medium.com/open-graphql/solving-n-1-problem-with-dataloader-in-python-graphene-django-7a75d6c259ba?source=rss----2541ed02c698---4"><img src="https://cdn-images-1.medium.com/max/2600/0*fqZdRwOFGq-Wdfwm" width="3428"></a></p><p class="medium-feed-snippet">A Guide With Examples on How to Use Dataloader in Graphene-Django to Optimize our Python GraphQL API</p><p class="medium-feed-link"><a href="https://medium.com/open-graphql/solving-n-1-problem-with-dataloader-in-python-graphene-django-7a75d6c259ba?source=rss----2541ed02c698---4">Continue reading on Open GraphQL »</a></p></div>]]></description>
            <link>https://medium.com/open-graphql/solving-n-1-problem-with-dataloader-in-python-graphene-django-7a75d6c259ba?source=rss----2541ed02c698---4</link>
            <guid isPermaLink="false">https://medium.com/p/7a75d6c259ba</guid>
            <category><![CDATA[sql]]></category>
            <category><![CDATA[python]]></category>
            <category><![CDATA[optimization]]></category>
            <category><![CDATA[graphql]]></category>
            <category><![CDATA[django]]></category>
            <dc:creator><![CDATA[Jerry Ng]]></dc:creator>
            <pubDate>Sun, 17 Jan 2021 07:38:18 GMT</pubDate>
            <atom:updated>2021-08-13T04:45:21.101Z</atom:updated>
        </item>
        <item>
            <title><![CDATA[JSONField Models in Graphene Django]]></title>
            <description><![CDATA[<div class="medium-feed-item"><p class="medium-feed-image"><a href="https://medium.com/open-graphql/jsonfield-models-in-graphene-django-308ae43d14ee?source=rss----2541ed02c698---4"><img src="https://cdn-images-1.medium.com/max/1736/1*GaJcT7RTVeBDGpbokD3LNA.png" width="1736"></a></p><p class="medium-feed-snippet">How to Return JSON in Python Graphene Resolver Without Backslashes and Quotation Marks</p><p class="medium-feed-link"><a href="https://medium.com/open-graphql/jsonfield-models-in-graphene-django-308ae43d14ee?source=rss----2541ed02c698---4">Continue reading on Open GraphQL »</a></p></div>]]></description>
            <link>https://medium.com/open-graphql/jsonfield-models-in-graphene-django-308ae43d14ee?source=rss----2541ed02c698---4</link>
            <guid isPermaLink="false">https://medium.com/p/308ae43d14ee</guid>
            <category><![CDATA[django]]></category>
            <category><![CDATA[python]]></category>
            <category><![CDATA[technology]]></category>
            <category><![CDATA[graphene]]></category>
            <category><![CDATA[graphql]]></category>
            <dc:creator><![CDATA[Jerry Ng]]></dc:creator>
            <pubDate>Sat, 26 Dec 2020 23:45:37 GMT</pubDate>
            <atom:updated>2021-11-04T01:54:36.797Z</atom:updated>
        </item>
        <item>
            <title><![CDATA[Create a Multiuser GraphQL CRUD(L) App in 5 minutes with the Amplify DataStore]]></title>
            <link>https://medium.com/open-graphql/create-a-multiuser-graphql-crud-l-app-in-5-minutes-with-the-amplify-datastore-902764f27404?source=rss----2541ed02c698---4</link>
            <guid isPermaLink="false">https://medium.com/p/902764f27404</guid>
            <category><![CDATA[react]]></category>
            <category><![CDATA[amplify-datastore]]></category>
            <category><![CDATA[graphql]]></category>
            <category><![CDATA[aws-appsync]]></category>
            <category><![CDATA[dynamodb]]></category>
            <dc:creator><![CDATA[Ed Lima]]></dc:creator>
            <pubDate>Wed, 22 Jan 2020 00:08:36 GMT</pubDate>
            <atom:updated>2020-01-22T00:53:28.774Z</atom:updated>
            <content:encoded><![CDATA[<p>A little longer than a year ago I wrote about <a href="https://medium.com/open-graphql/create-a-multiuser-graphql-crud-l-app-in-10-minutes-with-the-new-aws-amplify-cli-and-in-a-few-73aef3d49545">my experience with the Amplify CLI</a>, just released back then, and how it enabled me to create a multiuser GraphQL CRUD(L) application in minutes. It’s probably a good time to revisit the article and update/refactor my old app to use the recently released Amplify DataStore, taking advantage of its simpler programming model and convenient built-in capabilities as well as getting on with the times and adding React Hooks to the mix.</p><p>But what’s the Amplify DataStore and how it can make my life as a developer easier? In case you have some spare time, here’s a great video explaining why the DataStore was created and what problems it’s trying to solve:</p><h3>Ed Lima on Twitter</h3><p>Fantastic deep dive on Amplify DataStore by @undef_obj. Learn more about the reasons why the @AWSAmplify team built it and the advantages it&#39;ll bring to your app with a simple programming model, built-in offline/real-time/conflict resolution capabilities https://t.co/22jV5rH4ZC</p><p>In case you don’t have spare time now, save the video for later and keep reading.</p><p>The mission if you chose to accept it: create a secure multiuser CRUDL app with even less lines of code and in less time than the app I created last year. How can the Amplify DataStore help?</p><p>The Amplify DataStore is a queryable, on-device data store for web, browsers, IoT, and mobile developers developing JavaScript, iOS, Android, and React Native apps. It provides a simple programming model for leveraging shared and distributed data without writing additional code for offline and online scenarios, which makes working with distributed, cross-user data just as simple as working with local-only data — allowing developers to create rich app experiences.</p><p>You can chose to use the DataStore standalone in your application without an AWS account however, when connected to the cloud, it enables very interesting capabilities. With a simple command you can add powerful built-in scalable real-time, offline, versioning, conflict detection and conflict resolution features powered by AWS AppSync and Amazon DynamoDB while still using a simple local-first programming model. Best of all, you don’t even need to know GraphQL to use it. GraphQL is in place behind the scenes acting as a protocol to interact with a flexible and highly available API automatically synchronizing the data to the cloud.</p><p>Same as before, in this article we have sample code that will allow you to get started quickly with a very simple CRUD application behind a managed GraphQL API backend. This is just a sample that should be used for learning purposes, it’s not one size fits all and you’ll need to adapt and change for your specific use cases.</p><p>In order to get started we’ll need to install and configure the Amplify CLI, and you can do so by following a quick tutorial <a href="https://aws-amplify.github.io/docs/#node-link">here</a>. After the CLI is configured with proper AWS credentials, execute the following commands:</p><pre>$ npx create-react-app notesapp --use-npm<br>$ cd notesapp<br>$ npm install aws-amplify aws-amplify-react @aws-amplify/core @aws-amplify/datastore bootstrap<br>$ npx amplify-app<br>$ amplify init </pre><p>Since this is a multiuser application, we need to manage users from a central location or Identity Provider and authenticate them accordingly. Let’s update the API we just created to use a Cognito User Pool that will authenticate and authorize users as required:</p><pre>$ amplify update api</pre><pre>? Please select from one of the below mentioned services: <em>GraphQL</em><br>? Choose the default authorization type for the API <br><em>Amazon Cognito User Pool</em><br>Using service: Cognito, provided by: awscloudformation</pre><pre>The current configured provider is Amazon Cognito.</pre><pre>Do you want to use the default authentication and security configuration? <em>Default configuration</em><br>Warning: you will not be able to edit these selections.<br>How do you want users to be able to sign in? <em>Username</em><br>Do you want to configure advanced settings? <em>No, I am done.</em></pre><pre>Successfully added auth resource</pre><pre>? Do you want to configure advanced settings for the GraphQL API <br><em>No, I am done.</em></pre><p>Edit the schema file notesapp/amplify/backend/api/amplifyDatasource/schema.graphql and replace its contents with:</p><pre>type Note @model @auth(rules: [{ allow: owner }]) {<br>  id: ID!<br>  note: String<br>  owner: String<br>}</pre><p>As before we’re taking advantage of the <a href="https://aws-amplify.github.io/docs/cli-toolchain/graphql">GraphQL Transform</a> useful directives such as <a href="https://aws-amplify.github.io/docs/cli-toolchain/graphql#model">@model</a> that will automatically create a DynamoDB table and all the CRUDL logic behind the scenes to store and interact with the data behind an AWS AppSync GraphQL API. We leverage the <a href="https://aws-amplify.github.io/docs/cli-toolchain/graphql#auth">@auth</a> directive and its ability to easily create simple or complex authorization rules. Notice we added an additional field owner that was not present in the old app, this is needed to authorize real-time subscriptions in the DataStore.</p><p>Now use the following commands to generate the data model then commit the changes and start the deployment of the managed serverless cloud resources (GraphQL API and noSQL table):</p><pre>$ npm run amplify-modelgen<br>$ npm run amplify-push</pre><p>The backend services and resources will be configured, linked and deployed following all the AWS best practices:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/728/1*0vBzLU_NBjEQSyMcWN381w.png" /><figcaption>Services deployed and configured with a “push”</figcaption></figure><p>Finally, while CloudFormation is doing its job to create and configure the scalable cloud resources, here’s the last piece of the puzzle. Edit the file src/App.js in the local project and overwrite the content with the following code:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/99853f1b04bd8fa9200290b96af2e1e4/href">https://medium.com/media/99853f1b04bd8fa9200290b96af2e1e4/href</a></iframe><p>Time to test! Execute amplify serve or npm start to test it locally then sign up a couple of users with a valid e-mail (you can use the same e-mail for different users) and mobile number, add some new notes and confirm one user has no access to the notes of the other user:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Sl9iejb9dax3roR62l-qaA.png" /><figcaption>DataStore in action</figcaption></figure><p>Users can create, read, update, delete, list and search their own notes in the app interacting with the data directly from the local DataStore. Everything is automatically synchronized with the DynamoDB table in the background. Offline and real-time features are built-in, users can interact with their data when disconnected or automatically get new notes or updates to current notes when connected to different devices.</p><p>Locally the data is stored on IndexedDB and can be accessed using the developer tools in the browser. In case on native mobile apps, the data would be stored in SQLite on device. Following a local first programming model, the DataStore is always interacting with local data providing fast performance and a great user experience:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/999/1*YQbVoUWobAdDA7fldYd5qA.png" /><figcaption>DataStore locally on IndexedDB</figcaption></figure><p>It’s not all apples to apples though. The original article used an Elasticsearch cluster to search data, with the DataStore we are using its local querying capabilities. On the other hand, the old app didn’t have any offline or real-time capabilities powered by WebSockets and now this is all integrated in the new app. How about lines of code? The new app has 158 lines of code whereas the old app in its final state had 185 lines of code. Mission accomplished!</p><p>The code is available on <a href="https://github.com/awsed/AppSyncGraphQLNotes"><strong>GitHub</strong></a>. From the repo you can deploy the whole app with 1-click to the Amplify Console (or directly from <a href="https://console.aws.amazon.com/amplify/home#/deploy?repo=https://github.com/awsed/AppSyncGraphQLNotes">here</a>), give it a try.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/640/1*jhPN_D1UzBBnG-FuoxeHIA.gif" /><figcaption>DataStore from Amplify Console</figcaption></figure><p>The Amplify DataStore allows developers to focus on their business logic, which is what will truly differentiate their applications. You can interact with local and cloud data interchangeably with simple intuitive commands such as DataStore.save() , DataStore.query(), DataStore.delete(), DataStore.clear() and receive real-time updates with DataStore.observe(). All the complexities of distributed data conflict resolution, real-time, offline and versioning capabilities are handled for you.</p><h3>Nader Dabit on Twitter</h3><p>Nice plug for Amplify DataStore</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=902764f27404" width="1" height="1" alt=""><hr><p><a href="https://medium.com/open-graphql/create-a-multiuser-graphql-crud-l-app-in-5-minutes-with-the-amplify-datastore-902764f27404">Create a Multiuser GraphQL CRUD(L) App in 5 minutes with the Amplify DataStore</a> was originally published in <a href="https://medium.com/open-graphql">Open GraphQL</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Open GraphQL Moving to Dev.to]]></title>
            <link>https://medium.com/open-graphql/open-graphql-moving-to-dev-to-20de142a260?source=rss----2541ed02c698---4</link>
            <guid isPermaLink="false">https://medium.com/p/20de142a260</guid>
            <category><![CDATA[graphql]]></category>
            <dc:creator><![CDATA[Nader Dabit]]></dc:creator>
            <pubDate>Mon, 12 Aug 2019 15:29:59 GMT</pubDate>
            <atom:updated>2019-08-12T15:29:59.519Z</atom:updated>
            <content:encoded><![CDATA[<p>If you’re reading this, chances are you are following either me or the Open GraphQL publication.</p><blockquote>TLDR: Check out our new publication <a href="https://dev.to/open-graphql">here</a>.</blockquote><p>Medium has defaulted all posts to be behind a paywall (meaning you need to opt out, not opt in) which has caused some confusion for people that have published here in the past. This has caused some posts to be behind a paywall that people may not have really wanted to be behind by default.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*mG4wdMpNXU9OBYqURF-0Iw.png" /><figcaption>Default setting when publishing.</figcaption></figure><p>Over the past year I’ve seen many people not enjoying the experience of reading on Medium now that many of these articles are behind this paywall so I have been slowly moving my personal as well as new publications writing to Dev.to.</p><p>I’ve created a new Open GraphQL publication there. <a href="https://dev.to/open-graphql">If you’re interested in contributing or writing about GraphQL, come join us there</a>. Dev.to is a great and thriving community of people passionate about what they do. Also, you are able to write in Markdown allowing you to easily port your content to other places with ease.</p><p>Thanks for reading!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=20de142a260" width="1" height="1" alt=""><hr><p><a href="https://medium.com/open-graphql/open-graphql-moving-to-dev-to-20de142a260">Open GraphQL Moving to Dev.to</a> was originally published in <a href="https://medium.com/open-graphql">Open GraphQL</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to resolve import for the .graphql file with typescript and webpack]]></title>
            <link>https://medium.com/open-graphql/how-to-resolve-import-for-the-graphql-file-with-typescript-and-webpack-7a34c906e4c1?source=rss----2541ed02c698---4</link>
            <guid isPermaLink="false">https://medium.com/p/7a34c906e4c1</guid>
            <category><![CDATA[graphql]]></category>
            <category><![CDATA[typescript]]></category>
            <category><![CDATA[webpack]]></category>
            <category><![CDATA[javascript]]></category>
            <dc:creator><![CDATA[Mohsen ZareZardeyni]]></dc:creator>
            <pubDate>Wed, 10 Jul 2019 15:38:59 GMT</pubDate>
            <atom:updated>2019-07-10T15:38:59.235Z</atom:updated>
            <content:encoded><![CDATA[<h3>How to resolve import for the .graphql file with typescript and webpack</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*XtbL8cQkqP0pt-fA8MbDiA.png" /></figure><p>Hi, I’m Mohsen ZareZardeyni, and I’m a software engineer at <a href="https://sigmasoftwares.com/">Sigma Telecom LLC</a>.</p><p>At Sigma, for developing our back office application, we decided to use GraphQL, Typescript and Apollo server. We choose Schema first approach and stored our schema in separate .graphql files. In order to import our schema within our Typescript code, we ended up using Webpack as our transpiler.</p><p>As I was looking for a way to do so, I didn’t find any good tutorial on this matter so I’m providing this tutorial for future researchers!🤠</p><p>First, you need to add the following configuration to your tsconfig.json. This will tell Typescript to use src/@types folder in addition to node_modules/@types in order to identify your types.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/72dbea88c8a9cf39eb2c35435e93e010/href">https://medium.com/media/72dbea88c8a9cf39eb2c35435e93e010/href</a></iframe><p>Then you need to introduce .graphql files to Typescript. In order to do this, you need to create a graphql.d.ts in your src/@types folder. Following code will tell typescript every time it sees an imported file with .graphql extention, it will provide a GraphQL DocumentNode, which is the type you need to provide for your GraphQL schema.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/b57bfc7b37c851bc350203766983a16e/href">https://medium.com/media/b57bfc7b37c851bc350203766983a16e/href</a></iframe><p>In our case, we used apollo-server from <a href="https://medium.com/u/21b815a142a3">Apollo Foundation</a>, but any other GraphQL server library uses the same pattern. With pervious steps, the following code will let you to import your .graphql files without any typing issue.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/22e0924b99e2bd54fa6aa514b4ae15f8/href">https://medium.com/media/22e0924b99e2bd54fa6aa514b4ae15f8/href</a></iframe><p>Finally, the last step is to tell webpack how to treat .graphql imports. The following code will tell webpack every time it sees a .graphql file, it should use graphql-tag/loader in order to load the content.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/013654c2ca5c147ba7a6cf715f85ad85/href">https://medium.com/media/013654c2ca5c147ba7a6cf715f85ad85/href</a></iframe><p>Hope this helps you:)</p><p>Also, you can find me on <a href="https://www.linkedin.com/in/mohsen89z/">linkedin</a> and <a href="https://twitter.com/MohsenZZardeyni">twitter</a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7a34c906e4c1" width="1" height="1" alt=""><hr><p><a href="https://medium.com/open-graphql/how-to-resolve-import-for-the-graphql-file-with-typescript-and-webpack-7a34c906e4c1">How to resolve import for the .graphql file with typescript and webpack</a> was originally published in <a href="https://medium.com/open-graphql">Open GraphQL</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Build a StackOverflow GraphQL API & Demo App in 10 Minutes]]></title>
            <link>https://medium.com/open-graphql/build-a-stackoverflow-graphql-api-demo-app-in-10-minutes-69afbf4d037c?source=rss----2541ed02c698---4</link>
            <guid isPermaLink="false">https://medium.com/p/69afbf4d037c</guid>
            <category><![CDATA[graphql]]></category>
            <category><![CDATA[database]]></category>
            <category><![CDATA[api-development]]></category>
            <category><![CDATA[stackoverflow]]></category>
            <category><![CDATA[react]]></category>
            <dc:creator><![CDATA[Michael Hunger]]></dc:creator>
            <pubDate>Wed, 26 Jun 2019 22:16:35 GMT</pubDate>
            <atom:updated>2020-06-08T23:57:46.146Z</atom:updated>
            <content:encoded><![CDATA[<h4>Using the GRANDstack starter project in 5 steps</h4><p><strong>Update:</strong> In May 2020 I did an update <a href="https://www.youtube.com/watch?v=Quk1-LhG03E&amp;list=PL9Hl4pk2FsvXjk0hrerr78pLN-477pDLo&amp;index=12">Twitch Stream</a> and created a <a href="https://github.com/buzzoverflow">GH project “buzzoverflow”</a> with the most recent GRANDstack starter and a Neo4j 4.0 database. The dashboard is running live on <a href="https://buzzoverflow.com">buzzoverflow.com</a>.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fblue-sea-697d.quartiers047.workers.dev%3A443%2Fhttps%2Fwww.youtube.com%2Fembed%2Fvideoseries%3Flist%3DPL9Hl4pk2FsvXjk0hrerr78pLN-477pDLo&amp;display_name=YouTube&amp;url=https%3A%2F%2Fblue-sea-697d.quartiers047.workers.dev%3A443%2Fhttps%2Fwww.youtube.com%2Fwatch%3Fv%3DQuk1-LhG03E&amp;image=https%3A%2F%2Fblue-sea-697d.quartiers047.workers.dev%3A443%2Fhttps%2Fi.ytimg.com%2Fvi%2FQuk1-LhG03E%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/f5e701bb666e6f8606e91b220d83de78/href">https://medium.com/media/f5e701bb666e6f8606e91b220d83de78/href</a></iframe><p>We’ve just returned from the GraphQL Conference in Berlin, where we demoed the StackOverflow API GraphQL as a <a href="https://grandstack.io/docs/getting-started-neo4j-graphql.html">GRANDstack</a> example, which was well received</p><blockquote>After I hearing about Neo4j and GRANDstack for the first time yesterday, it took me less than an hour to make it work with my own app using your starter project.</blockquote><blockquote>- attendee at GraphQL Conference Berlin</blockquote><h3>GraphQL Conf on Twitter</h3><p>Learn how to build a GraphQL API backed by a native graph database. Catch @lyonwj and @mesirii at @GraphQLConf to see how to use https://t.co/LkNbRnIXUs to autogenerate GraphQL APIs with data fetching, filtering, pagination and ordering logic using @neo4j #GraphQLConf</p><p>The GRANDstack combines <strong>React</strong> front-ends with <strong>Apollo</strong> Client and Server providing a <strong>GraphQL</strong> API. It uses the <strong>Neo4j Database </strong>GraphQL integration, which uses the GraphQL schema to translate GraphQL queries into Cypher statements and run them against the database.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-y181i9-wb4Im1tXp6lr8Q.jpeg" /><figcaption>GRANDstack.io</figcaption></figure><p>Our GraphQL integration augments your simple type SDL with auto-generated queries and mutations that save you from writing a lot of boilerplate code.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-gE6Yh-hfuFW_hDDbPU-7g.png" /><figcaption>GRANDstack request cycle</figcaption></figure><h3>Get up and running with the GRANDstack starter for StackOverflow</h3><p>Here are the <strong>3 steps</strong> you need to get up and running yourself. With 2 bonus steps for a self-hosted database.</p><h4><strong>(ONE)</strong> Download GRANDstack starter</h4><p>Download &amp; unzip the <a href="https://github.com/grand-stack/grand-stack-starter/archive/stackoverflow.zip">GRANDstack starter for Stackoverflow</a>.</p><blockquote>Note that this is a different branch stackoverflow than the default starter from the website.</blockquote><p><em>We already prepared a Neo4j instance with some StackOverflow data on Neo4j Cloud, whose connection details are preconfigured in the </em><em>.env file of the starter api directory. <br>As you can see in the data model below, you have </em><strong><em>Users</em></strong><em> that </em><strong><em>ASKED</em></strong><em> </em><strong><em>Questions</em></strong><em> which are </em><strong><em>TAGGED</em></strong><em> with </em><strong><em>TAGS</em></strong><em> and </em><strong><em>ANSWERED</em></strong><em> by </em><strong><em>Answers</em></strong><em> </em><strong><em>PROVIDED</em></strong><em> by other </em><strong><em>Users</em></strong><em>.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*UZiAgpLdUnhuH0uF9IoCjQ.jpeg" /><figcaption>Neo4j Browser UI with StackOverflow Data Model</figcaption></figure><h4><strong>(TWO)</strong> Start the GraphQL API backend</h4><p>cd api; yarn; yarn start</p><p>It also launches a <strong><em>GraphQL Playground</em></strong> on <a href="http://http">http://localhost:4001/graphql</a> that allows you to explore the API and Documentation interactively. The top-level queries support filtering by any attribute, pagination (first, offset) and orderBy as well as complex nested filter arguments too.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*A01bJptLuI9_tLKVNTRyKQ.png" /><figcaption>GraphQL PlayGround with Example Query and Docs for Auto-Generated Queries and Mutations</figcaption></figure><p>The API backend augments the <a href="https://github.com/grand-stack/grand-stack-starter/blob/stackoverflow/api/src/schema.graphql">type definitions below</a> to serve your API.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/513dac45b39e072c4a96a02763b201fc/href">https://medium.com/media/513dac45b39e072c4a96a02763b201fc/href</a></iframe><p>If you look at the types, you’ll see that some of the fields are computed by a @cypher directive.</p><h4><strong>(THREE)</strong> Run the React Application</h4><p>cd ui;yarn;yarn start</p><p>This launches your React app (port 3000) that you can use for listing and filtering StackOverflow users.</p><p>If you check the code, you see how it uses the GraphQL API for fulltext search and for listing/selecting fields to render.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*NTPK3rbL3e8nYr_Ra7HfDg.png" /><figcaption>React application example</figcaption></figure><h4>BONUS (FOUR) Launch a Neo4j Instance</h4><p>Go to <a href="https://neo4j.com/sandbox">neo4j.com/sandbox</a> to create a <strong>blank sandbox</strong> instance.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*K7HbwC057f6kyIusxEaGYQ.png" /><figcaption>Launched Neo4j Sandbox with Details Tab for credentials.</figcaption></figure><p>Adapt the <strong>IP-address</strong> and <strong>Bolt-port</strong> and <strong>credentials</strong> from the sandbox to your .env file of the starter <strong><em>api</em></strong> directory (<strong>not</strong> the JS Bolt URL which is for web-browser access via websocket).</p><h4>BONUS (FIVE) Import StackOverflow Data into Neo4j</h4><p>After launching Neo4j Browser via the link in the sandbox, you can run the following script which loads 10 pages from the StackOverflow API for the given tag into Neo4j. It turns the JSON response of the graph of Users, Questions, Answers and Tags.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/8634fa50befb71369c8a03dc11b7a5cb/href">https://medium.com/media/8634fa50befb71369c8a03dc11b7a5cb/href</a></iframe><p>Then you can use the left sidebar to explore the data visually.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8-Va6ZWZRBMsF_uiD0GffQ.jpeg" /></figure><p>If you want to explore the data a bit more, using Neo4j directly, you can enter this command in the Neo4j Browser and start at slide <strong>number 5</strong>.</p><p>:play stackoverflow</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*IL_th68iI0fuDjdkik2eBA.png" /><figcaption>Neo4j Browser Guide :play stackoverflow</figcaption></figure><p>You can achieve the same on any of the <a href="https://neo4j.com/developer/guide-cloud-deployment/">cloud marketplaces</a> or by <a href="https://neo4j.com/developer/neo4j-desktop/">installing Neo4j Desktop</a> and adding the APOC Plugin (in the Manage -&gt; Plugins tab).</p><p>Now try to use your own dataset with Neo4j, if you need help importing data check out our data <a href="https://neo4j.com/developer/guide-importing-data-and-etl/">import guides</a> or ask in our <a href="https://community.neo4j.com/c/neo4j-graph-platform/import-export">Neo4j Community</a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=69afbf4d037c" width="1" height="1" alt=""><hr><p><a href="https://medium.com/open-graphql/build-a-stackoverflow-graphql-api-demo-app-in-10-minutes-69afbf4d037c">Build a StackOverflow GraphQL API &amp; Demo App in 10 Minutes</a> was originally published in <a href="https://medium.com/open-graphql">Open GraphQL</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[GraphQLifying REST]]></title>
            <description><![CDATA[<div class="medium-feed-item"><p class="medium-feed-image"><a href="https://medium.com/open-graphql/graphqlifying-rest-5a95d57a04c2?source=rss----2541ed02c698---4"><img src="https://cdn-images-1.medium.com/max/1800/1*MXi8GpY6jVHwYYOvY3CZmA.jpeg" width="1800"></a></p><p class="medium-feed-snippet">Transforming REST APIs to GraphQL with AWS AppSync</p><p class="medium-feed-link"><a href="https://medium.com/open-graphql/graphqlifying-rest-5a95d57a04c2?source=rss----2541ed02c698---4">Continue reading on Open GraphQL »</a></p></div>]]></description>
            <link>https://medium.com/open-graphql/graphqlifying-rest-5a95d57a04c2?source=rss----2541ed02c698---4</link>
            <guid isPermaLink="false">https://medium.com/p/5a95d57a04c2</guid>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[serverless]]></category>
            <category><![CDATA[graphql]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[aws-appsync]]></category>
            <dc:creator><![CDATA[Nader Dabit]]></dc:creator>
            <pubDate>Mon, 13 May 2019 13:14:50 GMT</pubDate>
            <atom:updated>2019-05-20T01:12:40.678Z</atom:updated>
        </item>
        <item>
            <title><![CDATA[Using Amplify CLI for adding Auth to your Hasura GraphQL engine]]></title>
            <link>https://medium.com/open-graphql/using-amplify-cli-for-adding-auth-to-your-hasura-graphql-engine-9c0d3c308a2d?source=rss----2541ed02c698---4</link>
            <guid isPermaLink="false">https://medium.com/p/9c0d3c308a2d</guid>
            <category><![CDATA[architecture]]></category>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[apollo-client]]></category>
            <category><![CDATA[hasura]]></category>
            <category><![CDATA[graphql]]></category>
            <dc:creator><![CDATA[Vladimir Novick]]></dc:creator>
            <pubDate>Mon, 22 Apr 2019 07:28:32 GMT</pubDate>
            <atom:updated>2019-04-22T07:53:57.434Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*F1rWR9ymQIAd2AUeee8vew.png" /></figure><p>Let’s assume you already played around with <a href="https://dev.to/hasurahq/hasura.io">Hasura</a> open source GraphQL engine and you were wondering how to add an authentication layer with AWS Cognito. Couple of words about Hasura if you are not familiar. Hasura is free and open source engine that auto generates GraphQL API on top of new or <strong>existing</strong> Postgres database. If this is the first time you hear about it, I suggest to check my introductory article here:</p><h3>Vladimir Novick on Twitter</h3><p>I just published Effortless Real-time GraphQL API with serverless business logic running in any cloud https://t.co/qr5UNZTGYJ</p><p>and if you were wondering about how to use Authentication with Hasura you can read about it here:</p><h3>Vladimir Novick on Twitter</h3><p>Just published a blog post explaining @HasuraHQ Authentication options including @awscloud Cognito, @auth0, @Firebase, custom auth servers or custom auth webhooks. Check it out. https://t.co/iU5ptWKYTd</p><p>In last article I showed AWS Cognito as one of solutions how to create your authentication for your app and pass Auth token to Hasura. In this article I want to explain how you do that with aws-amplify CLI as well as how you connect your users to actual cognito user pool users.</p><p>In a nutshell we will cover</p><ol><li>How to deploy Hasura</li><li>How to setup aws amplify with aws cognito</li><li>How to setup a AWS lambda to update our database after user is created in cognito</li><li>Customise cognito JWT creation to enable hasura permission rules</li></ol><h3>Table of Contents</h3><ul><li><a href="#80bc">Creating and deploying our engine</a></li><li><a href="#c62e">Setting up Hasura CLI</a></li><li><a href="#c62e">Setting our database structure</a></li><li><a href="#5fe7">Setting our Auth with Amplify CLI</a></li><li><a href="#35bb">Creating your Frontend</a></li><li><a href="#6c56">Adding a new User pool user into Hasura</a></li></ul><p><a href="#4c93">— Pre Sign Up Lambda</a></p><p><a href="#b157">— Pre token generation Lambda</a></p><p><a href="#405e">— Create Roles in Hasura Permission system</a></p><h3>Creating and deploying our engine</h3><p>Let’s start by regular step of <a href="https://heroku.com/deploy?template=https://github.com/hasura/graphql-engine-heroku">Deploying to Heroku</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/624/0*11nEFY9LJRHAVXbK.png" /></figure><blockquote><em>We also can use AWS RDS to deploy our engine which is described in detail </em><a href="https://dev.to/lineup-ninja/deploying-hasura-on-aws-with-fargate-rds-and-terraform-4gk7"><em>here</em></a></blockquote><p>Now before we setting any auth or continue in general we will secure our endpoint by setting HASURA_GRAPHQL_ADMIN_SECRET</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/880/0*TwTHvgsFTxutKrYP.png" /></figure><p>We want changes done in our console to be reflected as migrations files and stored in source control as explained in detail <a href="https://www.youtube.com/watch?v=fRHZQAEd-Q0">here</a></p><p>What we will do is set HASURA_GRAPHQL_ENABLE_CONSOLE to false in our heroku config vars</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/880/0*TVf8CIIFEnT1hGwi.png" /></figure><p>Now it’s time to init our hasura project with through <a href="https://docs.hasura.io/1.0/graphql/manual/hasura-cli/install-hasura-cli.html#install-hasura-cli">Hasura CLI</a></p><p>hasura init --endpoint <a href="https://aws-sample.herokuapp.com">https://aws-sample.herokuapp.com</a></p><p>And then</p><p>cd hasura<br>hasura console — admin-secret=&lt;your admin secret&gt;</p><p>Console will open up on localhost and whatever you do in the console will be saved in local migration files that you can store in source control.</p><h3>Setting our database structure</h3><p>Now when we have our engine set up, we need to create database structure. We will create simple blog cms so we will have only posts and users table. Important part is that users table id have to be of a text format so we can wire it up with AWS user pool properly.</p><p>Posts table will look like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/668/0*2fhRiZJAJRMXD8sA.png" /></figure><p>User table will look like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/450/0*Yb5TxjIlLvRMxyBO.png" /></figure><p>I also added object relationship from posts userId to user object</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/880/0*ObZyyThN1IxIQye8.png" /></figure><p>so we can query our users from posts query like so</p><pre>query {<br>  posts {<br>    title<br>    content<br>    user {<br>      name<br>    }<br>  }<br>}</pre><p>Now when our backend ready it’s time to set up our frontend and authentication. I don’t know what frontend framework you use, so I will use React for this example, but the process is similar in Vue and Angular. I hardly will touch Frontend here. My main goal is so you will understand the flow.</p><h3>Setting our Auth with Amplify CLI</h3><pre>npm install -g @aws-amplify/cli <br>amplify configure</pre><p>This will open up the AWS console. Once you are logged in to the console you can jump back to the command line. Then we need to specify AWS region.</p><p>In the next step we will need to specify a new AWS IAM user we about to create.<br> It will open up IAM dashboard with the user we already set up with the one we specified through CLI.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/880/0*10zatKnZtd07RFAi.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/880/0*wtbMfUf2gmCqcUvq.png" /></figure><p>Next we will need to set up AWS permissions. I will just click Next, Review and will create a user. You will be presented with a screen with Access key and secret which you should type in amplify cli</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/880/0*OtjJdKtxfFNiVJm-.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/701/0*VwmCSINCyd60zE4-.png" /></figure><h3>Creating your Frontend</h3><p>We will use Amplify auth module with React, but you can choose your own favorite framework. Check Amplify <a href="https://aws-amplify.github.io/docs/js/vue">Vue docs</a> and <a href="https://aws-amplify.github.io/docs/js/angular">Angular docs</a> for more detail.</p><p>we will start by creating our frontend with</p><pre>npx create-react-app react-frontend</pre><p>and then run</p><pre>amplify init</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/721/0*AVLxD9mE8M4lirYJ.png" /></figure><p>To add basic authentication with User pools run amplify add auth with default configuration. After adding auth we need to deploy it to AWS. This can be done by running amplify push which will update our resources in the cloud and will add Cognito User Pool</p><p>It’s time to add auth to our React app:</p><pre>yarn add aws-amplify aws-amplify-react</pre><p>In our App.js file let&#39;s wrap our app with Amplify withAuthenticator HOC</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/a77cd6372899a49ac34367a4435dbfbb/href">https://medium.com/media/a77cd6372899a49ac34367a4435dbfbb/href</a></iframe><p>What we will be presented is AWS auth screen where we will have sign up, sign in etc. We won’t cover how to customize everything for your app, so let’s just use the default one</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/880/0*ccV4eBv5G6abnGs4.png" /></figure><p>Now let’s add some behavior on sign up/sign in. <br> Whenever our App is authenticated, basically our App component will be rendered.<br> So if I will add this code to our App.js:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/ca1139fc34ecfe10feafd76dc581a61a/href">https://medium.com/media/ca1139fc34ecfe10feafd76dc581a61a/href</a></iframe><p>you will be able to get user data.</p><p>So far we have authentication, but there is a problem. We need to add this auth data to our Hasura.</p><h3>Adding a new User pool user into Hasura</h3><p>If we open our AWS console on User pool tab we will be able to see that we can create custom Triggers for different stages in authentication process. We will need to create at least two triggers. Pre sign-up and pre token generation.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/880/0*YXUFAy10Uwij8qJF.png" /></figure><p>Let’s start with sign up trigger</p><h4>Pre Sign Up Lambda</h4><p>Let’s go to AWS Lambda console and create a new lambda. You will have to create it locally first because we will have node-fetch dependency, so we will need to upload a zip to AWS console. Our lambda index.js file will look like this:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/77c3e4d0e3c90b704009a347b23e6129/href">https://medium.com/media/77c3e4d0e3c90b704009a347b23e6129/href</a></iframe><p>What we are trying to do here is to insert a new user to database by executing mutation. You can notice that we pass our Admin Secret at headers, but this is fine for server to server communication. What is happening here is that our id will be cognito username</p><p>Let’s try to Sign Up now.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/880/0*7vcIbAU6r5BNYFzD.png" /></figure><p>We will get notification mail with our verification code</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/880/0*-sC-bBg1y0GC7Ac-.png" /></figure><p>Now we can sign in and see our Auth token in the console.</p><p>The cool part is also that we will have our user created in Postgres. Let’s check our console:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/880/0*g1Ij44F7LEnaZWN8.png" /></figure><h4>Pre Token Generation lambda</h4><p>We are getting our token, but it’s not enough. If we want to use JWT_TOKEN with Hasura we need to do several things. (I explained JWT auth in details <a href="https://dev.to/hasurahq/hasura-authentication-explained-2c95">here</a>):</p><h3>Set HASURA_GRAPHQL_JWT_SECRET</h3><p>Set HASURA_GRAPHQL_JWT_SECRET as env variable in our Heroku. Our config will be:</p><pre>{<br>    &quot;type&quot;:&quot;RS256&quot;,<br>    &quot;jwk_url&quot;: &quot;<a href="https://cognito-idp.{region}.amazonaws.com/{userPoolId}/.well-">https://cognito-idp.{region}.amazonaws.com/{userPoolId}/.well-</a>known/jwks.json&quot;,<br>    &quot;claims_format&quot;: &quot;stringified_json&quot;<br>}</pre><blockquote><em>Note that {userPoolId} should be substituted to your userPoolId taken from AWS console as well as {region} to correct region you are using</em></blockquote><h4>Create our Pre Token generation lambda.</h4><p>For our pre token generation lambda we need to add custom claims. We will pass username as user id so we will be able to reference it in Hasura permission system</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/c033ad773574bcdc8aec75be7c1aeeec/href">https://medium.com/media/c033ad773574bcdc8aec75be7c1aeeec/href</a></iframe><p>Let’s copy signInUserSession.idToken.jwtToken from Auth.currentAuthenticatedUser() response and paste it in Hasura console as Authorization Bearer token</p><p>Now all custom claims will be passed to Hasura permissions system and we will be able to reference them there.</p><h4>Create Roles in Hasura Permission system</h4><p>Let’s see how it’s done. We will create two additional roles — anonymous without any permissions and a user role.</p><p>I want user to be able to query only their own user data as well as see only their posts. We can set up permissions in the console accordingly:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/880/0*2ZkBOA3Ml0j7QXFn.png" /></figure><p>user role will be able to see only their own data.</p><p>Let’s double check that by querying all users:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/880/0*YfnXQjZ6c31Q3qCh.png" /></figure><h3>Summary</h3><p>This blog post is only a brief overview of what you can do with Hasura and AWS Cognito, but I hope you get the idea of main auth workflow you should stick to. As you can see, because we use Lambda triggers and plug them into Cognito auth process we can do any level of complexity. We can validate if our user exists, add custom variables to hasura custom claims and so on.</p><p>After reading this blog post I will appreciate if you can give me feedback what parts you want me to cover more in depth so I can either write another more advanced blog post or lead you to resources explaining these parts. DM me on <a href="https://twitter.com/VladimirNovick">Twitter</a></p><p><em>Originally published at </em><a href="https://dev.to/hasurahq/using-amplify-cli-for-adding-auth-to-your-hasura-graphql-engine-23f9"><em>https://dev.to</em></a><em>.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9c0d3c308a2d" width="1" height="1" alt=""><hr><p><a href="https://medium.com/open-graphql/using-amplify-cli-for-adding-auth-to-your-hasura-graphql-engine-9c0d3c308a2d">Using Amplify CLI for adding Auth to your Hasura GraphQL engine</a> was originally published in <a href="https://medium.com/open-graphql">Open GraphQL</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>