<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Raghad</title>
    <description>The latest articles on DEV Community by Raghad (@raghad60).</description>
    <link>https://dev.to/raghad60</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F1179420%2Fe92335a9-c7ed-4138-a080-15650fe7fc24.png</url>
      <title>DEV Community: Raghad</title>
      <link>https://dev.to/raghad60</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/raghad60"/>
    <language>en</language>
    <item>
      <title>How to Deploy a Full-Stack React &amp; Node.js App on Google Cloud Run.</title>
      <dc:creator>Raghad</dc:creator>
      <pubDate>Sun, 04 May 2025 18:40:25 +0000</pubDate>
      <link>https://dev.to/raghad60/how-to-deploy-a-full-stack-react-nodejs-app-on-google-cloud-run-52m9</link>
      <guid>https://dev.to/raghad60/how-to-deploy-a-full-stack-react-nodejs-app-on-google-cloud-run-52m9</guid>
      <description>&lt;p&gt;&lt;strong&gt;Introduction&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;If you’ve ever wanted to deploy a full-stack application without worrying about managing servers or scaling infrastructure, Google Cloud Run is a game-changer. In this post, we’ll walk through deploying a modern React frontend and Node.js backend using Cloud Run — Google Cloud’s fully managed container platform. Whether you're building a personal project or a production app, Cloud Run helps you go live quickly.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Architecture Overview&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Here’s a simplified flow of how the app works:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Users access the frontend hosted on Cloud Run.&lt;/li&gt;
&lt;li&gt;The frontend makes API requests to the backend, also hosted on Cloud Run.&lt;/li&gt;
&lt;li&gt;The backend processes the requests and sends back responses (JSON data).&lt;/li&gt;
&lt;li&gt;Cloud Run handles traffic, scaling, and security for both services.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;What We’re Building&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;In this guide, we’ll deploy a full-stack web application consisting of a React frontend and a Node.js (Express) backend to Google Cloud Run. The application demonstrates a common architecture used in modern web development: a decoupled frontend served statically and a backend API handling business logic and data processing.&lt;/p&gt;

&lt;p&gt;Here’s a quick breakdown of the components:&lt;/p&gt;

&lt;p&gt;Frontend (React): Built using React, this single-page application (SPA) provides a responsive and dynamic user interface. It communicates with the backend using HTTP requests.&lt;/p&gt;

&lt;p&gt;Backend (Node.js + Express): A RESTful API built with Node.js and Express. It handles requests from the frontend, processes data, and returns responses. This could include authentication, database interactions, or external API integrations.&lt;/p&gt;

&lt;p&gt;We will package these components into a container and deploy them to Cloud Run, a fully managed, serverless platform that automatically scales based on demand.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Setting Up the Project&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Before deploying to the cloud, let’s briefly go over how the project is structured locally. This step ensures your app is organized in a way that’s easy to containerize and deploy.&lt;/p&gt;

&lt;p&gt;We can use &lt;br&gt;
Create a React frontend (create-react-app or Vite).&lt;br&gt;
Create a Node.js Express backend.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Sample image of project structure:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F1sdjxphxg2g6que485nx.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F1sdjxphxg2g6que485nx.png" alt="react node code" width="375" height="499"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;React Frontend:&lt;br&gt;
We can use Create React App or Vite, in this example im going with Create React App, the only diffrent is with build command.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;npx create-react-app client
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;or&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;npm create vite@latest client
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Node.js Backend&lt;/p&gt;

&lt;p&gt;The backend is a lightweight API built with Express. It handles routing, business logic, and communicates with databases or external APIs as needed.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;mkdir server &amp;amp;&amp;amp; cd server
npm init -y
npm install express
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;em&gt;During local development you need to handle CORS as React and Node are separated.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Connecting the Two&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;During local development, the frontend communicates with the backend using proxy settings or environment variables. When deployed together in a container, both parts work seamlessly since they’re served from the same origin.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Containerizing the App&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Before we can deploy our application to Cloud Run, we need to package it into a Docker container. Containerization allows us to bundle the application code, dependencies, and runtime environment into a single, portable image that can run anywhere — whether on your local machine, in CI/CD pipelines, or in the cloud.&lt;/p&gt;

&lt;p&gt;Create a Dockerfile in root working folder.&lt;/p&gt;

