<?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[Stories by Davin Anaya on Medium]]></title>
        <description><![CDATA[Stories by Davin Anaya on Medium]]></description>
        <link>https://medium.com/@davinanaya?source=rss-2f0d0c523988------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*DL95TJ07g0OgFcDKP0TLJA.png</url>
            <title>Stories by Davin Anaya on Medium</title>
            <link>https://medium.com/@davinanaya?source=rss-2f0d0c523988------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 06 Dec 2026 00:05:50 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@davinanaya/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Amplify with NestJS]]></title>
            <link>https://medium.com/@davinanaya/amplify-with-nestjs-8d35b6b9f02e?source=rss-2f0d0c523988------2</link>
            <guid isPermaLink="false">https://medium.com/p/8d35b6b9f02e</guid>
            <category><![CDATA[nest]]></category>
            <category><![CDATA[nestjs]]></category>
            <category><![CDATA[amplify]]></category>
            <dc:creator><![CDATA[Davin Anaya]]></dc:creator>
            <pubDate>Fri, 12 Feb 2021 14:59:51 GMT</pubDate>
            <atom:updated>2021-02-12T15:05:31.998Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="Amplify with Nestjs" src="https://cdn-images-1.medium.com/max/1024/1*B1qiZ9gFh34rZOdEzmAUYQ.jpeg" /></figure><p>Recently I wanted to try out deploying a NestJS project as a lambda using Amplify framework. This is all about what I learned, hoping that it may help others too. I am not going to deep on the basic thing of Nest and Amplify, if you got here you already know what these things are.</p><h3>1. Configure your entry point for lambda</h3><p>Amplify in background creates an API Getway and Lambda function. here are the commands</p><pre>amplify add function<br>amplify add api</pre><p>so you need to provide an entry point for your code in a lambda function. This entry point will be a handler object exported in the file index.ts. just as if you were setting up a serverless project with Nest</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/748a156885ea34a10008fa1a96118328/href">https://medium.com/media/748a156885ea34a10008fa1a96118328/href</a></iframe><p>Once the lambda entry point is created. We need to add a script in our root package.json, the reason for this is because Amplify allow us to execute a script before a function is deployed to transpile Typescript or ES6 into a format that is supported by the AWS Lambda’s node runtime</p><pre>{   <br>   &quot;scripts&quot;: {<br>       &quot;amplify:&lt;function_name&gt;&quot;: &quot;tsc -p ./tsconfig-amplify.json&quot;<br>   }<br>}</pre><h3>2. Add custom tsconfig for Amplify</h3><p>I created a custom tsconfig file to configure my compile options and put those transpiled files into my lambda function.</p><p>the key is outDir, because that’s where we are going to put our transpile code</p><pre>&quot;outDir&quot;: &quot;./amplify/backend/function/&lt;function&gt;/src&quot;</pre><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/be476feea1702c3ce54e34131100ffee/href">https://medium.com/media/be476feea1702c3ce54e34131100ffee/href</a></iframe><h3>3. Add your package.json inside the lambda function</h3><p>In that pacakage.json add only what is necessary to run the project, it is not necessary to have your devDependencies like types, eslint etc.</p><h3>4. Push your changes to AWS</h3><pre>amplify push -y</pre><p>Also you can ignore your lambda function src, since all your code is already in your root</p><pre>amplify/backend/function/&lt;function&gt;/src</pre><h3>Conclusion</h3><p>All we do is compile the Nestjs project inside our lambda function, the advantage of this is that you can still debug and work locally without any problem without running the amplify mock function command.</p><p>Reference:</p><p><a href="https://nishabe.medium.com/nestjs-serverless-lambda-aws-in-shortest-steps-e914300faed5">NestJS + Serverless + Lambda + AWS — In shortest steps. | by nish abe | Medium</a></p><p><a href="https://docs.amplify.aws/cli/function/build-options">Functions — Build options — Amplify Docs</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8d35b6b9f02e" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>