<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/">
  <channel>
    <title>GraphQL on {O}</title>
    <link>https://omarmakled.com/tags/graphql/</link>
    <description>Recent content in GraphQL on {O}</description>
    <generator>Hugo -- 0.151.1</generator>
    <language>en-us</language>
    <atom:link href="https://omarmakled.com/tags/graphql/index.xml" rel="self" type="application/rss+xml" />
    <item>
      <title>AWS SAM Nested Stacks for a Structured GraphQL API</title>
      <link>https://omarmakled.com/posts/sam-graphql/</link>
      <pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
      <guid>https://omarmakled.com/posts/sam-graphql/</guid>
      <description>&lt;p&gt;This example provides a structured approach to deploying a &lt;strong&gt;Serverless GraphQL API&lt;/strong&gt; using &lt;strong&gt;AWS Serverless Application Model (SAM)&lt;/strong&gt;, leveraging &lt;strong&gt;Nested Stacks&lt;/strong&gt; for modularity.&lt;/p&gt;
&lt;h3 id=&#34;project-structure-modular-stacks&#34;&gt;Project Structure: Modular Stacks&lt;/h3&gt;
&lt;p&gt;The core idea is to break down the infrastructure into specialized, manageable units using SAM&amp;rsquo;s Nested Stacks. This separation enhances clarity, reusability, and maintainability.&lt;/p&gt;
&lt;p&gt;The &lt;strong&gt;Root Template&lt;/strong&gt; acts as the orchestrator, defining the dependencies between the smaller stacks:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;&lt;code&gt;RolesStack&lt;/code&gt; (stacks/roles.yaml):&lt;/strong&gt; Creates the necessary &lt;strong&gt;IAM Roles&lt;/strong&gt; for Lambda execution and for AppSync to invoke the Lambda function.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;&lt;code&gt;GraphQLStack&lt;/code&gt; (stacks/graphql.yaml):&lt;/strong&gt; Provisions the &lt;strong&gt;AWS AppSync GraphQL API&lt;/strong&gt;, including the API itself, the API Key, and the Schema definition (which is assumed to be uploaded to an S3 location).&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;&lt;code&gt;FunctionsStack&lt;/code&gt; (stacks/functions.yaml):&lt;/strong&gt; Deploys the &lt;strong&gt;Lambda function&lt;/strong&gt;, the &lt;strong&gt;AppSync Data Source&lt;/strong&gt;, and the &lt;strong&gt;Resolvers&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;&lt;code&gt;query.graphql&lt;/code&gt;&lt;/strong&gt; the schema definition can also be split into smaller files (types, queries, and mutations). These fragments are then merged into a single final schema file (schema.graphql).&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;The best thing about this design is that everything is &lt;strong&gt;organized and independent&lt;/strong&gt;. Each group of functions or resources is in its own box (stack).&lt;/p&gt;</description>
    </item>
  </channel>
</rss>