&lt;p&gt;Example Dockerfile for Node.js + React.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;
# --- Frontend Stage: Build React App ---
    FROM node:20 AS build-frontend

    WORKDIR /app/client

    # Copy and install dependencies
    COPY client/package.json client/package-lock.json ./
    RUN npm install

    # Copy the rest of the frontend code
    COPY client/ .

    # Build the frontend
    RUN npm run build

    # --- Backend Stage: Setup Express Server ---
    FROM node:20-slim 

    WORKDIR /app/server

    # Copy backend package.json first and install deps
    COPY server/package.json server/package-lock.json ./
    RUN npm install

    # Copy backend code
    COPY server/ .

    # Copy built frontend into backend
    COPY --from=build-frontend /app/client/build ./build

    # Expose server port
    EXPOSE 5000

    # Start the server
    CMD ["node", "server.js"]
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Build Docker image:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;docker build -t &amp;lt;DOCKER_USERNAME&amp;gt;/full-stack-app .&lt;br&gt;
&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Push image to Docker Hub:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;docker push &amp;lt;DOCKER_USERNAME&amp;gt;/full-stack-app&lt;br&gt;
&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;You need to push image to a docker hub as Cloud Run will try to pull image and start container.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Deploying to Cloud Run&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;With our application containerized, the next step is deploying it to Google Cloud Run&lt;/p&gt;

&lt;p&gt;Steps to Deploy:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Set up Google Cloud Project &amp;amp; enable Cloud Run.&lt;/li&gt;
&lt;li&gt;Enable Cloud Run API and ensure billing is enabled on your GCP project.&lt;/li&gt;
&lt;li&gt;Push your container image to Artifact Registry or Container Registry or Docker Hub. &lt;/li&gt;
&lt;li&gt;Deploy using the gcloud CLI or Cloud Console, specifying options like region, service name, and whether the app should be publicly accessible.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;gcloud CLI Command to deploy:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;gcloud run deploy my-fullstack-app \
  --image docker.io/your-dockerhub-username/full-stack-app \
  --platform managed \
  --region YOUR_REGION \
  --allow-unauthenticated
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;service name --&amp;gt; my-fullstack-app &lt;br&gt;
image --&amp;gt; docker image URL&lt;br&gt;
platform --&amp;gt; cloud run managed&lt;br&gt;
region --&amp;gt; you can select us-central1&lt;br&gt;
allow-unauthenticated --&amp;gt; mean the access is public anyone can access website.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Testing and Accessing the App&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Once deployment is done you can access the public URL from Cloud Run.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Conclusion&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;In this guide, we walked through:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Setting up a React frontend and Node.js backend.&lt;/li&gt;
&lt;li&gt;Containerizing both parts into a single Docker image.&lt;/li&gt;
&lt;li&gt;Deploying the app to Google Cloud Run.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Let me know for any query you have :)&lt;/p&gt;

</description>
      <category>cloud</category>
      <category>gcp</category>
      <category>react</category>
      <category>cloudskills</category>
    </item>
    <item>
      <title>Deploy MERN Stack in Digitalocean (2024 version)</title>
      <dc:creator>Raghad</dc:creator>
      <pubDate>Fri, 19 Jul 2024 10:02:51 +0000</pubDate>
      <link>https://dev.to/raghad60/deploy-mern-stack-in-digitalocean-2024-version-1l7b</link>
      <guid>https://dev.to/raghad60/deploy-mern-stack-in-digitalocean-2024-version-1l7b</guid>
      <description>&lt;p&gt;What is Digitalocean? &lt;/p&gt;

&lt;p&gt;Digital Ocean is a cloud computing provider that basically offers you a virtual machine (a server) to host your web application.&lt;/p&gt;

&lt;p&gt;What do you need?&lt;/p&gt;

&lt;p&gt;A basic MERN application (Mongo, Express, React, Node)&lt;/p&gt;

&lt;p&gt;In case this is your first time deploying to production, it is better to have a domain name but it is not essential as you can access your website after deployment with an IP address.&lt;/p&gt;

&lt;p&gt;Getting Ready:&lt;/p&gt;

&lt;p&gt;1- If you do not have an account create one in Digitalocean &lt;a href="https://www.digitalocean.com" rel="noopener noreferrer"&gt;https://www.digitalocean.com&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;2- Once you log in you will get a credit of around 300$ or 200$ you can use it for 2 months and we can use it for creating droplets.&lt;/p&gt;

