Skip to content

How to understand a Create React App codebase

Create React App hid its build configuration behind `react-scripts`, so most CRA projects are plain React code in `src/` with very little config. The React team deprecated CRA in February 2025, so many of these codebases are legacy and are being migrated to Vite or a framework.

How to tell it's Create React App

  • react-scripts in package.json, with scripts start, build and test
  • public/index.html and src/index.js or src/index.tsx
  • Environment variables named REACT_APP_*
  • An ejected project instead has config/ and scripts/ folders with webpack config

Where things usually live

src/index.js
Mounts <App /> into #root and often registers a service worker.
src/App.js
Top-level component, often holding routes.
src/components/
UI components.
src/setupProxy.js
Optional dev-server proxy rules for API calls.
src/setupTests.js
Jest setup, usually importing Testing Library matchers.
public/
Static files copied as-is, including index.html.

Conventions, not rules. Real projects rename and move things, so confirm against the repository.

Where to start reading

  1. src/index.js, for providers and global imports
  2. src/App.js, for routes and layout
  3. package.json proxy field or src/setupProxy.js, to see where API calls go in development

How a request moves through the code

  1. 1react-scripts start bundles src/index.js with a hidden webpack config.
  2. 2index.js renders <App /> into the #root element from public/index.html.
  3. 3Routes, usually React Router, choose a screen component.
  4. 4Components fetch data from the backend, often through fetch or Axios helpers.

Questions to ask about the repository

  • Has this project been ejected, and if so what was customised in config/?
  • What would break if we migrated the build from react-scripts to Vite?
  • Which REACT_APP_* variables does the app use, and where?
  • Where are API calls made, and is there a shared client?

What trips people up

  • REACT_APP_* variables are baked into the bundle at build time, so changing them needs a rebuild and they are never secret.
  • Migrating to Vite means renaming variables to VITE_*, moving index.html to the root and replacing setupProxy.js; search for all three before estimating the work.
  • Old CRA projects often pin old React and React Router versions, so check versions before applying modern docs.