<?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[BrikL Engineering - Medium]]></title>
        <description><![CDATA[Fashion Technology with Serverless, AWS &amp; GraphQL - Medium]]></description>
        <link>https://medium.com/brikl-engineering?source=rss----f2fb8ce912ba---4</link>
        <image>
            <url>https://cdn-images-1.medium.com/proxy/1*TGH72Nnw24QL3iV9IOm4VA.png</url>
            <title>BrikL Engineering - Medium</title>
            <link>https://medium.com/brikl-engineering?source=rss----f2fb8ce912ba---4</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 17 Nov 2026 17:07:26 GMT</lastBuildDate>
        <atom:link href="https://medium.com/feed/brikl-engineering" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Why you should attend GraphQL Asia 2019]]></title>
            <link>https://medium.com/brikl-engineering/why-you-should-attend-graphql-asia-2019-5aa02ae3bc04?source=rss----f2fb8ce912ba---4</link>
            <guid isPermaLink="false">https://medium.com/p/5aa02ae3bc04</guid>
            <category><![CDATA[graphql]]></category>
            <category><![CDATA[bengaluru]]></category>
            <category><![CDATA[india]]></category>
            <dc:creator><![CDATA[Tobias Meixner]]></dc:creator>
            <pubDate>Sat, 23 Mar 2019 12:43:31 GMT</pubDate>
            <atom:updated>2019-03-23T12:43:31.195Z</atom:updated>
            <content:encoded><![CDATA[<p>Asia’s first GraphQL Conference in Bengaluru, India</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*G-pVUIUste-Dmw3twqMUGg.png" /><figcaption>GraphQL Asia 2019 in Bengaluru, India hosted by Hasura &amp; BrikL</figcaption></figure><p>Since the public release of GraphQL in 2015 by Facebook, it has been on the rise starting to become the de-facto standard of running and exposing APIs in today’s applications.</p><p>You can feel the hype and everybody is talking about GrahpQL these days and as BFF (backend for frontend) affecting frontend and backend development heavily a lot of discussions has been going on. Also in recent surveys such as State of JS 2018 GraphQL states that for example, 83% of JavaScript users want to learn GraphQL (<a href="https://2018.stateofjs.com/data-layer/graphql/">Source</a>).</p><p>In the past years, we have seen GraphQL conferences and events around the world with <a href="https://www.graphqlconf.org/">GraphQL Conf in Berlin</a> and <a href="https://summit.graphql.com/">GraphQL Summit in SF</a> being the two biggest events around. In 2018, a number of GraphQL meetups started across various cities in Asia; Bangalore, Thailand, Tel Aviv, Bangkok &amp; Tokyo. With the Asian community picking up momentum, we felt that this is the right time to put together a conference to bring the ecosystem together.</p><p><a href="http://www.graphql-asia.org/?m0">GraphQL Asia</a>, to be held at <a href="https://www.chanceryhotels.com/the-chancery-pavilion/">The Chancery Pavilion</a> on April 12–13 2019, will be Asia’s first GraphQL conference. We will bring together some of the top innovators and experts from the entire GraphQL ecosystem, including technology platforms, open-source contributors, enterprises using GraphQL at scale and others, for two full days of learning, networking, and fun.</p><h3>Great place to meet the GraphQL community</h3><p>Being at GraphQL Asia will give you the opportunity to meet dozens of active members from the GraphQL community such as contributors to GraphQL services &amp; frameworks and related technologies.</p><p>A huge focus for us while curating this event has been to prioritise learning &amp; conversations. Our speakers represent some of the earliest adopters of GraphQL.</p><p>The main reason to attend events is to create and build relationships. Of course, you can watch the talks on YouTube afterwards, but <strong>meeting in person can change your life</strong>.</p><blockquote>Our speaker office hours are designed exactly for this!</blockquote><p>Keep a look out on Twitter &amp; on your email to find out about these.</p><p>The conference focusses solely on GraphQL being language agnostic you will be able to meet enthusiasts for different programming languages coming all together to discuss GraphQL, architecture, API design and how to apply backend for frontend approach in today’s applications.</p><p>We will have visitors and speakers from various industries being it startups and companies including Airbnb, Github, Tokopedia, Atlassian, Twitter, Microsoft, Paypal and many more.</p><h3>Bengaluru a.k.a Bangalore is a startup hub</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*U44dlHu8nlNIwxjCK6JRfA.jpeg" /><figcaption>Bengaluru Castle</figcaption></figure><p>The conference is to be held in Bengaluru, India a.k.a Bangalore. Asia has many cities capable of hosting conferences but only a few cities in Asia can be considered a technology hub and Bengaluru is definitely one of them.</p><p>In 2017 Bengaluru was named world’s dynamic city and hasn’t stopped since being the home of multiple unicorns and other high-valued and innovative companies making an impact with companies like Flipkart, Ola, Swiggy and many more (<a href="https://www.theguardian.com/business-to-business/2018/jul/03/bengaluru-whats-next-for-indias-tech-capital">Source</a>).</p><p>Besides Bengaluru is home for many talented developers and hosting city of successful Indian events such as <a href="https://jsfoo.in/">JSFoo</a>, <a href="https://reactfoo.in/">ReactFoo</a>, <a href="https://events.linuxfoundation.org/events/kubernetes-day-india-2019/">Kubernetes Day India</a> and <a href="https://reactjsbangalore.com/">React Bangalore</a>.</p><h3>Amazing speaker line-up</h3><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.slideshare.net%2Fslideshow%2Fembed_code%2Fkey%2FfwgK8HLCcanfec&amp;url=https%3A%2F%2Fwww.slideshare.net%2FTobiasMeixner%2Fgraphql-asia-speakers&amp;image=https%3A%2F%2Fcdn.slidesharecdn.com%2Fss_thumbnails%2Fslideshare-graphql-asia-speakers-190323050648-thumbnail-4.jpg%3Fcb%3D1553317640&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=slideshare" width="600" height="500" frameborder="0" scrolling="no"><a href="https://medium.com/media/5556792c0453b7999763fe97e68a9d37/href">https://medium.com/media/5556792c0453b7999763fe97e68a9d37/href</a></iframe><p>Another reason to attend is listening and watching the talks learning directly from experts and seeing them live on stage.</p><p>At GraphQL Asia we have curated speakers from around the world with many speakers from Asia and across India as well.</p><p>The line-up includes Lee Byron, the co-creator of GraphQL, holding the keynote speech alongside many other exciting speakers such as Amit Rana (Myntra), Adam Miskiewicz (Airbnb), Sasha Solomon (Twitter), Manoj Awasthi (Tokopedia) and many more.</p><p>The talks will be a mix of GraphQL best-practises, frameworks, use-cases in production and GraphQL at massive scale.</p><h3>Get started and learn</h3><p>Not only will the talks help you to learn more or give you new insights on how to use GraphQL, but there will also be workshops available alongside the conference for beginners to advanced users.</p><p>We will have 4 workshops available that will help you get started and refresh your GraphQL knowledge:</p><ul><li>Introduction to GraphQL by Kiran Kumar Abburi</li><li>React + GraphQL by Lucas Munhoz</li><li>GraphQL Subscriptions &amp; real-time application by Hasura</li><li>Angular &amp; GraphQL with AppSync</li></ul><h3>Be there!</h3><p>We have less than 3 weeks left until the conference and we have seen companies buying tickets in bulk for their entire teams!</p><blockquote>Grab your tickets today at <a href="http://www.graphql-asia.org/?m1">www.graphql-asia.org</a>.</blockquote><p>Each ticket gives you access to 2 full days of conference talks, all the workshops, our specially designed conferences bags and is, of course, inclusive of lunch on both days!</p><p>We also have group discounts available, directly on the <a href="http://www.graphql-asia.org/?m2">website</a>:</p><ul><li>15% for 5 or more tickets</li><li>20% for groups of 10 or more</li><li>30% for groups of 25 or more</li></ul><p>Don’t miss out :) We look forward to seeing you at the conference!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5aa02ae3bc04" width="1" height="1" alt=""><hr><p><a href="https://medium.com/brikl-engineering/why-you-should-attend-graphql-asia-2019-5aa02ae3bc04">Why you should attend GraphQL Asia 2019</a> was originally published in <a href="https://medium.com/brikl-engineering">BrikL Engineering</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[GraphQL Schema Directives as ORM]]></title>
            <link>https://medium.com/brikl-engineering/graphql-schema-directives-as-orm-ec635fdc942d?source=rss----f2fb8ce912ba---4</link>
            <guid isPermaLink="false">https://medium.com/p/ec635fdc942d</guid>
            <category><![CDATA[graphql-resolver]]></category>
            <category><![CDATA[orm]]></category>
            <category><![CDATA[graphql]]></category>
            <dc:creator><![CDATA[Tobias Meixner]]></dc:creator>
            <pubDate>Fri, 12 Oct 2018 13:27:52 GMT</pubDate>
            <atom:updated>2018-10-25T11:45:24.369Z</atom:updated>
            <content:encoded><![CDATA[<p>A new era of ORMs</p><p>GraphQL is booming. Anyone starting an app today will require talking to an API and will likely come across GraphQL. Working with GraphQL daily it seems to me GraphQL is everywhere like the 5 times in this intro.</p><p>Not only has the ecosystem around GraphQL rapidly evolved over the past months but it has also moving towards best practices and common patterns how to use GraphQL in the client and server as well as combining legacy systems and REST APIs.</p><p>Now giving you are getting started with GraphQL many boilerplates, documentations and tutorial hardly go past using “hard-coded” resolvers with maybe two types defined. While this get’s you started you will bump into problems very soon by either thinking GraphQL is overkill repeating resolver logic over and over again or you may be trying to look beyond “plain” resolvers. Lucky enough — many roads lead to Rome — or in GraphQL case to resolve a request.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*SeSW4pLoWMd4GrWN" /><figcaption>“waterfall surrounded by rock formatio n” by <a href="https://unsplash.com/@debrupas?utm_source=medium&amp;utm_medium=referral">Pascal Debrunner</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>If you are at this stage — this article might be for you or you just want to know more about the power of GraphQL Schema Directives read on. ….just want Schema Directive examples — scroll fast :)</p><h3>GraphQL Resolver Patterns</h3><p>GraphQL has the concept of using resolvers to return exact data to your request according to your query or mutation return. No matter what server-side language or server you run there are certain patterns how you might or should resolve requests in GraphQL. Then again there is no right or wrong but each pattern can give you certain benefits over the other.</p><p>I see Resolver Patterns the same as Architecture Patterns or Fashion Trends you either follow them or not — up to you — but sometimes you better do or have to and most of the time it will be based on personal choice/flavor or some kind of corporate force or madness.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/640/1*c2sQj2olLN5gOVYYefalwg.jpeg" /></figure><p>Below is a by no means a complete list of common resolver patterns or approaches to structure your resolvers:</p><ul><li>Root resolvers</li><li>Type &amp; Field resolvers</li><li>Context injection</li><li>Apollo Resolvers</li><li>GraphQL Middleware</li><li><strong>Schema directives</strong></li><li>Database / Backend as a service / “Generated Resolvers”</li></ul><p>For more on Resolver patterns you may check out <a href="https://www.linkedin.com/in/lucasnmunhoz/">Lucas</a> and my <a href="https://www.slideshare.net/TobiasMeixner/graphql-bangkok-meetup-20/18?src=clipshare">presentation</a> from recent GraphQL Bangkok Meetup.</p><h3>Schema FIRST</h3><p>Now there is many options but based on the past 2 years working with GraphQL with heavily changing requirements and let’s call it client-side-requirement-driven-development your GraphQL server need to be flexible and abstract at the same time.</p><p>Using Schema Directives enables you to go all-in on using a <a href="https://www.apollographql.com/docs/graphql-tools/#recommendations">Schema-first approach</a> and build your resolvers around it. How that might work we will see below.</p><p>If you look around today at managed GraphQL services like Prisma or AppSync you will notice the initial input and single source of truth is the Schema defined in SDL or some abstracted JS to generated your resolvers. Now this is for a reason — SDL being more or less JSON — the GraphQL Schema can be used as universal layer to all data sources, easily readable and understandable across technical levels or business stakeholders. Read more <a href="https://www.zdnet.com/article/graphql-for-databases-a-layer-for-universal-database-access/">here</a> on this topic.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/615/1*_UXsT76v0mK0P4OhpQXLUA.jpeg" /></figure><h3>Towards Schema Directives</h3><p>Not only with seeing GraphQL Schema as single source of truth but also unleashing its power of using Schema Directives it will become clear why we might be up to a new Era of ORMs.</p><p>A GraphQL Schema enables you to define Types your objects being used in your application. Then we have Arguments to access Types and its Fields based and certain Variables. Also we have Query, Mutation and Subscription to access or manipulate our data — which means all operations and accessible fields are normally defined in the schema. So why not go beyond defining operations but also defining relationships, caching behavior, data sources, access rights and hooks?</p><p>Sounds familiar? Yes, this is what most ORMs or somewhat for example npm packages like sequelize have been offering in the past.</p><p><a href="https://facebook.github.io/graphql/draft/#sec-Type-System.Directives">Schema Directives</a> can be defined on OBJECT, FIELD and FIELD DEFINITION levels so pretty much everywhere using custom directives with common or custom data types — String, Boolean and you name it.</p><p>It does not stop at defining directives solely. All defined directives may be used before AND after the default resolver which makes it more powerful than middleware or root resolvers for example. To read more on this topic I highly recommend reading <a href="https://blog.apollographql.com/reusable-graphql-schema-directives-131fb3a177d1">Ben’s article on Schema Directives</a> which finally sold me.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*DaBUm_OH10dwceGK" /><figcaption>“teal and brown cathedral” by <a href="https://unsplash.com/@manoj25?utm_source=medium&amp;utm_medium=referral">Manoj kumar kasirajan</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><h3>A New Era of ORMs</h3><p>With all the excitement on Schema Directives and it’s superpowers and Ben’s vision on an ecosystem of directives, we can also call it a new era of ORMs.</p><p>Implementing GraphQL server-side may leads to the question on where to define what have been defined previously in your ORM defining fields, types, tables, table names and relations. In case of GraphQL these times shall be over — with a Schema-first approach you should not be defining relationships or data types twice in your GraphQL Schema and then in your ORM again.</p><p>Such approach is not only calling off double work here but also enables your to define your ORM on a database level but in the data layer — where it actually belongs. In many cases you will rely on multiple databases, database technologies or maybe different data providers or external data sources which all shall be part of your ORM.</p><p>In a nutshell with a GraphQL Schema by default it enables you to have proper Object and Relationship definitions already but adding Schema Directives it empowers to pretty much everything a ORM has been in the past with powers beyond as universal data-layer.</p><h3>Schema Directives Example</h3><p>Enough talking let’s look at some examples what it all means using Schema Directives as an ORM.</p><p>Let’s go by the examples of the Apollo documentation:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/88eb77698bf7bca283a60206f1886de1/href">https://medium.com/media/88eb77698bf7bca283a60206f1886de1/href</a></iframe><p>Now let’s add some Schema Directives:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/eefa5f9b9029834b108904810a673bbe/href">https://medium.com/media/eefa5f9b9029834b108904810a673bbe/href</a></iframe><p>Let’s digest above on what we did here.</p><h4>Authorization sample:</h4><blockquote>myEvents: [Event] @auth(role:”event.owner”)</blockquote><p>We defined a “auth” directives with role-based permissions to limited the access to the event owner only which enables you to define role based permission in schema level on query, type or field level. The authorization itself can be implemented using custom directives or use common packages such as graphql-shield. Your custom directive could read roles from a token and then decide to resolve each field to the client based on its permission.</p><h4>Data source samples:</h4><blockquote>type Event @dynamoDB(table:”Event”) <br>searchEvents: [Event] @myElasticCluster(index:”allEvents”) <br>upcomingEvents: [Event] @dynamoDB(index:”upcoming”)<br>weather: WeatherInfo @rest(url:”weather.com”,lat:$lat,lon:$lon)</blockquote><p>Here we go using our own custom directives defining our data source in the schema itself along with the data source equivalent key or index for example. In case of DynamoDB you might have different secondary indexes defined for each query you run on your table which then can be your custom DynamoDB directive to query data from the index specified in your schema.</p><p>We also may define result sources on field level such as getting the WeatherInfo from a rest endpoint e.g. weather.com with query strings based on our root data (lat, lon).</p><h4>Caching example:</h4><blockquote>pastEvents: [Event] @cacheControl(maxAge: 60000) @myLongTermStorage(index:”past”)</blockquote><p>Here we have a sample on defining cache control inside the schema for past events we likely want to cache and maybe event store in another storage. cacheControl directive is handled by default by Apollo Server exposing it to Apollo Engine or your implementation of a Cache Key Value store of your choice.</p><p>To build your own Schema Directives you can use the widely popular package of <a href="https://github.com/apollographql/graphql-tools">graphql-tools</a> exposing <a href="https://www.apollographql.com/docs/graphql-tools/schema-directives.html#Implementing-schema-directives">several helpers to implement proper directives</a> which you can then pass into your executable schema. Go ahead and build your own!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*5xpiQAz72IEPNfvY" /><figcaption>“stop road sign on sidewalk near forest” by <a href="https://unsplash.com/@therealsam?utm_source=medium&amp;utm_medium=referral">Sam Xu</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><h3>Limitations and alternatives</h3><p>Schema directives are powerful but there are limitation you may run into or when solely relying on Schema Directives.</p><h4>Security</h4><p>Your GraphQL Schema can be exposed using Introspection, so normally in a production you would not want to expose your Schema for introspection. Directives defined in your schema can also be uncovered — so do block introspection and be aware of anyone with access to the schema will have access to directives which would expose way more than just data structure.</p><p>Also implementing your own directives may lead to fatal results if for example you handle authorization through schema directives but forget to protect certain fields or even worse edges between nodes which lead to expose multiple types of your graph due to GraphQL’s nested structure.</p><h4>Performance</h4><p>Implementing directives on a field level can lead to poor performance if you will run heavy calculations or useless business logic for each field pre data resolution. For example you will want to avoid initilizing your database connection for every field again but rather just query data according to your field or type. Also using methods like visitSchema can slow down performance being run on every query or even every field depending on your setup and size of schema — so you may weight where high-level abstraction shall be put in place with least impact on performance.</p><h4>Provisioning and migrations</h4><p>Depending on your data storage database or table provisioning could be more complicated than using DynamoDB for example. Using Schema Directives as ORM shines using NoSQL and Elasticsearch for example but it might get harder using MySQL for example taking care of migrations on schema changes.</p><h4>Centralise business logic</h4><p>As mentioned above do weight in the impact in abstracting your ORM into the schema. You likely be able to abstract authorization and at least defining high-level data sources such as type of data source in the schema to then forward/resolve the request into its proper path. Luckily enough with schema directives you would also be able to for example just inject these into the context or resolver itself.</p><p>For simple CRUD operation without business logic or repeating business logic you could write the resolver itself into the schema directives i.e. your directives will resolve data based on directive attributes. For example the dynamoDB directive: Let’s assume you have one DynamoDB table with multiple indexes. The schema directives will pass the index name into your high-level schema resolver to return the data. If you have specific business logic you may just take the directive attributes as input and pass them into the context to process in the default resolver.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/467/1*kh69YzXObAL3-iio2gDU1w.png" /></figure><h4>Alternatives</h4><p>Writing your own schema directives can be a breeze but you may just want to get the benefits of schema directives and use built-in best practices with managed services then there quite a few options to pick from.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/568/1*0S3JcMZO4LwL-6R4tGYN8w.png" /></figure><p>You may go with a services like <a href="https://www.prisma.io/">Prisma</a> which heavily simplifies resolver implementation. Prisma is one of the leading services to provide guided process from defining a type schema to generating actual resolvers for you alongside integrating a lot best practises building GraphQL servers providing another useful data layer in front of your database.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*uTNimtyT-MJ1nbrNuVyUHQ.jpeg" /></figure><p>Or you can go with AWS’ <a href="https://aws.amazon.com/appsync/">AppSync</a> which also helps your to go from schema to resolvers in record time while providing all of the common benefits going with one AWS offerings. AppSync has standardized resolving data for simple relations to DynamoDB and ElasticSearch built-in.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/225/1*Gdn1XLc516YYrabmaf-8qw.jpeg" /></figure><p>For even further abstraction you could go with a service like <a href="https://hasura.io/">Hasura</a> offering to convert your Postgres into a GraphQL endpoint without the need of an actual GraphQL Schema (not exposed). Hasura takes the approach of moving the business logic behind common CRUD operations to <a href="https://hasura.io/event-triggers">event-based triggers</a> from the database.</p><h3>Enter the new era of ORMs with GraphQL</h3><p>Just getting started with GraphQL? Do not be overwhelmed by all the different ways of writing resolvers. Do get your hands dirty first and write a couple of resolvers yourself to understand the inner workings of GraphQL.</p><p>Do forget about the way you have used ORMs in the past and cherish the benefits of combining relations and logic in on place where its needed.</p><p>The real power of using schema directives may only be achieved with getting <a href="https://blog.apollographql.com/reusable-graphql-schema-directives-131fb3a177d1#---0-26">towards an ecosystem of directives</a> to supply demands for various database technologies and sources. As much as schema stitching is an interesting approach it would be much more beneficial to standardize data sharing using common schema directives.</p><p>Common schema directives then maybe lead to globally unique data using schema id + type name + identifier to merge data schema across services and organisations. For example Github:User:username or LinkedIn:User:username — let’s call it ? 😃</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*4D48cepUYNjHI9Ir" /><figcaption>“green and red light wallpaper” by <a href="https://unsplash.com/@pietrozj?utm_source=medium&amp;utm_medium=referral">Pietro Jeng</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ec635fdc942d" width="1" height="1" alt=""><hr><p><a href="https://medium.com/brikl-engineering/graphql-schema-directives-as-orm-ec635fdc942d">GraphQL Schema Directives as ORM</a> was originally published in <a href="https://medium.com/brikl-engineering">BrikL Engineering</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[GraphQL Meetup Bangkok 1.0]]></title>
            <link>https://medium.com/brikl-engineering/graphql-meetup-bangkok-1-0-11d2168b6641?source=rss----f2fb8ce912ba---4</link>
            <guid isPermaLink="false">https://medium.com/p/11d2168b6641</guid>
            <category><![CDATA[graphql]]></category>
            <category><![CDATA[apollo]]></category>
            <category><![CDATA[brikl]]></category>
            <category><![CDATA[meetup]]></category>
            <category><![CDATA[bangkok]]></category>
            <dc:creator><![CDATA[Tobias Meixner]]></dc:creator>
            <pubDate>Tue, 31 Jul 2018 14:26:46 GMT</pubDate>
            <atom:updated>2018-07-31T14:26:52.969Z</atom:updated>
            <content:encoded><![CDATA[<p>Towards a vision of GraphQL Asia</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*brBJ9VH1axldIJfM51g5vA.jpeg" /></figure><p>With the GraphQL Europe conference last month and GraphQL Summit coming soon in November there is still a need to keep everyone updated with recent developments around GraphQL.</p><p>Not only that, but there is in fact a desperate need of education and help among beginners in GraphQL space, also in Asia.</p><p>As a result Apollo and <a href="https://www.brikl.io/?utm_source=medium&amp;utm_medium=blog&amp;utm_campaign=apollo-meetup-1">BrikL</a> joined forces and partner on running the first <a href="https://www.meetup.com/GraphQL-Bangkok/">GraphQL meetup in Bangkok</a> with a vision towards a <em>GraphQL Asia</em> conference early next year.</p><p>The first meetup held last week in Bangkok, Thailand at Ma:D Club hopefully leads to a series of more events in Southeast Asia and around giving Apollo and GraphQL ecosystem the opportunity to help the community in Asia.</p><h3>GraphQL Bangkok 1.0 Meetup</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*42oYJJ_XyZ46UzD0T9_wfg.png" /></figure><p>Running a first meetup is exciting and intimidating at the same time but with backing by <a href="https://www.apollographql.com/">Apollo</a> and <a href="https://www.prisma.io/">Prisma</a> we were able to deliver. We wanted to help teams learn more about how to get started with GraphQL and what the ecosystem has to offer. So the goal was to give all of the 27 attendees who came, the tools to get started with GraphQL but also go further with it.</p><h3>Apollo</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*n1E0aelTPE4Hz4Z85LNzDQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*nuW4EG7HBt82Dpc5erc5qQ.jpeg" /><figcaption>Joseph Glanville on Apollo Server and Apollo Engine</figcaption></figure><p>We had the pleasure of having Apollo’s Cloud Systems Engineer <a href="https://twitter.com/jpgvm">Joseph Glanville</a> (part of the Apollo Engine backend team) around giving his insightful talk on all of the new incredible features of Apollo Server v2 alongside of a deep dive and live-demo on <a href="https://www.apollographql.com/engine">Apollo Engine</a>.</p><p>Next to a talk on Apollo by Joseph there has been an introduction on GraphQL for beginners and lightning talks on AWS AppSync and Prisma being very much part of the GraphQL ecosystem.</p><h3>BrikL — Apollo user in production</h3><p>We also took the opportunity to share more on BrikL and how BrikL is using GraphQL in production. The community is in need of getting more examples and success stories on GraphQL and Apollo going further than boilerplates and Todo apps.</p><p><a href="https://www.brikl.io/?utm_source=medium&amp;utm_medium=blog&amp;utm_campaign=apollo-meetup-1">BrikL</a> has been using GraphQL from the start for more than 2 years in a serverless stack with API Gateway, AWS Lambda and DynamoDB. Since last year we have been reluctant to use Apollo Client and Apollo Server in production which use-case we were more than happy to share at the meetup. Apollo’s tools and the <a href="https://serverless.com/">serverless framework</a> have been key to our agility and success the last months.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*mKJk0xfnl74fUGhUUMoz6w.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*osZ5hpKFRPr0iIq8pyVqcg.jpeg" /><figcaption>Tobias Meixner on GraphQL and Apollo use case @ BrikL</figcaption></figure><h3>What’s next</h3><p>The meetup in Bangkok was a proven success to help the community which will be continued bi-monthly sharing more success stories and teaching beginners on the GraphQL ecosystem and Apollo.</p><p>Towards our vision on GraphQL Asia early next year we are looking to help others get meetups up to speed around South East Asia.</p><p>We also seek support for our vision to find speakers for meetups in Asia and help organizing the summit for next year. <a href="https://www.brikl.io/contact-us">Contact us</a> if you are interested to support.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=11d2168b6641" width="1" height="1" alt=""><hr><p><a href="https://medium.com/brikl-engineering/graphql-meetup-bangkok-1-0-11d2168b6641">GraphQL Meetup Bangkok 1.0</a> was originally published in <a href="https://medium.com/brikl-engineering">BrikL Engineering</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Automatic Persisted Queries on AWS using Cloudfront, Serverless and DynamoDB]]></title>
            <link>https://medium.com/brikl-engineering/automatic-persisted-queries-on-aws-using-cloudfront-serverless-and-dynamodb-1328ca26d1c2?source=rss----f2fb8ce912ba---4</link>
            <guid isPermaLink="false">https://medium.com/p/1328ca26d1c2</guid>
            <category><![CDATA[apollo]]></category>
            <category><![CDATA[graphql]]></category>
            <category><![CDATA[dynamodb]]></category>
            <category><![CDATA[aws-lambda]]></category>
            <dc:creator><![CDATA[Tobias Meixner]]></dc:creator>
            <pubDate>Sat, 30 Jun 2018 11:39:34 GMT</pubDate>
            <atom:updated>2018-06-30T11:04:58.281Z</atom:updated>
            <content:encoded><![CDATA[<h4>Introducing DynamoDB with Apollo Server 2.0</h4><p>We recently wrote about how excited we are at <a href="https://www.brikl.io/?utm_source=medium&amp;utm_medium=blog&amp;utm_campaign=cdn-apollo-server">BrikL</a> about the launch of Apollo Server 2 and its capabilities such as <a href="https://medium.com/brikl-engineering/serverless-graphql-cached-in-redis-with-apollo-server-2-0-f491695cac7f">caching external data sources in Redis</a>.</p><p>We also mentioned an improved version to the proposed solution was adding a CDN in front of your Apollo Server 2.</p><blockquote>A common practice is using Persistent Queries from Apollo Client as GET requests. When using GET requests we should also add a Cloudfront API Cache in front of our API Gateway since Apollo Server 2.0 includes sending Cache-Control headers along to even further reduce your Lambda and remote endpoint calls.</blockquote><p>Not only that, combining Redis with Lambda can work well for you but what if you like DynamoDB as much as we like? How about caching persisted queries in DynamoDB ?</p><p>We have been happily using a lot of Open Source such as GraphQL and Apollo helping us to grow fast, so it is time to start giving back — <strong>releasing our first attempt DynamoDBCache for Apollo Server 2.0 but more below.</strong></p><h4>Apollo Server 2.0</h4><p>With the new release of Apollo Server cache control comes built-in scanning the cache control headers set in your resolvers or defined in your GraphQL schema.</p><p>Sounds great — but how about larger queries being send as GET requests…luckily there is a solution as well —<a href="https://www.apollographql.com/docs/apollo-server/v2/features/apq.html"> Automatic Persisted Queries</a>. You can read more background here:</p><p><a href="https://dev-blog.apollodata.com/automatic-persisted-queries-and-cdn-caching-with-apollo-server-2-0-bf42b3a313de">Automatic Persisted Queries and CDN caching with Apollo Server 2.0</a></p><p>So how do we go about this assuming you are using GraphQL with AWS API Gateway and Lamda: ‘Serverless’ GraphQL</p><h3>Serverless GraphQL in AWS</h3><p>Before we dive into what we came up with to get Apollo Server running with Lambda, let have a look at the architecture for running ‘Serverless’ GraphQL and Apollo Server 2.0 on AWS.</p><p><em>Note that you may be better off using AWS AppSync for prototypes for example but if you like more control and less dependency below will serve you well.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8X5zzr0QMMMR5p7suT4aVA.png" /><figcaption>Serverless GraphQL on AWS with Apollo Server 2 &amp; DynamoDB</figcaption></figure><h3>Cache GraphQL queries in Cloudfront</h3><p>First of all you will want to cache your public data in Cloudfront for reuse at edge locations to reduce your latency, network requests and of course database calls.</p><p>A common practice and recommended approach by Apollo as well is using a CDN in front of your GraphQL API.</p><p>Assuming you are using API Gateway there is actually a few ways to go about it such as API Gateway cache or combine it with an external CDN such as Fastly or Cloudflare. We found API Gateway cache not flexible enough and possibly also to expensive in this case.</p><p>If you are already on AWS then let’s use Cloudfront. You may be using Terraform or Cloudformation for your resources — sorry below is just a few screens on the setup in the AWS Console.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/922/1*BxxtiTh6_JKUWOGq2Y2cSA.png" /><figcaption>GraphQL CDN in Cloudfront — General Settings</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*iVcNMv5QTjP52UkqJ_CmYg.png" /><figcaption>GraphQL CDN in Cloudfront — Origins</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/535/1*kuFFalAGYe5t22M5Q9y-Pw.png" /><figcaption>GraphQL CDN in Cloudfront — Behaviour</figcaption></figure><p>A few notes here:</p><ul><li>When using API Gateway with Lambda you have 2 options for your endpoints regional vs edge. If you are using a multi-region setup you better use the regional endpoint option (API Gateway without Cloudfront). If you are using edge options your API Gateway has already a Cloudfront setup which means you won’t be able to have latency-based routing for your API for example.</li><li>You can link any external domain (CNAME) to a Cloudfront distribution.</li><li>Use HTTPS :)</li><li>Forward the query string</li><li>Use Origin Cache Headers (for caching supplied by Apollo Server 2.0)</li></ul><h3>Introducing Persisted Queries with DynamoDB</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/849/1*qFEZc0Y1Rb5qDyneHX5Ydw.png" /><figcaption>Persisted Queries with DynamoDB</figcaption></figure><p>Apollo Server latest release candidate came with packages for cached persisted queries and data source cache in LRU, Redis and Memcached. When using Lambda with Node there are two ways now either setting callback waiting to false which can cause unpredictable behavior or use a HTTP based data storage. This one reason why DynamoDB is so popular with Lambda.</p><p>LRU is an option for Lambda but being stateless and running for a few minutes only LRU will not be a great bet.</p><p>So here we go let’s build a new package DynamoDBCache to cache persistent queries in DynamoDB having in mind that DynamoDB can serve low digit latencies for key value queries like such cases.</p><p>Apollo has built a great interface to create additional stores like we planned to build offering an Interface to a generic KeyValueCache which DynamoDB is going to be.</p><p>We believe DynamoDB is a great option because of its low latency, multi-region capability (Global tables) and flexibility with streams etc.</p><p>We only have to implement a get and set method to read and write our persisted queries to DynamoDB.</p><p>Here it is:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/122cbbc569117f4039d7997d9bc24cad/href">https://medium.com/media/122cbbc569117f4039d7997d9bc24cad/href</a></iframe><p>We have forked the Apollo Server and just created <a href="https://github.com/apollographql/apollo-server/pull/1278">our first PR</a> hopefully being part of Apollo Server 2.0 release soon.</p><p>We are looking forward to help others having a similar architecture using GraphQL with AWS Lambda.</p><p>You can see a sample repository here:<br><a href="https://github.com/Brikl/serverless-apollo-dynamodbcache">https://github.com/Brikl/serverless-apollo-dynamodbcache</a></p><h3>Next?</h3><p>We are confident using DynamoDB as persistent query cache is a great start but there is certainly more we can do. With the first release we will be limited to setting only a table name and region for our cache but going forward we may add further options:</p><ul><li><strong>Add DAX support</strong><br>DynamoDB has it’s own sub-microsecond cache that we could use if you are using Lambda in a VPC.</li><li><strong>Tracing support<br></strong>Adding AWS X-ray for performance traces of the package</li><li><strong>Add LRU as first priority<br></strong>Even faster is likely to use in-memory LRU with DynamoDB as fallback</li><li><strong>Full query cache support<br></strong>In some cases DynamoDB might also work well as cache for full queries having its limits of 400KB per item in mind</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/747/1*l4Fb6OzeZXBRY4wa7mAe9A.png" /><figcaption>Persisted Queries with DAX</figcaption></figure><p>Below architecture for future caching approach with AWS Lambda, LRU, DAX and DynamoDB.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/761/1*D0TtlYWxdCUnJJvyqCAHsw.png" /><figcaption>Serverless GraphQL with cache in LRU, DAX and DynamoDB</figcaption></figure><p>Thank you.</p><h3>About BrikL</h3><p>At <a href="https://www.brikl.io/?utm_source=medium&amp;utm_medium=blog&amp;utm_campaign=cdn-apollo-server">BrikL</a> we are excited about new technologies in the GraphQL ecosystem such as Apollo Server 2.0 where AWS, Apollo and GraphQL are an essential part of our stack.</p><p>If you are in Thailand or around, join the <a href="https://www.meetup.com/Bangkok-GraphQL-Meetup/">GraphQL meetup in Bangkok</a>.</p><p>BrikL is a fashion tech startup providing a one-stop solution to fashion companies. Our Fashion Design App is cloud-native built on top of serverless technologies with React, Apollo, GraphQL, NodeJS, DynamoDB and more.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1328ca26d1c2" width="1" height="1" alt=""><hr><p><a href="https://medium.com/brikl-engineering/automatic-persisted-queries-on-aws-using-cloudfront-serverless-and-dynamodb-1328ca26d1c2">Automatic Persisted Queries on AWS using Cloudfront, Serverless and DynamoDB</a> was originally published in <a href="https://medium.com/brikl-engineering">BrikL Engineering</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Serverless GraphQL cached in Redis with Apollo Server 2.0]]></title>
            <link>https://medium.com/brikl-engineering/serverless-graphql-cached-in-redis-with-apollo-server-2-0-f491695cac7f?source=rss----f2fb8ce912ba---4</link>
            <guid isPermaLink="false">https://medium.com/p/f491695cac7f</guid>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[redis]]></category>
            <category><![CDATA[apollo-server]]></category>
            <category><![CDATA[serverless]]></category>
            <category><![CDATA[graphql]]></category>
            <dc:creator><![CDATA[Tobias Meixner]]></dc:creator>
            <pubDate>Sat, 23 Jun 2018 06:57:29 GMT</pubDate>
            <atom:updated>2018-06-30T11:27:30.111Z</atom:updated>
            <content:encoded><![CDATA[<h4>Cache data sources with Apollo Server 2.0 in AWS Lambda</h4><p>If you have followed the GraphQL Summit in Europe a few days ago you might be excited as we were at <a href="https://www.brikl.io/?utm_source=medium&amp;utm_medium=blog&amp;utm_campaign=redis-apollo-server">BrikL</a> about announcement of Apollo Server 2.0.</p><p>We have been using AWS Lambda with GraphQL since 2016 and have switched to Apollo last year using Apollo Client and Server in a ‘serverless’ setting. Now with the new 2.0 release coming up we are excited to give the current release candidate a shot.</p><p>First of all a big thank you to the Apollo team and all contributors especially <a href="https://github.com/adnsio">Alessio</a> to add the Lambda support and <a href="https://medium.com/u/d00f1e6b06a2">Yan Cui</a> for continuous serverless lessons.</p><p><em>Lazy reading…? You can find the repository </em><a href="https://github.com/Brikl/serverless-apollo-datasource-redis"><em>here</em></a></p><p><a href="https://www.apollographql.com/docs/apollo-server/v2/">Apollo Server 2.0</a> combines a lot features with with Data Sources being one of them. The new release candidate rc2 includes:</p><ul><li>Error handling</li><li>Schema mocking</li><li>Healthchecks</li><li>Edge support</li><li><a href="https://github.com/prismagraphql/graphql-playground">GraphQL Playground</a></li><li>and more..</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/486/1*ubMfjRrnzRWoqg1XcGFfDw.png" /><figcaption>Apollo Server 2.0 —<a href="https://www.apollographql.com/">apollographql.com</a></figcaption></figure><h3>Data sources?</h3><p>Chances are high that your GraphQL server is receiving data not only from one data storage or one endpoint only — in many cases your schema is made of either legacy APIs in REST, external APIs or other sources which you may like to cache.</p><p>This is where data sources come in handy in Apollo Server 2.</p><blockquote><a href="https://medium.com/u/592c66ff70d">Martijn Walraven</a>:<br>Data sources are classes that encapsulate fetching data from a particular service, with built-in support for caching, deduplication, and error handling. You write the code that is specific to interacting with your backend, and Apollo Server takes care of the rest.<br><a href="https://dev-blog.apollodata.com/easy-and-performant-graphql-over-rest-e02796993b2b">Apollo Blog</a></blockquote><p>That means with Apollo Server you can add additional data sources to your schema using the same caching mechanism.</p><p>When I read the post yesterday I thought — sounds great — let’s setup a sample.</p><h3>Serverless Apollo Server with Redis</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/836/1*U0znkNvXpf-A9f2a6JnQcw.png" /><figcaption>Serverless Apollo Server 2.0 with Redis</figcaption></figure><p>Above we can see an overview what we are going to put together here.</p><blockquote><strong>AWS API Gateway: </strong>GraphQL endpoint receiving POST/GET<br><strong>AWS Lamda:</strong> Apollo Server 2.0 in NodeJS using apollo-server-lambda<br><strong>Amazon CloudWatch:</strong> Logging<br><strong>AWS X-Ray: </strong>Log performance traces<br><strong>Dashbird:</strong> If you dislike CloudWatch like me &gt; <a href="https://dashbird.io/">use Dashbird!</a><br><strong>Redis:</strong> Cache with e.g. AWS ElastiCache or redislabs.com<br><strong>NY Times API:</strong> Sample REST endpoint for article search we want to cache</blockquote><h4>The flow will be:</h4><p>Our client will be sending a GraphQL request off to the API Gateway which then proxies the request to our AWS Lambda.</p><p>Apollo Server will then translate the query to the data source in the schema.</p><p>Apollo Server will check if the type is ‘cacheable’ (cacheControl), if so it will look in our Redis endpoint for a cached response.</p><p>If there is no cached response it will send of a request to our REST API (NY Times) in this case. Again it will check if the response is ‘cacheable’ and store the result in Redis.</p><h3>Enough talking — let’s code</h3><p>You can find the sample repository here:<br><a href="https://github.com/Brikl/serverless-apollo-datasource-redis">https://github.com/Brikl/serverless-apollo-datasource-redis</a></p><p>To get started as quickly as possible we will be using <a href="https://serverless.com/">serverless framework</a> (you can use AWS SAM local too).</p><p>For that we create a <strong>serverless.yml</strong> to define API and Lambda configuration.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/9a18fc27b039f6fc200f1257f3890e06/href">https://medium.com/media/9a18fc27b039f6fc200f1257f3890e06/href</a></iframe><p>Next up we will need a handler in NodeJS to run in Lambda:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/b872b4da1cb85d62df2ed06717dc4e06/href">https://medium.com/media/b872b4da1cb85d62df2ed06717dc4e06/href</a></iframe><p>Use external data sources that are not http based such as DynamoDB will require you to set the callback waiting to false otherwise your Lambda will timeout.</p><blockquote>context.callbackWaitsForEmptyEventLoop = false;</blockquote><p>Besides you will need your package.json and simple webpack configuration to round things up.</p><p>Then you are all set to deploy to AWS using serverless deployment command:</p><blockquote>serverless deploy — region us-east-1 — stage staging — profile yourprofilename</blockquote><h3>How to run</h3><p>Once deployed serverless will return you a API URL — since Apollo Server has the GraphQL playground build-in we can just open the respective URL:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/650/1*nygkmpJBgjDo74IYO1gJng.png" /><figcaption>Your API</figcaption></figure><p>Now we can run our sample query in the playground</p><blockquote><em>query searchNYTimes{<br> searchNYTimes(<br> q: “new york”<br> ){<br> web_url<br> }<br>}</em></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1R9NRoO8wvRc1rRriNYoaA.png" /><figcaption>Your GraphQL playground</figcaption></figure><p>To complete our setup we will need to take a few more steps:</p><ul><li><strong>Setup Dashbird:</strong> <a href="https://dashbird.io/docs/get-started/quick-start/">https://dashbird.io/docs/get-started/quick-start/</a><br>This will help you to get a better overview on logging, performance and X-Ray traces in one places especially if you have multiple Lambda functions.</li><li><strong>Setup Redis:</strong> If you haven’t — hop over to <a href="https://app.redislabs.com/">redislabs.com</a> and setup a Redis or use AWS ElastiCache</li><li><strong>Get NY Times API Key: </strong>Go to <a href="https://developer.nytimes.com/signup">https://developer.nytimes.com/signup</a> and request your own key</li><li><strong>Setup SSM parameter: </strong>Instead of commiting variables into source control use a service like AWS System Manager and store your parameters there<br>Go to: <a href="https://console.aws.amazon.com/systems-manager/parameters?region=us-east-1">https://console.aws.amazon.com/systems-manager/parameters?region=us-east-1</a> and add the required parameters:<br><em>/apollo-test/staging/NY_TIMES_APIKEY<br>/apollo-test/staging/REDIS_HOST<br>/apollo-test/staging/REDIS_PASSWORD<br>/apollo-test/staging/REDIS_PORT</em></li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*VwgMGo8jM2RjlIkVHOat2g.png" /><figcaption>Add parameters to AWS SSM</figcaption></figure><p>If you have trouble with the setup, feel free to <a href="https://github.com/Brikl/serverless-apollo-datasource-redis/issues/new">open an issue in Github</a> or add a comment here.</p><h3>Next?</h3><p>Now this was just a quick proof of concept on running a Redis cache with the new Apollo Server which can come in handy, when you rely on external REST API maybe if you run your Apollo Server in different regions or have a pay-per-use API where you like to reduce number of requests.</p><p>In a more sophisticated setup there is a few points to add or keep in mind.</p><p>By using callbackWaitsForEmptyEventLoop settings set to false you may be subject to closing other running connections to other data sources and some running HTTP requests for reporting e.g. error reporting to Sentry will be cancelled. You might want to split the Lambda functions to one with callbackWaitsForEmptyEventLoop true and one with false and then perform <a href="https://www.apollographql.com/docs/graphql-tools/schema-stitching.html">Schema stitching</a> for example. <em>Note this is specific to Lambda and NodeJS.</em></p><p>Using the SSM Parameter Store is great to replace variable in source code but you can take it even further and instead of using environment variables you can load them on Lambda container setup as described by the awesome <a href="https://medium.com/u/d00f1e6b06a2">Yan Cui</a>.</p><p><a href="https://theburningmonk.com/2017/09/you-should-use-ssm-parameter-store-over-lambda-env-variables/">You should use SSM Parameter Store over Lambda env variables | theburningmonk.com</a></p><p>Besides using Dashbird for logging and performance traces in the future you will also be able to use Apollo Engine for more detailed traces in your GraphQL schema and caching insights.</p><p>Plus the Redis cache can also be used as Persistent Query store. A common practice is using Persistent Queries from Apollo Client as GET requests. When using GET requests we should also add a Cloudfront API Cache in front of our API Gateway since Apollo Server 2.0 includes sending Cache-Control headers along to even further reduce your Lambda and remote endpoint calls.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*b7wBC64R3hu4Hbi7Ib4Tcw.png" /><figcaption>AWS Cloudfront &amp; Apollo Engine &amp; AWS SSM</figcaption></figure><p>Stay tuned we will share more experience on trying Apollo Server 2.0 with Apollo Engine, AWS Cloudfront Cache and other features soon. &gt; Read it:</p><p><a href="https://medium.com/@meixnertobias/automatic-persisted-queries-on-aws-using-cloudfront-serverless-and-dynamodb-1328ca26d1c2">Automatic Persisted Queries on AWS using Cloudfront, Serverless and DynamoDB</a></p><p>Thank you.</p><h3>About BrikL</h3><p>At <a href="https://www.brikl.io/?utm_source=medium&amp;utm_medium=blog&amp;utm_campaign=redis-apollo-server">BrikL</a> we are excited about new technologies in the GraphQL ecosystem such as Apollo Server 2.0 where AWS, Apollo and GraphQL are an essential part of our stack.</p><p>If you are in Thailand or around, join the <a href="https://www.meetup.com/Bangkok-GraphQL-Meetup/">GraphQL meetup in Bangkok</a>.</p><p>BrikL is a fashion tech startup providing a one-stop solution to fashion companies. Our Fashion Design App is cloud-native built on top of serverless technologies with React, Apollo, GraphQL, NodeJS, DynamoDB and more.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f491695cac7f" width="1" height="1" alt=""><hr><p><a href="https://medium.com/brikl-engineering/serverless-graphql-cached-in-redis-with-apollo-server-2-0-f491695cac7f">Serverless GraphQL cached in Redis with Apollo Server 2.0</a> was originally published in <a href="https://medium.com/brikl-engineering">BrikL Engineering</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>