&lt;p&gt;3- Create a project as per below after that you will see the project name in the dashboard.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Firf6wxqesnc14pb8btrm.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Firf6wxqesnc14pb8btrm.png" alt="Create a project" width="800" height="651"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;4- Create a VPC under networking tap this will create a private network so you can access all resources with private IP addresses like DBs droplets and load balancers.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;In the left corner, select networking then select VPC Network.&lt;/li&gt;
&lt;li&gt;Select the region where you want your VPC better to select one that is near to your country.&lt;/li&gt;
&lt;li&gt;Keep the default IP address to be generated by digitalocean.&lt;/li&gt;
&lt;li&gt;Choose a name and description.&lt;/li&gt;
&lt;li&gt;Create a VPC network.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fdnpc48192yo7kuzs6ixp.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fdnpc48192yo7kuzs6ixp.png" alt="Create a project" width="800" height="269"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fh7dsq8b71oiuag9qlkcb.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fh7dsq8b71oiuag9qlkcb.png" alt="VPC Network" width="800" height="317"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fjl5nfwhm6x1clas7jqxr.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fjl5nfwhm6x1clas7jqxr.png" alt="VPC Network" width="800" height="219"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F3cu2mfbj9cdztd4ntsn7.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F3cu2mfbj9cdztd4ntsn7.png" alt="VPC Network" width="800" height="324"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;5- Now lets create a droplet(server) to host our application.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;In the left corner select Droplets then create Droplet.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fghk5f70krz3ezi9wuqfa.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fghk5f70krz3ezi9wuqfa.png" alt="create a droplet(server)" width="800" height="117"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Now you have two options either you create the server and install all dependencies in the server or you can select the stack from the marketplace both ways are correct but if you just starting the marketplace could be a bit costly so this tutorial will go with creating the server installing all dependencies.&lt;/li&gt;
&lt;li&gt;Choose a Region better near your county in my case I will go with Frankuak and below you will see the VPC you just created so this means our droplet (server) will be in the same network.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F1fhcn1d56ekhmz8sja1k.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F1fhcn1d56ekhmz8sja1k.png" alt="create a droplet(server)" width="800" height="360"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Here I will go with Ubuntu, or if you want to go with markeplace click it and search for mern. &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fada2gyzsdyiymqyhy15s.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fada2gyzsdyiymqyhy15s.png" alt="create a droplet(server)" width="800" height="292"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;In this tutorial, I will select the shared CPU and regular disk with 4$ per month in a real production application you need to select the base in your needs.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fy151c7or31t98st29zdg.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fy151c7or31t98st29zdg.png" alt="create a droplet(server)" width="800" height="523"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;I will not add any Additional Storage or backups as this is only for testing and learning.&lt;/li&gt;
&lt;li&gt;Choose Authentication Method I will go with a password and keep this password with you as you will use it for login to the server.&lt;/li&gt;
&lt;li&gt;Finalize Details by selecting how many droplets you want I will go with one if you want two you can create it and will have the same configuration.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F0pcafvs66ljujb4vtvq3.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F0pcafvs66ljujb4vtvq3.png" alt="create a droplet(server)" width="800" height="374"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Once all set click on your project name you see your droplet click on it you will see more details such as public IP address, Private IP, and console.&lt;/p&gt;

&lt;p&gt;Greate Now we create the server what we need to do is log in to this server and there are many ways to log in either use digitalocean console or if you are a Mac, Linux user you can use your terminal if you windows user you need to install Putty in this tutorial I will go with digitalocean console &lt;/p&gt;

&lt;p&gt;Once you log in you might be asked to enter the password for root here just use the same password where you created the droplet. &lt;/p&gt;

&lt;p&gt;Now you log in as a root@yourDroplteHostName, as a best practice better to not use the root user and to create a user and add this user to sudo group. &lt;/p&gt;

&lt;p&gt;We need to run the below commands:&lt;/p&gt;

&lt;p&gt;Create a user in ubuntu and give it a password.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;adduser sara.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Once you create the user you want this user to perform root commands to do this add the user to sudo group.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;usermod - ag sudo sara
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;To see groups belong to Sara&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;groubs sara
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now sara is in the sudo group we can perform root commands, to switch to Sara user use the below command.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;su sara
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now we need node js if you type node -v is not found.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo apt update &amp;amp;&amp;amp; sudo apt upgrade
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo apt install nodejs
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Check out this link for more details:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://dev.tourl"&gt;(https://www.digitalocean.com/community/tutorials/how-to-install-node-js-on-ubuntu-20-04)&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now let's create a directory to place our application let's create in root directory.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;cd /
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;mkdir mern-apps
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;cd mern-apps
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now we are in mern-app directory you can do pwd to check path, what we need to do is to git all our code files we can clone any node/express app from github. &lt;/p&gt;

