Run the forked Nitrogen codegen (located in /codegen):
yarn codegenCompile Kotlin code from the example app directory:
cd apps/example-native/android && ./gradlew :react-native-audio-browser:compileDebugKotlinThis is an alpha product - we do not care about breaking changes. Feel free to make any necessary API changes to improve the codebase.
- Uses Nitro Modules most functionality can be sync / blocking in nature
- For user facing callbacks always work with a param object
Callbacks work seamlessly across JS/native boundary:
- Functions can be passed directly as parameters (no registration needed)
- Reference counting system holds strong references safely
- Can be called multiple times and stored in memory
- Value-returning callbacks become Promise for thread safety
- Void callbacks (
() => void) stay synchronous on native side - Sync callbacks are synchronous but dangerous (must call from JS thread only)
- what-is-nitro.md - Introduction and core concepts
- hybrid-objects.md - Core HybridObject interface patterns and constraints
- sync-vs-async.md - When to use synchronous vs asynchronous calls
- performance-tips.md - Optimization best practices for Nitro modules
- nitrogen.md - Code generation tool usage and configuration
- how-to-build-a-nitro-module.md - Step-by-step module creation guide
- types/ - Complete TypeScript type reference for native interfaces
- typing-system.md - Complete type mapping table (JS ↔ C++/Swift/Kotlin) and type safety rules
- primitives.md - number/boolean/bigint → double/bool/int64_t with zero overhead
- strings.md - UTF-8 string handling across platforms
- arrays.md - T[] → std::vector/Array with Kotlin PrimitiveArray optimizations
- custom-structs.md - interface → native struct (eagerly converted, fully type-safe)
- custom-enums.md - TypeScript enum vs union types with compile-time hash optimization
- custom-types.md - JSIConverter for extending type system with custom C++ types
- optionals.md - T? → std::optional/Swift?/Kotlin? with boxing considerations
- variants.md - A | B | C → std::variant with runtime overhead (avoid if possible)
- callbacks.md - Functions with reference counting, events, sync vs async callbacks
- promises.md - Promise for async operations with thread switching
- dates.md - Date → time_point/Date/Instant with millisecond precision
- array-buffers.md - Zero-copy binary data with ownership and threading considerations
- typed-maps.md - Record<string, T> → Map/Dictionary (avoid: use arrays or structs instead)
- untyped-maps.md - AnyMap for JSON-like data (avoid: use typed structs instead)
- tuples.md - [A, B, C] → fixed-size compile-time known types (efficient vs variants)
- hybrid-objects.md - Passing HybridObject instances for interface-level abstraction
- configuration-nitro-json.md - Project configuration options
- errors.md - Common error patterns and solutions