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-scriptsinpackage.json, with scriptsstart,buildandtestpublic/index.htmlandsrc/index.jsorsrc/index.tsx- Environment variables named
REACT_APP_* - An
ejected project instead hasconfig/andscripts/folders with webpack config
Where things usually live
- src/index.js
- Mounts
<App />into#rootand 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
src/index.js, for providers and global importssrc/App.js, for routes and layoutpackage.jsonproxyfield orsrc/setupProxy.js, to see where API calls go in development
How a request moves through the code
react-scripts startbundlessrc/index.jswith a hidden webpack config.index.jsrenders<App />into the#rootelement frompublic/index.html.- Routes, usually React Router, choose a screen component.
- Components fetch data from the backend, often through
fetchor 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-scriptsto 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_*, movingindex.htmlto the root and replacingsetupProxy.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.