&lt;p&gt;Once you clone the project, we need to install node dependencies and prepare the frontend build for production (the react app).&lt;/p&gt;

&lt;p&gt;to install node modules:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;npm i 
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;To create a frontend build ready for production.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;npm run build 
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Notice the build has the index.html which we will tell nginx(webserver) to root all requests to this file.&lt;/p&gt;

&lt;p&gt;Now if you try to copy the public IP in Google Chrome this won't work,&lt;br&gt;
we need to install two things Nginx to accept requests on port 80 and PM2 which is node processing manager that will ensure running the node without logging in to the server.&lt;/p&gt;

&lt;p&gt;Install PM2:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo npm i -g pm2
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Install Nginx:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo apt install nginx
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;We need also to enable the firewall in the server to access the ports right now to check the firewall status is inactive.&lt;/p&gt;

&lt;p&gt;to enable&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo ufw enable
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;By default, if you enable the firewall all ports are blocked. &lt;/p&gt;

&lt;p&gt;We need to enable three ports to access the server ports 80, 443, 22&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo ufw allow ssh
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo ufw allow http
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo ufw allow https
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now if you copy the public IP and run it in Chrome you see the default Nginx webpage.&lt;/p&gt;

&lt;p&gt;Great now we are able to install Nginx but we need our front-end page, not the default Nginx web page to do this let's see the nginx config file and change it.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;cd /etc/nginx/sites-available
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If you do ls -ltr you will see the default file which has all the configuration for the nginx server let see what is inside and change it to our needs.&lt;/p&gt;

&lt;p&gt;With nano command you can view and change the file content, the most two important changes are the root and location.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo nano default
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In Server block change the default root which was for default web server page change it to your index file page in my front-end app it looks like this&lt;/p&gt;

&lt;p&gt;&lt;code&gt;root /mern/JWT-/frontend/dist;&lt;br&gt;
&lt;/code&gt;&lt;br&gt;
if you run the build with react app you get /build but since i used vite as a front-end /dist is the folder name.&lt;/p&gt;

