<?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 Ahmed on Medium]]></title>
        <description><![CDATA[Stories by Ahmed on Medium]]></description>
        <link>https://medium.com/@__AhmedKamel?source=rss-c16a3f449fe1------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/proxy/1*TGH72Nnw24QL3iV9IOm4VA.png</url>
            <title>Stories by Ahmed on Medium</title>
            <link>https://medium.com/@__AhmedKamel?source=rss-c16a3f449fe1------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 23 Nov 2026 10:35:47 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@__AhmedKamel/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[Deploying NestJS (Backend) and NextJS (Frontend) Applications with AWS Elastic Beanstalk]]></title>
            <link>https://medium.com/@__AhmedKamel/deploying-nestjs-backend-and-nextjs-frontend-applications-with-aws-elastic-beanstalk-267792800c1f?source=rss-c16a3f449fe1------2</link>
            <guid isPermaLink="false">https://medium.com/p/267792800c1f</guid>
            <dc:creator><![CDATA[Ahmed]]></dc:creator>
            <pubDate>Wed, 19 Apr 2023 01:19:04 GMT</pubDate>
            <atom:updated>2023-04-19T01:21:06.758Z</atom:updated>
            <content:encoded><![CDATA[<p>Introduction:</p><p>Deploying a full-stack application can be a challenging task, especially when using different frameworks for frontend and backend. In this tutorial, we will demonstrate how to deploy a NestJS (backend) and NextJS (frontend) application using AWS Elastic Beanstalk, which is a platform-as-a-service (PaaS) provided by Amazon Web Services.</p><p>Prerequisites:</p><ol><li>A NestJS application with a PostgreSQL database for the backend</li><li>A NextJS application for the frontend</li><li>An AWS account</li><li>AWS Elastic Beanstalk CLI (EB CLI) installed</li></ol><p>Step 1: Prepare your applications</p><p>Before deploying your applications, ensure that they are properly configured for production.</p><p>1a. Backend (NestJS):</p><ul><li>Create a .env file or an equivalent configuration for environment variables, such as database connections for PostgreSQL.</li><li>Add a start:prod script in your package.json file, like this: &quot;start:prod&quot;: &quot;node dist/main&quot;.</li></ul><p>1b. Frontend (NextJS):</p><ul><li>Include a build and a start script in your package.json file, for example: &quot;build&quot;: &quot;next build&quot; and &quot;start&quot;: &quot;next start -p $PORT&quot;.</li></ul><p>Step 2: Separate repositories</p><p>Create two separate repositories or folders, one for the backend and one for the frontend. This is necessary because Elastic Beanstalk requires distinct environments for each application.</p><p>Step 3: Install the Elastic Beanstalk CLI (EB CLI)</p><p>Install the EB CLI using pip by running the following command:</p><pre>pip install awsebcli --upgrade</pre><p>Step 4: Backend Deployment (NestJS)</p><p>4a. Run eb init within the backend folder to create a new Elastic Beanstalk application. You will be prompted to select a region and provide your AWS access key and secret key.</p><p>4b. Select the “Node.js” platform when prompted.</p><p>4c. Create a .ebextensions folder in your backend folder. Inside it, create a file named 01-environment.config and add the following content to set up the required environment variables:</p><pre>option_settings:<br>  aws:elasticbeanstalk:container:nodejs:<br>    NodeCommand: &quot;npm run start:prod&quot;</pre><p>4d. Create an environment using the command:</p><pre>eb create backend-env --database.engine postgres --database.username &lt;DB_USERNAME&gt; --database.password &lt;DB_PASSWORD&gt; --single</pre><p>Replace &lt;DB_USERNAME&gt; and &lt;DB_PASSWORD&gt; with your actual database credentials.</p><p>4e. Deploy your application using the command:</p><pre>eb deploy</pre><p>Step 5: Frontend Deployment (NextJS)</p><p>5a. Run eb init within the frontend folder to create a new Elastic Beanstalk application. You will be prompted to select a region and provide your AWS access key and secret key.</p><p>5b. Select the “Node.js” platform when prompted.</p><p>5c. Create a .ebextensions folder in your frontend folder. Inside it, create a file named 01-environment.config and add the following content to set up the required environment variables:</p><pre>option_settings:<br>  aws:elasticbeanstalk:container:nodejs:<br>    NodeCommand: &quot;npm run start&quot;</pre><p>5d. Create an environment using the command:</p><pre>eb create frontend-env --single</pre><p>5e. Deploy your application using the command:</p><pre>eb deploy</pre><p>Conclusion:</p><p>After the deployment is complete, you can find the URLs for your applications in the Elastic Beanstalk console. The backend and frontend will have separate URLs, which you can use to access your deployed applications. You may need to update your frontend application to point to the backend API URL, depending on how you’ve set up your applications.</p><p>Remember to update your environment variables, such as database connections or API keys, in the Elastic Beanstalk console.</p><p>Now you have successfully deployed a NestJS (backend) and NextJS (frontend) application using AWS Elastic Beanstalk. This method simplifies the deployment process and allows you to easily manage and scale your applications. With your applications up and running, you can now share your work with others and continue to develop and maintain your project seamlessly.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=267792800c1f" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>