<?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 Vidit Chawda on Medium]]></title>
        <description><![CDATA[Stories by Vidit Chawda on Medium]]></description>
        <link>https://medium.com/@viditchawda301?source=rss-94f2667aa202------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*diPOG0q79wpAMV61</url>
            <title>Stories by Vidit Chawda on Medium</title>
            <link>https://medium.com/@viditchawda301?source=rss-94f2667aa202------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 23 Nov 2026 09:26:31 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@viditchawda301/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[Monorepos are becoming increasingly popular in modern web development because they allow developers…]]></title>
            <link>https://medium.com/@viditchawda301/monorepos-are-becoming-increasingly-popular-in-modern-web-development-because-they-allow-developers-195c17844965?source=rss-94f2667aa202------2</link>
            <guid isPermaLink="false">https://medium.com/p/195c17844965</guid>
            <dc:creator><![CDATA[Vidit Chawda]]></dc:creator>
            <pubDate>Sun, 19 Jan 2025 21:54:18 GMT</pubDate>
            <atom:updated>2025-01-19T22:10:16.446Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Ef3gp1psElQ4nNLcU-AlKg.png" /></figure><p>Monorepos are becoming increasingly popular in modern web development because they allow developers to manage multiple project modules, such as the admin and customer sides, within a single repository. Hosting a website from a mono repo on Firebase must be challenging. This blog will guide you through the step-by-step process, using an example project with two modules: <strong>Admin</strong> and <strong>Customer</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*dtG58VktYaVEbBJu0eB3Vw.png" /><figcaption><strong>1.1 Folder Strucutre of the monorepo</strong></figcaption></figure><h4>Explanation:</h4><ol><li><strong>My-project/</strong>: This is the root directory of your project.</li><li><strong>apps/</strong>: Contains subdirectories for the different parts of your application (e.g., admin and customer).</li><li><strong>admin/ and </strong><strong>customer/</strong>: These are the directories for the admin and customer apps.</li><li><strong>packages/</strong>: This folder can contain shared packages or libraries used across your admin and customer apps.</li><li><strong>.firebaserc</strong>: Firebase project configuration file, containing settings like project aliases and project IDs.</li><li><strong>firebase.json</strong>: Firebase configuration file for setting up Firebase services like Firestore, functions, hosting, etc.</li></ol><h4>Step-1: Initializing the Firebase hosting in your project</h4><p>In the terminal of your text editor, navigate to the root of your project. Then run the following command:</p><pre>firebase login</pre><p>This will authenticate your firebase account. Once logged in initialize Firebase Hosting for your project:</p><pre>Firebase init hosting </pre><h4>Step-2: Configure Firebase Hosting Settings:</h4><p>You will be asked to specify a public directory for Firebase Hosting. For the structure you’ve mentioned, set the public directory to apps/admin/dist or apps/customer/dist depending on which app you&#39;re working on. You can also configure this for both later.</p><h4>Step-3: Update firebase.json file</h4><p>Your firebase.json file should be created or updated with the hosting settings. Here&#39;s an example firebase.json file:</p><pre>{<br>  &quot;hosting&quot;: [<br>    {<br>      &quot;target&quot;: &quot;admin&quot;,<br>      &quot;public&quot;: &quot;apps/admin/dist&quot;,<br>      &quot;rewrites&quot;: [<br>        {<br>          &quot;source&quot;: &quot;**&quot;,<br>          &quot;destination&quot;: &quot;/index.html&quot;<br>        }<br>      ]<br>    },<br>    {<br>      &quot;target&quot;: &quot;customer&quot;,<br>      &quot;public&quot;: &quot;apps/customer/dist&quot;,<br>      &quot;rewrites&quot;: [<br>        {<br>          &quot;source&quot;: &quot;**&quot;,<br>          &quot;destination&quot;: &quot;/index.html&quot;<br>        }<br>      ]<br>    }<br>  ]<br>}</pre><h4>Step 5: Build Your Apps</h4><p>You need to build your admin and customer apps so the necessary files are placed into the dist directories. The build process will depend on the technology you’re using. For example:</p><pre>npm run build</pre><p>Run npm run build inside both admin and customer directories.</p><h4>Step 6: Access the Firebase Console</h4><ol><li>Go to the Firebase Console.</li><li>Select your Firebase project or create a new project if you haven’t done so yet.</li></ol><h4>Step 7: Add Sites for admin and customer Apps</h4><p>Since you’re deploying two separate apps (admin and customer), you need to set up multiple sites on Firebase Hosting for each app.</p><p>For Firebase Hosting with Multiple Sites:</p><ol><li>In the Firebase Console, navigate to <strong>Hosting</strong> from the left sidebar.</li><li>Click on <strong>Get Started</strong> or <strong>Add Site</strong> to create a new site.</li><li>For the <strong>Admin Site</strong>:</li></ol><ul><li>Click <strong>Add Site</strong> and name the site (e.g., admin-project).</li><li>Once the site is created, you will be provided with a URL like admin-project.web.app or admin-project.firebaseapp.com (this will be your deployed admin site).</li></ul><ol><li>Similarly, create another site for the <strong>Customer Site</strong></li></ol><ul><li>Click <strong>Add Site</strong> again and name the site (e.g., customer-project).</li><li>You will get a URL like customer-project.web.app or customer-project.firebaseapp.com.</li></ul><p>Connecting Multiple Sites to Your Project:</p><ul><li>Firebase Hosting supports <strong>multi-site</strong> configurations, so you can have both admin and customer apps under the same Firebase project, each with its own URL.</li><li>Each site will be linked to a specific folder in your repository (apps/admin/dist for the admin app and apps/customer/dist for the customer app).</li></ul><h4>Step 8: Deploy to Firebase Hosting</h4><p>After setting up the multiple sites, you can deploy your apps to the respective Firebase Hosting sites by running the following commands:</p><p>For deploying the website on <strong>customer </strong>site run command:</p><pre>firebase deploy --only hosting:customer</pre><p>Similarly, for deploying the website on <strong>admin </strong>site run command:</p><pre>firebase deploy --only hosting:admin</pre><p>Firebase will automatically detect the firebase.json configuration and deploy the admin and customer apps to their respective sites.</p><h4>Step 9: Verify the Deployment</h4><p>Once the deployment process finishes, Firebase will display the URLs for your sites, such as:</p><ul><li>admin-project.web.app (Admin app)</li><li>customer-project.web.app (Customer app)</li></ul><p>You can open these URLs in your browser to verify that the correct app is deployed.</p><h4>Conclusion</h4><p>Setting up Firebase Hosting for a multi-app project is a streamlined process that allows you to deploy multiple sites under the same Firebase project. By organizing your project structure efficiently, such as having separate directories for admin and customer apps, and utilizing Firebase&#39;s multi-site hosting feature, you can easily manage and deploy different parts of your application. With Firebase’s powerful tools and clear configuration setup, deploying to both admin and customer sites is just a few steps away. Now, your web apps can be hosted, served, and updated effortlessly, ensuring seamless experiences for both administrators and customers.</p><p>By following this guide, you’ll have a robust Firebase Hosting setup tailored to your project’s needs, ready to scale and provide reliable hosting for both your admin and customer-facing applications.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=195c17844965" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>