Skip to main content
Redhat Developers  Logo
  • AI

    Get started with AI

    • Red Hat AI
      Accelerate the development and deployment of enterprise AI solutions.
    • AI learning hub
      Explore learning materials and tools, organized by task.
    • AI interactive demos
      Click through scenarios with Red Hat AI, including training LLMs and more.
    • AI/ML learning paths
      Expand your OpenShift AI knowledge using these learning resources.
    • AI quickstarts
      Focused AI use cases designed for fast deployment on Red Hat AI platforms.
    • No-cost AI training
      Foundational Red Hat AI training.

    Featured resources

    • OpenShift AI learning
    • Open source AI for developers
    • AI product application development
    • Open source-powered AI/ML for hybrid cloud
    • AI and Node.js cheat sheet

    Red Hat AI Factory with NVIDIA

    • Red Hat AI Factory with NVIDIA is a co-engineered, enterprise-grade AI solution for building, deploying, and managing AI at scale across hybrid cloud environments.
    • Explore the solution
  • Learn

    Self-guided

    • Documentation
      Find answers, get step-by-step guidance, and learn how to use Red Hat products.
    • Learning paths
      Explore curated walkthroughs for common development tasks.
    • Guided learning
      Receive custom learning paths powered by our AI assistant.
    • See all learning

    Hands-on

    • Developer Sandbox
      Spin up Red Hat's products and technologies without setup or configuration.
    • Interactive labs
      Learn by doing in these hands-on, browser-based experiences.
    • Interactive demos
      Click through product features in these guided tours.

    Browse by topic

    • AI/ML
    • Automation
    • Java
    • Kubernetes
    • Linux
    • See all topics

    Training & certifications

    • Courses and exams
    • Certifications
    • Skills assessments
    • Red Hat Academy
    • Learning subscription
    • Explore training
  • Build

    Get started

    • Red Hat build of Podman Desktop
      A downloadable, local development hub to experiment with our products and builds.
    • Developer Sandbox
      Spin up Red Hat's products and technologies without setup or configuration.

    Download products

    • Access product downloads to start building and testing right away.
    • Red Hat Enterprise Linux
    • Red Hat AI
    • Red Hat OpenShift
    • Red Hat Ansible Automation Platform
    • See all products

    Featured

    • Red Hat build of OpenJDK
    • Red Hat JBoss Enterprise Application Platform
    • Red Hat OpenShift Dev Spaces
    • Red Hat Developer Toolset

    References

    • E-books
    • Documentation
    • Cheat sheets
    • Architecture center
  • Community

    Get involved

    • Events
    • Live AI events
    • Red Hat Summit
    • Red Hat Accelerators
    • Community discussions

    Follow along

    • Articles & blogs
    • Developer newsletter
    • Videos
    • Github

    Get help

    • Customer service
    • Customer support
    • Regional contacts
    • Find a partner

    Join the Red Hat Developer program

    • Download Red Hat products and project builds, access support documentation, learning content, and more.
    • Explore the benefits

Deploy React applications to OpenShift

A guide on getting started with React apps on Red Hat OpenShift

April 11, 2023
Yashwanth Maheshwaram
Related topics:
CI/CDKubernetes
Related products:
Developer SandboxRed Hat OpenShift

React is an open-source JavaScript library for building user interfaces. It allows developers to create reusable UI components and efficiently update the view in response to changes in data. Red Hat OpenShift enables developers to build, deploy, run, and manage a wide variety of applications, including frontend and the ones made with React. React applications use the Node.js runtime to run the application.

This article will help you get started with ReactJS apps on OpenShift. You will learn how to:

  1. Deploy a basic React application from the ground up in the easiest way possible without having to deal with Kubernetes and a lot of other complications that come with it.
  2. Manage product and development environments for a React application.
  3. Add continuous deployment (CD) to your React application to automatically deploy updates to your repository.

Prerequisites

Node.js is required for your machine to be able to build and run React applications on your local machine. Install Node.js  via one of the following options: 

  • If you are using Red Hat Enterprise Linux (RHEL): https://access.redhat.com/products/nodejs
  • If you're using any other operating system: https://nodejs.org/en/

Create a sample React application

Create React App is a comfortable environment for learning React, and it is the best way to start building a new single-page application in React. It sets up your development environment so that you can use the latest JavaScript features, provides a nice developer experience, and optimizes your app for production.

You’ll need to have Node 14.0.0+ and npm 5.6+ on your machine. If you want to use a readily available example application, skip this step and move to the Deploy section.

To create a project, run:

npx create-react-app my-app
cd my-app
npm start

Publish your code to Git

Create a repository on GitHub or any other Git platform. If you want to use a readily available example application, copy the URL and move on to the next step: https://github.com/yashwanthm/react-openshift-example

