DEV Community

Cover image for The Best Free# Deploying Your React Application: 8 Free Hosting Services to Consider
Fernando for IDURAR | Where Ai Build Software

Posted on

The Best Free# Deploying Your React Application: 8 Free Hosting Services to Consider

IDURAR is Open Source ERP/CRM (Invoice / Inventory / Accounting / HR) Based on Mern Stack (Node.js / Express.js / MongoDb / React.js ) with Ant Design (AntD) and Redux
GitHub Repository: https://github.com/idurar/idurar-erp-crm

Image description

Introduction

So, you've built an impressive React application, and now you're ready to take it out of development and into production. But how exactly do you deploy a React application and host it for free? In this comprehensive guide, we'll explore eight different hosting services that offer free options for hosting React applications. Whether you're a beginner or an experienced developer, this article will provide you with the necessary information to choose the right hosting service for your React project.

Table of Contents

  1. Vercel

  2. Netlify

  3. AWS Amplify

  4. Firebase

  5. GitHub Pages

  6. GitLab Pages

  7. Render

  8. Surge

Vercel

Vercel is a revolutionary serverless deployment service designed specifically for React, Angular, Vue, and other JavaScript libraries. With its seamless integration with GitLab and Bitbucket, Vercel allows you to easily import your React projects and deploy them with just a few clicks.

To get started with Vercel, create a new account or log in using your existing credentials. Once you're logged in, you'll be greeted with the Vercel dashboard, where you can manage your projects and deployments.

Deploying Using the Vercel Dashboard

To deploy your React application using the Vercel dashboard, follow these steps:

1.Click on the Import Project button on your dashboard.

  1. Choose your preferred Git repository platform, such as GitHub, GitLab, or Bitbucket.

  2. Authenticate Vercel with your chosen platform and grant the necessary permissions.

  3. Select the repository that contains your React application.

  4. Configure the deployment settings, such as the build command and the output directory.

  5. Click on the Deploy button to start the deployment process.

Vercel will automatically detect if your React app was initialized using Create React App (CRA) and choose the appropriate configuration for deployment. If you're using a different setup, you may need to provide additional configuration details during the deployment process.

Deploying Using the Vercel CLI

If you prefer using the command line interface (CLI), Vercel also provides a powerful CLI tool that allows you to deploy your React application with ease. Here's how you can deploy your React app using the Vercel CLI:

  1. Install the Vercel CLI by running the following command in your terminal:
npm install -g vercel
Enter fullscreen mode Exit fullscreen mode
  1. Navigate to the root directory of your React application.

  2. Run the following command to deploy your app:

vercel
Enter fullscreen mode Exit fullscreen mode

The CLI will prompt you to log in or sign up if you haven't already. Once you're logged in, the deployment process will begin, and you'll be provided with a unique URL where your React application will be hosted.

Netlify

Netlify is another popular hosting service that specializes in hosting static websites, making it an excellent choice for deploying React applications. With its generous free tier and seamless integration with Git platforms, Netlify offers a user-friendly interface for deploying and managing your React projects.

Deploying Using the Netlify Dashboard

To deploy your React application using the Netlify dashboard, follow these steps:

  1. Sign in to Netlify using your GitHub account or create a new account if you don't have one.

  2. Once you're logged in, click on the New site from Git button on the dashboard.

  3. Select your preferred Git repository platform, such as GitHub, GitLab, or Bitbucket.

  4. Authenticate Netlify with your chosen platform and grant the necessary permissions.

  5. Choose the repository that contains your React application.

  6. Configure the deployment settings, such as the build command and the publish directory.

  7. Click on the Deploy site button to start the deployment process.

Netlify will automatically detect your React application and build it using the specified build command. Once the build process is complete, your React app will be deployed and accessible through a unique URL provided by Netlify.

Deploying Using the Netlify CLI

If you prefer using the command line interface, Netlify provides a CLI tool that allows you to deploy your React application with ease. Here's how you can deploy your React app using the Netlify CLI:

  1. Install the Netlify CLI by running the following command in your terminal:
npm install -g netlify-cli
Enter fullscreen mode Exit fullscreen mode
  1. Navigate to the root directory of your React application.

  2. Run the following command to log in to Netlify:

netlify login

Enter fullscreen mode Exit fullscreen mode

This command will open a browser window where you can authenticate with your Netlify account.

  1. Once you're logged in, run the following command to deploy your app:
netlify deploy

Enter fullscreen mode Exit fullscreen mode

The CLI will prompt you to choose the deployment options, such as the build command and the publish directory. Once you've made your selections, the deployment process will begin, and you'll be provided with a unique URL where your React application will be hosted.

