Skip to content

Guide · Open source

How to use create-react-app: setup, commands and what to know

Updated · written with AI from the project's own documentation and checked against our catalogue data

Create React App is a command-line tool that generates a React project with webpack, Babel and ESLint already set up, so you can start writing components right away. This guide shows you how to create an app, run it locally, build it for production and decide whether it fits your project. Read the deprecation note first, because the project is no longer recommended for new production apps.

Create React Appreact/create-react-app · ★ 103k · MIT

Quick start

  1. 1Confirm Node.js. Make sure Node.js 14.0.0 or later is installed on your machine.
  2. 2Create the app. Run npx create-react-app my-app to generate the project in a folder called my-app.
  3. 3Enter the folder. Change into the new directory with cd my-app.
  4. 4Start the dev server. Run npm start and open http://localhost:3000 in your browser.
  5. 5Build for production. When you are ready to deploy, run npm run build to create a minified bundle in the build folder.

Check the deprecation status before you start

The README marks Create React App as deprecated and in long-term stasis. It recommends migrating to one of the React frameworks documented on react.dev for new production apps.

It still has value if you are following an older tutorial, learning React basics, or maintaining a project already built with it.

Install Node.js and check your version

You need Node 14.0.0 or later on your local development machine. The README recommends the latest LTS version. You can use nvm (macOS/Linux) or nvm-windows to switch Node versions between projects.

Node is not required on the server when you deploy.

Create a new app with one command

Run npx create-react-app my-app. This creates a directory called my-app in the current folder, generates the project structure and installs its dependencies. npx comes with npm 5.2 and higher.

The README also lists npm init react-app my-app (npm 6+) and yarn create react-app my-app (Yarn 0.25+) as alternatives.

If you previously installed create-react-app globally, the README recommends uninstalling it with npm uninstall -g create-react-app so npx always uses the latest version.

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

Run the development server

Run npm start (or yarn start) to launch the app in development mode. Then open http://localhost:3000 in your browser. The page reloads automatically when you change code, and build errors and lint warnings appear in the console.

npm start

Know the built-in commands

Inside your project, three commands cover most daily work. npm test runs the test watcher in interactive mode and by default runs tests for files changed since the last commit. npm run build creates a production build in the build folder.

  • npm start: development server with live reload
  • npm test: interactive test watcher
  • npm run build: minified production bundle with hashed filenames, ready to deploy
npm test npm run build

Understand the project structure and limits

The generated project includes a public folder with index.html and manifest.json, and a src folder with App.js, index.js, App.css and App.test.js, among other files. There is no configuration to write at the start.

The tradeoff is that the tools are preconfigured to work one way. If you need heavy customization you can eject, but then you must maintain the configuration yourself. For server-rendered or multi-page sites, the README points to nwb or Neutrino.

  • Included: React, JSX, ES6, TypeScript and Flow syntax support
  • Included: autoprefixed CSS, a unit test runner with coverage, and a live dev server
  • Included: a production build with hashes and sourcemaps
  • Included: an opt-in service worker and web app manifest for Progressive Web App criteria

What people use it for

  • Following an existing React tutorial that uses Create React App
  • Learning React components without configuring webpack or Babel
  • Maintaining an existing project that was already built with Create React App
  • Creating a quick single-page React prototype to explore ideas

Frequently asked questions

Is create-react-app still recommended?

No. The README says the project is deprecated and in long-term stasis, and recommends migrating to a React framework listed on react.dev for new production apps. It is still useful for learning and for older tutorials.

What are the requirements for create-react-app?

You need Node.js 14.0.0 or later on your local machine. The README recommends the latest LTS version. Create React App works on macOS, Windows and Linux.

Is create-react-app free?

Create React App is released under the MIT licence, which is an open-source licence. The source does not discuss pricing beyond that.

What are the alternatives to create-react-app?

The README's comparison list includes Vite, Next.js, Remix and nwb. For single-page apps, the README points to React frameworks on react.dev, and for server-rendered or multi-page sites it suggests nwb or Neutrino.

How do I run create-react-app?

Run npx create-react-app my-app, then cd my-app and npm start. Open http://localhost:3000 to see the app.

Can I customise the webpack configuration?

You can eject to a custom setup at any time, which moves the configuration and build dependencies into your project. You will then need to maintain that configuration yourself.

New agent skills, repos and AI tools — every week

The best new skills and open-source projects, the fastest-growing repos, and one free prompt. Five minutes to read. Unsubscribe anytime.

Our verdict

Create React App suits people following older React tutorials, learning React basics, or maintaining an existing project built with it. Choose a framework from react.dev, or a tool like Vite, for new production apps, server-rendered sites or projects that need heavy build customisation.

Install options & downloads