The repository has a minor recommended change to the usual create-react-app approach to be able to run a production application.

You will need to run npm run start.development.local instead of npm start on your local machine. The rest remains the same.

Deploy your React application to the OpenShift sandbox

The Developer Sandbox for Red Hat OpenShift is a free-to-use OpenShift instance for you to experiment with OpenShift for your use cases. It's an excellent way to try running React applications on OpenShift. 

Follow these steps to start your sandbox instance and deploy your app:

  1. Create a Sandbox account using https://developers.redhat.com/developer-sandbox 
  2. Once you have the account, click on Start using your sandbox.
  3. Give it a few seconds and your sandbox instance will load up.
  4. On the left side menu, click on +Add.
  5. Select Import from Git.
  6. Specify your Git repo URL: https://github.com/yashwanthm/react-openshift-example 
  7. You will now be moved to the Topology view, and the app will start to deploy. Give it about a minute to finish deployment. While it’s deploying, you will be able to view the logs.
  8. Once it’s done deploying, you can click on the OpenURL button to see the UI of your React application running on OpenShift.

Congratulations! You now have a vanilla React application that runs on OpenShift without having to work with complex configurations that are needed. Read on for details on how to make a change and see the change go live for your application.

Fork and deploy your own repo

Now that you tried using the example repository, follow these steps to deploy your own repo:

  1. Fork https://github.com/yashwanthm/react-openshift-example or create your own repo.
  2. Copy the URL.
  3. Log in to the Developer Sandbox.
  4. Import from Git and use your repository to create an application.
  5. Access your application.
  6. Add CD.
  7. Make changes to the source App.js, commit, and push.
  8. See your changes get deployed automatically.

Add continuous deployment

Continuous deployment is a strategy in software development where code changes to an application are released automatically into the production environment. It speeds up time to market by eliminating the lag between coding and customer value. OpenShift enables developers to configure this using a few simple UI-based steps.

Now, let’s begin adding CD to the application we just created:

  1. Click on Actions.
  2. Select Edit <application name>.
  3. Check the Add pipeline checkbox. You can see the pipeline visualization if you’d like to understand the steps.
  4. Click Save.

Note: OpenShift Sandbox will suspend your application when it is idled but will bring back the pod up when there’s a hit to the URL, it takes a few seconds for the application to load. However, this will not be the case on your production OpenShift instance. 

Conclusion

OpenShift provides a simplified developer experience for running the applications on the cloud. Explore other popular activities for the sandbox:

  • Deploy a Java application on Kubernetes in minutes
  • Migrate and deploy Cloud Foundry applications to Kubernetes
  • Run the Canary Deployment pattern on Kubernetes
Last updated: September 19, 2023

Related Posts

  • Making environment variables accessible in front-end containers

  • Develop with Node.js in a container on Red Hat Enterprise Linux

  • Get started with reactive programming with creative Coderland tutorials

  • Building rootless containers for JavaScript front ends

Recent Posts

  • What GPU kernels mean for your distributed inference

  • Debugging image mode with Red Hat OpenShift 4.20: A practical guide

  • EvalHub: Because "looks good to me" isn't a benchmark

  • SQL Server HA on RHEL: Meet Pacemaker HA Agent v2 (tech preview)

  • Deploy with confidence: Continuous integration and continuous delivery for agentic AI

What’s up next?

Gitops Cookbook e-book tile card

Get useful recipes and examples for successful hands-on application development and deployment with GitOps in this free O'Reilly e-book.

Get the e-book
Red Hat Developers logo LinkedIn YouTube Twitter Facebook

Platforms

  • Red Hat AI
  • Red Hat Enterprise Linux
  • Red Hat OpenShift
  • Red Hat Ansible Automation Platform
  • See all products

Build

  • Developer Sandbox
  • Developer tools
  • Interactive tutorials
  • API catalog

Quicklinks

  • Learning resources
  • E-books
  • Cheat sheets
  • Blog
  • Events
  • Newsletter

Communicate

  • About us
  • Contact sales
  • Find a partner
  • Report a website issue
  • Site status dashboard
  • Report a security problem

RED HAT DEVELOPER

Build here. Go anywhere.

We serve the builders. The problem solvers who create careers with code.

Join us if you’re a developer, software engineer, web designer, front-end designer, UX designer, computer scientist, architect, tester, product manager, project manager or team lead.

Sign me up

Red Hat legal and privacy links

  • About Red Hat
  • Jobs
  • Events
  • Locations
  • Contact Red Hat
  • Red Hat Blog
  • Inclusion at Red Hat
  • Cool Stuff Store
  • Red Hat Summit
© 2026 Red Hat

Red Hat legal and privacy links

  • Privacy statement
  • Terms of use
  • All policies and guidelines
  • Digital accessibility

Chat Support

Please log in with your Red Hat account to access chat support.