{"id":31274111,"url":"https://github.com/axnjr/react-native-rs","last_synced_at":"2026-04-11T19:05:54.254Z","repository":{"id":314705714,"uuid":"1056477215","full_name":"Axnjr/react-native-rs","owner":"Axnjr","description":"A high-performance React Native TurboModule bridge for integrating Rust code with heavy computation logic. This package provides a seamless way to offload CPU-intensive tasks to Rust while maintaining the React Native developer experience.","archived":false,"fork":false,"pushed_at":"2025-09-14T07:15:44.000Z","size":35,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-09-14T09:09:59.262Z","etag":null,"topics":["android","app","cpp","example","ios","java","react-native","rust","rust-lang","typescript"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Axnjr.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-09-14T07:09:29.000Z","updated_at":"2025-09-14T07:15:47.000Z","dependencies_parsed_at":"2025-09-14T09:10:02.281Z","dependency_job_id":"8a02cb2a-e6f6-40d5-98d2-c461517e9866","html_url":"https://github.com/Axnjr/react-native-rs","commit_stats":null,"previous_names":["axnjr/react-native-rs"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/Axnjr/react-native-rs","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Axnjr%2Freact-native-rs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Axnjr%2Freact-native-rs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Axnjr%2Freact-native-rs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Axnjr%2Freact-native-rs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Axnjr","download_url":"https://codeload.github.com/Axnjr/react-native-rs/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Axnjr%2Freact-native-rs/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":276662204,"owners_count":25682027,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-09-23T02:00:09.130Z","response_time":73,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["android","app","cpp","example","ios","java","react-native","rust","rust-lang","typescript"],"created_at":"2025-09-23T22:36:34.869Z","updated_at":"2025-09-23T22:36:38.935Z","avatar_url":"https://github.com/Axnjr.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# react-native-rs\n\nA high-performance React Native TurboModule bridge for integrating Rust code with heavy computation logic. This package provides a seamless way to offload CPU-intensive tasks to Rust while maintaining the React Native developer experience.\n\n## ✨ Features\n\n- 🚀 **High Performance**: Leverage Rust's zero-cost abstractions for heavy computations\n- 🔄 **Async/Await Support**: Non-blocking operations with proper React Native threading\n- 🎯 **Type Safety**: Automatic TypeScript type generation from Rust structs\n- 📱 **Cross-Platform**: Seamless iOS and Android support\n- 🛠 **Easy Integration**: Simple command-based API\n- 🔧 **Production Ready**: Robust error handling and panic recovery\n- 📦 **TurboModule**: Built on React Native's new architecture (backwards compatible)\n\n## 🚀 Quick Start\n\n### Installation\n\n```bash\nnpm install react-native-rs\n# or\nyarn add react-native-rs\n```\n\n### iOS Setup\n\n```bash\ncd ios \u0026\u0026 pod install\n```\n\n### Android Setup\n\nNo additional setup required - auto-linking handles everything!\n\n### Build Rust Code\n\n```bash\n# Install Rust prerequisites (first time only)\nyarn setup-rust\n\n# Build Rust libraries for all platforms\nyarn build-rust\n```\n\n## 📖 Usage\n\n### Basic Example\n\n```typescript\nimport { RustBridge } from 'react-native-rs';\n\n// Execute heavy computation in Rust\nconst result = await RustBridge.execute({\n  cmd: 'fibonacci',\n  params: { n: 40 }\n});\n\nconsole.log('Fibonacci result:', result);\n```\n\n### Advanced Example\n\n```typescript\nimport { RustBridge } from 'react-native-rs';\n\n// Image processing example\nconst processedImage = await RustBridge.execute({\n  cmd: 'image_filter',\n  params: {\n    data: base64ImageData,\n    filter: 'gaussian_blur',\n    radius: 5.0\n  }\n});\n\n// Cryptographic operations\nconst signature = await RustBridge.execute({\n  cmd: 'sign_data',\n  params: {\n    data: 'message to sign',\n    private_key: privateKeyHex\n  }\n});\n```\n\n## 🏗 Architecture\n\n### Command Pattern\n\nAll operations use a command-based architecture:\n\n```rust\n#[derive(Serialize, Deserialize, TS)]\n#[ts(export)]\npub enum Command {\n    Fibonacci(FibonacciInput),\n    ImageFilter(ImageFilterInput),\n    SignData(SignDataInput),\n    // Add your custom commands here\n}\n```\n\n### Type Safety\n\nTypes are automatically generated from Rust to TypeScript:\n\n```rust\n#[derive(Serialize, Deserialize, TS)]\n#[ts(export)]\npub struct FibonacciInput {\n    pub n: u32,\n}\n\n#[derive(Serialize, Deserialize, TS)]\n#[ts(export)]\npub struct FibonacciResult {\n    pub value: u64,\n    pub computation_time_ms: u64,\n}\n```\n\n### Error Handling\n\nRobust error handling with panic recovery:\n\n```typescript\ntry {\n  const result = await RustBridge.execute(command);\n  // Handle success\n} catch (error) {\n  // Handle Rust panics and errors gracefully\n  console.error('Rust execution failed:', error);\n}\n```\n\n## 🛠 Development\n\n### Adding New Commands\n\n1. **Define Rust types:**\n\n```rust\n// rust/src/fibonacci.rs\n#[derive(Serialize, Deserialize, TS)]\n#[ts(export)]\npub struct FibonacciInput {\n    pub n: u32,\n}\n\npub async fn fibonacci(input: \u0026FibonacciInput) -\u003e Result\u003cu64, eyre::Error\u003e {\n    // Your implementation here\n}\n```\n\n2. **Add to command enum:**\n\n```rust\n// rust/src/cmd.rs\n#[derive(Serialize, Deserialize, TS)]\n#[ts(export)]\npub enum Command {\n    Fibonacci(FibonacciInput),\n    // ... other commands\n}\n```\n\n3. **Generate TypeScript types:**\n\n```bash\nyarn generate-types\n```\n\n4. **Use in React Native:**\n\n```typescript\nconst result = await RustBridge.execute({\n  cmd: 'fibonacci',\n  params: { n: 40 }\n});\n```\n\n### Building\n\n```bash\n# Build everything\nyarn build-all\n\n# Build only Rust\nyarn build-rust\n\n# Build only TypeScript\nyarn build\n```\n\n### Testing\n\n```bash\n# Run TypeScript tests\nyarn test\n\n# Check type synchronization\nyarn check-types\n```\n\n## 📱 Example App\n\nCheck out the `example/` directory for a complete React Native app showcasing various use cases:\n\n- Fibonacci computation\n- Image processing\n- Cryptographic operations\n- Real-time data processing\n\n```bash\nyarn example:ios\n# or\nyarn example:android\n```\n\n## 🏗 Build System\n\n### iOS\n\n- Uses `cargo-pod` for seamless CocoaPods integration\n- Builds universal frameworks for device and simulator\n- Supports both old and new React Native architectures\n\n### Android\n\n- Uses `cargo-ndk` for Android NDK integration\n- Supports multiple architectures (arm64-v8a, x86_64)\n- CMake integration for native library linking\n\n## 🤝 Contributing\n\nWe welcome contributions! Please see [CONTRIBUTING.md](CONTRIBUTING.md) for guidelines.\n\n### Development Setup\n\n1. Clone the repository\n2. Install dependencies: `yarn install`\n3. Set up Rust: `yarn setup-rust`\n4. Build everything: `yarn build-all`\n5. Run example: `yarn example:ios`\n\n## 📄 License\n\nMIT License - see [LICENSE](LICENSE) for details.\n\n## 🙏 Acknowledgments\n\nInspired by production React Native + Rust integrations and the need for high-performance mobile computing.\n\n---\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faxnjr%2Freact-native-rs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Faxnjr%2Freact-native-rs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faxnjr%2Freact-native-rs/lists"}