AWS Amplify

AWS Amplify is a comprehensive cloud development platform offered by Amazon Web Services (AWS). It provides a wide range of services and tools for building, deploying, and hosting React applications. While AWS Amplify offers a free tier, it's important to note that some features and services may incur additional costs.

Deploying Using the Amplify Console

The Amplify Console is a web-based interface that allows you to deploy and manage your React applications on AWS. To deploy your React application using the Amplify Console, follow these steps:

  1. Sign in to the AWS Management Console and navigate to the Amplify service.

  2. Click on the Get Started button in the Amplify Console.

  3. Connect your preferred Git repository platform, such as GitHub, GitLab, or Bitbucket.

  4. Authenticate AWS Amplify with your chosen platform and grant the necessary permissions.

  5. Choose the repository that contains your React application.

  6. Configure the deployment settings, such as the build command and the output directory.

  7. Click on the Deploy button to start the deployment process.

AWS Amplify will automatically build and deploy your React application based on the specified configuration. Once the deployment is complete, you'll be provided with a unique URL where your React app will be hosted.

Deploying Using the Amplify CLI

If you prefer using the command line interface, AWS Amplify provides a powerful CLI tool that allows you to deploy your React application with ease. Here's how you can deploy your React app using the Amplify CLI:

  1. Install the Amplify CLI by running the following command in your terminal:
npm install -g @aws-amplify/cli

Enter fullscreen mode Exit fullscreen mode
  1. Navigate to the root directory of your React application.

  2. Run the following command to initialize AWS Amplify:

amplify init

Enter fullscreen mode Exit fullscreen mode

The CLI will guide you through the initialization process, where you'll configure your project settings and connect your Git repository.

  1. Once the initialization is complete, run the following command to deploy your app:
amplify publish

Enter fullscreen mode Exit fullscreen mode

The CLI will build and deploy your React application based on the specified configuration. Once the deployment is complete, you'll be provided with a unique URL where your React app will be hosted.

Firebase

Firebase is a comprehensive development platform offered by Google. It provides a wide range of services and tools for building, deploying, and hosting web applications, including React applications. Firebase offers a free tier that allows you to deploy and host your React app at no cost, with options to upgrade for additional features and usage limits.

Deploying Using the Firebase Console

The Firebase Console is a web-based interface that allows you to deploy and manage your React applications on Firebase. To deploy your React application using the Firebase Console, follow these steps:

  1. Sign in to the Firebase Console using your Google account or create a new account if you don't have one.

  2. Create a new Firebase project by clicking on the Add project button.

  3. Provide a name for your project and select your preferred Firebase project settings.

  4. Once your project is created, click on the Hosting tab in the left sidebar.

  5. Click on the Get started button to set up Firebase Hosting for your project.

  6. Follow the instructions provided to install the Firebase CLI and initialize your project.

  7. Once your project is initialized, run the following command in your terminal to deploy your app:

firebase deploy --only hosting

Enter fullscreen mode Exit fullscreen mode

Firebase will build and deploy your React application based on the specified configuration. Once the deployment is complete, you'll be provided with a unique URL where your React app will be hosted.

Deploying Using the Firebase CLI

If you prefer using the command line interface, Firebase provides a CLI tool that allows you to deploy your React application with ease. Here's how you can deploy your React app using the Firebase CLI:

  1. Install the Firebase CLI by running the following command in your terminal:
npm install -g firebase-tools

Enter fullscreen mode Exit fullscreen mode
  1. Navigate to the root directory of your React application.

  2. Run the following command to initialize Firebase:

firebase init

Enter fullscreen mode Exit fullscreen mode

The CLI will guide you through the initialization process, where you'll configure your project settings and connect your Firebase project.

  1. Once the initialization is complete, run the following command to deploy your app:
firebase deploy --only hosting

Enter fullscreen mode Exit fullscreen mode

The CLI will build and deploy your React application based on the specified configuration. Once the deployment is complete, you'll be provided with a unique URL where your React app will be hosted.

GitHub Pages

GitHub Pages is a hosting service provided by GitHub that allows you to host static websites for free. It's a great option for deploying React applications, especially if your project is already hosted on GitHub. GitHub Pages is easy to set up and provide a simple and straightforward process for deploying your React app.

Deploying Using the GitHub Pages Settings

To deploy your React application using GitHub Pages, follow these steps:

  1. Sign in to GitHub and navigate to the repository that contains your React application.

  2. Click on the Settings tab at the top of the repository.

  3. Scroll down to the GitHub Pages section.

  4. In the Source dropdown, select the branch that contains your React app's build files.

  5. Click on the Save button to save your changes.

