In a real app
In a project, Codegen is configured in package.json under codegenConfig: a name, a type (modules, components, or all), a jsSrcsDir, and per-platform options such as javaPackageName or modulesProvider. An app can declare its own config for local modules too. Generated files land under ios/build/generated/ios and android/app/build/generated/source/codegen; they are not committed, and a .gitignore that lets them through is a warning sign.
The frequent errors are spec parsing errors, not logic errors. Codegen accepts only a subset of TypeScript: no arbitrary unions, no generics, Promise<T> with a serializable T. An import type pointing outside jsSrcsDir passes lint but fails the native build, often with a message about a generated file nobody wrote. When pod install breaks on a third-party library after an upgrade, it is often that library’s spec no longer matching the bundled Codegen version.
To debug, npx react-native codegen (or the generateCodegenArtifactsFromSchema Gradle task) regenerates without building the whole app. Nitro Modules ships its own generator, Nitrogen, which follows the same idea but reads richer TypeScript interfaces.
Related terms
Turbo Modules
Native modules in the New Architecture: a TypeScript spec, code generated by Codegen, and lazy loading through JSI.
Fabric
The New Architecture renderer: a C++ core shared by iOS and Android that computes layout synchronously.
New Architecture
The rewrite of React Native internals (Fabric, Turbo Modules, JSI), on by default since 0.76 and the only architecture since 0.82.
Nitro Modules
Margelo’s framework for writing native modules in Swift, Kotlin, or C++ exposed to JavaScript through JSI, with bindings generated from TypeScript.