CodeVetter · Repo Unpack · System map
react/react-native
Yarn v1 workspaces monorepo rooted at package.json (@react-native/monorepo). The flagship artifact is packages/react-native, which ships the JS public API (index.js lazy getters), the C++ core (ReactCommon), the Android runtime (ReactAndroid, Gradle), and the Apple runtime (React + ReactApple, CocoaPods podspecs + SwiftPM Package.swift). Tooling packages around it provide the dev server CLI (@react-native/community-cli-plugin), CDP inspector proxy (@react-native/dev-middleware), Metro defaults (@react-native/metro-config), codegen (@react-native/codegen), and the Gradle plugin. Repo-local test surfaces live in packages/rn-tester, private/helloworld, and private/react-native-fantom. CI is orchestrated by .github/workflows/test-all.yml.
- Root package.json is private workspace root '@react-native/monorepo' v1000.0.0, pinned to yarn@1.22.22, with workspaces packages/*, packages/react-native-test-library/* and private/* (excluding private/helloworld).
- The published `react-native` package lives in packages/react-native: bin 'react-native' -> cli.js, main ./index.js, and an exports map exposing ./setup-env, ./react-private-interface, ./unstable-internals-do-not-use, ./asset-registry, deep ./Libraries/* imports, and conditional 'types' -> ./types_generated/index.d.ts.
- JavaScript source is split between the legacy location packages/react-native/Libraries and the newer packages/react-native/src/private; AGENTS.md documents the gradual migration, and index.js imports from both trees.
- The shared C++ core lives in packages/react-native/ReactCommon and includes react/renderer (Fabric: uimanager, mounting, scheduler, runtimescheduler, components, dom), react/nativemodule (TurboModules), jsi, jsiexecutor, hermes, yoga (layout engine), jsinspector-modern (CDP stack), callinvoker and cxxreact.
- The Android runtime is packages/react-native/ReactAndroid (Kotlin/Java/JNI): bridgeless entry is com.facebook.react.runtime.ReactHostImpl (manages a ReactInstance with Bolts Tasks); the legacy ReactNativeHost->ReactInstanceManager path still exists but is @Deprecated and logged as LegacyArchitecture.
- The iOS runtime is packages/react-native/React and ReactApple (Objective-C++/Swift); RCTReactNativeFactory is the modern factory entry (initWithDelegate:releaseLevel: sets feature flags, creates RCTRootViewFactory, installs the third-party Fabric components provider), with RCTAppDelegate/RCTDefaultReactNativeFactoryDelegate as app-level glue.
- iOS distribution is via CocoaPods podspecs (React.podspec, React-Core.podspec, React-Core-prebuilt.podspec, React-Fabric.podspec) plus third-party-podspecs, and SwiftPM via packages/react-native/Package.swift with scripts under scripts/spm.
- Android build is Gradle: root build.gradle.kts/settings.gradle.kts plus packages/gradle-plugin (react-native-gradle-plugin with tasks like GenerateCodegenArtifactsTask, GenerateCodegenSchemaTask, BundleHermesCTask, and a settings-plugin ReactSettingsPlugin).
- The dev-toolchain packages are @react-native/community-cli-plugin (start/bundle/codegen/spm commands), @react-native/dev-middleware (createDevMiddleware + InspectorProxy CDP WebSocket proxy), @react-native/metro-config (getDefaultConfig), @react-native/react-native-babel-preset / babel-transformer, and @react-native/debugger-frontend + @react-native/debugger-shell for React Native DevTools.
- Repo-facing apps and runners: packages/rn-tester ('@react-native/tester' — RNTester showcase app with Podfile, RNTesterUnitTests, IntegrationTests), private/helloworld (minimal app, excluded from workspaces), and private/react-native-fantom (headless Hermes/Fabric test runner).
- Primary commands from repo root: yarn test (jest), yarn fantom (scripts/fantom.sh), yarn lint (eslint --max-warnings 0), yarn flow-check, yarn format[-lang], yarn build (scripts/build/build.js compiles packages' src->dist via Babel + flow-api-translator), yarn build-android (./gradlew :packages:react-native:ReactAndroid:build), yarn test-ios (scripts/objc-test.sh).
- Release machinery lives in scripts/releases (set-version.js, prepare-ios-prebuilds.js, dotslash asset upload) and GitHub workflows publish-npm.yml / create-release.yml; test-all.yml's build_npm_package job produces the tarball gating publish.
- Public API surface is snapshotted in three places: ReactNativeApi.d.ts (generated TS types snapshot), packages/react-native/ReactAndroid/api/ReactAndroid.api (Kotlin public API), and scripts/cxx-api/api-snapshots (C++ API parsed by python -m scripts.cxx-api.parser).