GitHub Pages will automatically detect the build files in the selected branch and deploy your React application. Once the deployment is complete, you'll be provided with a unique URL where your React app will be hosted.

Deploying Using the GitHub Actions Workflow

If you prefer a more automated deployment process, you can use GitHub Actions to deploy your React app to GitHub Pages. Here's how you can set up a GitHub Actions workflow to deploy your React app:

  1. Create a new file in your repository's .github/workflows directory, such as deploy.yml.

  2. Add the following code to the deploy.yml file:

name: Deploy to GitHub Pages

on:
  push:
    branches:
      - main

jobs:
  deploy:
    runs-on: ubuntu-latest

    steps:
      - name: Checkout repository
        uses: actions/checkout@v2

      - name: Set up Node.js
        uses: actions/setup-node@v2
        with:
          node-version: 14

      - name: Install dependencies
        run: npm ci

      - name: Build and deploy
        run: |
          npm run build
          npx gh-pages -d build
Enter fullscreen mode Exit fullscreen mode
  1. Commit and push the changes to your repository.

GitHub Actions will automatically trigger the deployment workflow whenever you push changes to the specified branch. The workflow will build your React app and deploy it to GitHub Pages, making it accessible through a unique URL.

GitLab Pages

GitLab Pages is a hosting service provided by GitLab that allows you to host static websites for free. If your React project is hosted on GitLab, GitLab Pages provides an easy and seamless way to deploy your React application. GitLab Pages supports both static and dynamic websites, making it a versatile option for hosting React applications.

Deploying Using the GitLab CI/CD Pipeline

To deploy your React application using GitLab Pages, follow these steps:

  1. Sign in to GitLab and navigate to the repository that contains your React application.

  2. Click on the CI/CD tab at the top of the repository.

  3. Scroll down to the Pipelines section.

  4. Click on the New pipeline button to trigger a new pipeline.

  5. GitLab will automatically detect the configuration file in your repository, such as .gitlab-ci.yml, and use it to build and deploy your React application.

GitLab will automatically build and deploy your React application based on the specified configuration. Once the deployment is complete, you'll be provided with a unique URL where your React app will be hosted.

Render

Render is a hosting service that offers a free tier for hosting static websites, making it a suitable option for deploying React applications. Render provides a user-friendly interface and a seamless integration with Git platforms, allowing you to easily deploy and manage your React projects.

Deploying Using the Render Dashboard

To deploy your React application using the Render dashboard, follow these steps:

  1. Sign in to Render using your GitHub account or create a new account if you don't have one.

  2. Once you're logged in, click on the Create New button on the dashboard.

  3. Select your preferred Git repository platform, such as GitHub, GitLab, or Bitbucket.

  4. Authenticate Render with your chosen platform and grant the necessary permissions.

  5. Choose the repository that contains your React application.

  6. Configure the deployment settings, such as the build command and the output directory.

  7. Click on the Create Web Service button to start the deployment process.

Render will automatically detect your React application and build it based on the specified configuration. Once the build process is complete, your React app will be deployed and accessible through a unique URL provided by Render.

Surge

Surge is a simple and straightforward hosting service that allows you to deploy static websites, including React applications, with ease. Surge offers a free tier that allows you to deploy and host your React app at no cost, with options to upgrade for additional features and usage limits.

Deploying Using the Surge CLI

To deploy your React application using the Surge CLI, follow these steps:

  1. Install the Surge CLI by running the following command in your terminal:
npm install -g surge

Enter fullscreen mode Exit fullscreen mode
  1. Navigate to the root directory of your React application.

  2. Run the following command to deploy your app:

surge

Enter fullscreen mode Exit fullscreen mode

The CLI will prompt you to log in or create a new account if you haven't already. Once you're logged in, the deployment process will begin, and you'll be prompted to provide a unique URL where your React application will be hosted.

Conclusion

In this article, we've explored eight different hosting services that offer free options for hosting React applications. Each hosting service has its own unique features and benefits, so it's important to choose the one that best suits your project's requirements. Whether you choose Vercel, Netlify, AWS Amplify, Firebase, GitHub Pages, GitLab Pages, Render, or Surge, you can rest assured that your React application will be deployed and hosted in a reliable and efficient manner.

Remember, deploying your React application is just the first step. It's important to regularly update and maintain your deployed app to ensure optimal performance and security. With the right hosting service and proper maintenance, your React application can reach a wider audience and make a lasting impact in the digital world. So, go ahead and choose the hosting service that fits your needs, and let your React app shine!

Top comments (0)