&lt;p&gt;if you have an api with you need to add the location of your api.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;location /api/ {
    proxy_pass http://localhost:8000; # Your Node.js/Express server address and port
    proxy_http_version 1.1;
    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection 'upgrade';
    proxy_set_header Host $host;
    proxy_cache_bypass $http_upgrade;
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Sample of default file&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fs9b0cqqzuf2qdgps1b03.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fs9b0cqqzuf2qdgps1b03.png" alt="Sample of default file" width="800" height="862"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now to save changes of default file click controll x Y enter. &lt;/p&gt;

&lt;p&gt;Since we change the nginx config file we need to restart nginx&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo systemctl nginx restart
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now refresh and you will see your web page out.&lt;/p&gt;

&lt;p&gt;Please dont hesitate to ask any Questions.&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>mern</category>
      <category>digitalocean</category>
      <category>development</category>
    </item>
    <item>
      <title>CodePush with ReactNative for Android.</title>
      <dc:creator>Raghad</dc:creator>
      <pubDate>Fri, 27 Oct 2023 17:06:40 +0000</pubDate>
      <link>https://dev.to/raghad60/codepush-with-reactnative-for-android-4l02</link>
      <guid>https://dev.to/raghad60/codepush-with-reactnative-for-android-4l02</guid>
      <description>&lt;h2&gt;
  
  
  What is CodePush?
&lt;/h2&gt;

&lt;p&gt;CodePush is an App Center cloud service that enables React Native developers to deploy mobile app updates directly to their users without going through store approvals. With codepush, you can update javascript code by fixing bugs and applying new styles and new feature.&lt;/p&gt;

&lt;p&gt;Note that stores Apple and Google will let you apply the changes in case you are not changing the whole app and not changing any native Android IOS code only javascript code.&lt;/p&gt;

&lt;h2&gt;
  
  
  In this post will cover
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;Creating an account in AppCenter and a RN project.&lt;/li&gt;
&lt;li&gt;Integrating codepush with react native.&lt;/li&gt;
&lt;li&gt;Building a sample app and deploy the changes to AppCenter CodePush.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;First lets understand how codepush is working with the image below.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ffnhiq0hzthtfgpg0kn7s.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ffnhiq0hzthtfgpg0kn7s.png" alt="CodePush" width="800" height="409"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;If you have any changes a normal way is to upload them to stores and once stores approve the application then you can download the app but what if you got a crash bug and you need immediately to update the app CodePush can help you here. What code push is doing is will check if any Javascript code changes the Javascript bundle if there is AppCenter will automatically apply the changes.&lt;/p&gt;

&lt;h2&gt;
  
  
  Creating an account in AppCenter.
&lt;/h2&gt;

&lt;p&gt;Click &lt;a href="https://appcenter.ms/sign-in?utm_source=CodePush&amp;amp;utm_medium=Azure" rel="noopener noreferrer"&gt;here &lt;/a&gt; to register to AppCenter once done a you will see the below page click on &lt;strong&gt;Add new&lt;/strong&gt; in the right top corner then Add new app.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fu0sdmmtwirs7b9c3gvif.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fu0sdmmtwirs7b9c3gvif.png" alt="new app appcenter" width="726" height="815"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Select the Name of your App, Release Type, OS and Platform then click on Add new app.&lt;/p&gt;

&lt;p&gt;you will get something like this lets go now and and create a RN app.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Frxg1xalxkbtb99a7t4p7.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Frxg1xalxkbtb99a7t4p7.png" alt="Getting Started" width="800" height="481"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Setup React Native Project.
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;npx react-native@latest init AwesomeProject
cd AwesomeProject
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Add AppCenter CLI and SDK to the project.
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;npm install -g appcenter-cli
npm install appcenter appcenter-analytics appcenter-crashes --save-exact
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Create a new file with the name appcenter-config.json in android/app/src/main/assets/ with the following content:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;{
  "app_secret": "{Your app secret here}"
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;if you do not have the assets folder you can create one&lt;/p&gt;

&lt;p&gt;Modify the app's res/values/strings.xml to include the following lines:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;string name="appCenterCrashes_whenToSendCrashes" moduleConfig="true" translatable="false"&amp;gt;DO_NOT_ASK_JAVASCRIPT&amp;lt;/string&amp;gt;
&amp;lt;string name="appCenterAnalytics_whenToEnableAnalytics" moduleConfig="true" translatable="false"&amp;gt;ALWAYS_SEND&amp;lt;/string&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Add CodePush&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;npm install --save react-native-code-push
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;After installing all dependencies run this command&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;npm run android
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Plugin integration
&lt;/h2&gt;

&lt;p&gt;Plugin installation and configuration is different based on your react native version, so perform the following setup steps depending on your react native version.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://github.com/microsoft/react-native-code-push/blob/master/docs/setup-android.md" rel="noopener noreferrer"&gt;React native versions&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Next Wrap your component with CodePush in App.js , there are many &lt;a href="https://github.com/microsoft/react-native-code-push#plugin-usage" rel="noopener noreferrer"&gt;options &lt;/a&gt;to wrap with your component&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import CodePush from "react-native-code-push";

let MyApp: () =&amp;gt; React$Node = () =&amp;gt; {
}

MyApp = CodePush(MyApp);

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now we are done with integration part you can change the default react native app code styles to what ever you want, once you are satisfied you can build the release version of your app.&lt;/p&gt;

&lt;p&gt;To release an APK check &lt;a href="https://www.decoide.org/react-native/docs/signed-apk-android.html" rel="noopener noreferrer"&gt;this&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The release build will take time as we did many native code changes.&lt;/p&gt;

&lt;p&gt;Once the release done go to android\app\build\outputs\apk\release&lt;br&gt;
and install it in your Android phone.&lt;/p&gt;

&lt;p&gt;Now lets update our JavaScript code change it to what ever you want, once you are satisfied lets release an update but now without releasing a new APK but a new update to AppCenter.&lt;/p&gt;

&lt;h2&gt;
  
  
  Release an update with the command
&lt;/h2&gt;

&lt;p&gt;appcenter codepush release-react -a &lt;strong&gt;ownername&lt;/strong&gt;/&lt;strong&gt;projectname ** -d **environment&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The &lt;strong&gt;ownername&lt;/strong&gt; is the owner name in AppCenter, &lt;strong&gt;projectname ** is the project name in AppCenter, environment either **staging **or **production&lt;/strong&gt; base on your deployment key.&lt;/p&gt;

&lt;h2&gt;
  
  
  If you are not getting the update:
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Make sure you applied all required changes for CodePush dependencies.&lt;/li&gt;
&lt;li&gt;Make sure the keys are correct, and you deploy production/staging correctly.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;I hope you enjoyed :)&lt;/p&gt;

</description>
      <category>reactnative</category>
      <category>javascript</category>
      <category>codepush</category>
      <category>programming</category>
    </item>
  </channel>
</rss>
