Documentation Index
Fetch the complete documentation index at: https://mintlify.com/amark/gun/llms.txt
Use this file to discover all available pages before exploring further.
React Native Integration
GUN works with React Native, but requires additional setup for crypto polyfills and platform-specific storage adapters.Installation
WebCrypto Polyfill
GUN’s SEA (Security, Encryption, Authorization) requires the WebCrypto API. Here’s how to polyfill it:AsyncStorage Adapter
For persistent storage in React Native, create an AsyncStorage adapter:Complete Setup Example
Here’s a complete React Native app with GUN integration:App.js
Demo Component with GUN
Platform-Specific Considerations
iOS
- WebCrypto polyfill is required for SEA functionality
- AsyncStorage is deprecated - consider using
@react-native-async-storage/async-storage
Android
- Ensure network permissions are set in
AndroidManifest.xml - Test with release builds as debug mode may have different performance characteristics
Common Issues
Buffer/Crypto Errors
Make sure shims are imported before any GUN imports:Storage Not Persisting
Verify that the AsyncStorage adapter is registered before creating GUN instances.Best Practices
- Load polyfills early: Import shims at the app entry point
- Use AsyncStorage adapter: For offline-first functionality
- Test on devices: Simulators may not accurately represent performance
- Handle permissions: Request necessary permissions for network access
Next Steps
- Learn about user authentication with SEA
- Explore offline-first patterns
- Set up relay peers for synchronization