Providers
- Data Synchronization: Manages connections to peers and the Jazz cloud
- Local Storage: Persists data locally between app sessions
- Schema Types: Provides APIs for the AccountSchema
- Authentication: Connects your authentication system to Jazz
Setting up the Provider
The provider accepts several configuration options:
Sign up for a free API key at dashboard.jazz.tools for higher limits or production use, or use your email address as a temporary key to get started quickly.
Provider Options
Sync Options
The sync property configures how your application connects to the Jazz network:
import { type SyncConfig } from "jazz-tools"; export const syncConfig: SyncConfig = { // Connection to Jazz Cloud or your own sync server peer: `wss://cloud.jazz.tools/?key=${apiKey}`, // When to sync: "always" (default), "never", or "signedUp" when: "always", };
When using sync: 'never' or sync: 'signedUp', like all other data, the user's account exists only on their device, and is deleted if the user uninstalls your app. On iOS though, login credentials are saved to the Keychain, and are not deleted when the app is uninstalled.
If a user reinstalls your app, Jazz will try to re-use these credentials to sign in to an account that no longer exists, which will cause errors.
To avoid this, consider using sync: 'always' for your iOS users, or let them know they'll need to remove their credentials from Keychain before reinstalling.
See Authentication States for more details on how the when property affects synchronization based on authentication state.
Account Schema
The AccountSchema property defines your application's account structure:
Additional Options
The provider accepts these additional options:
kvStoreExpoSecureStoreAdapter(default)
AccountSchemaAccount(default)
CryptoProviderPureJSCrypto(default) - Pure JavaScript crypto providerRNQuickCrypto- C++ accelerated crypto providerRNCrypto- Native crypto provider
Authentication
Jazz for Expo includes built-in local persistence using SQLite. Following Expo's best practices, the Expo implementation uses:
- Database Storage:
expo-sqlite- Expo's official SQLite module - Key-Value Storage:
expo-secure-store- Expo's secure storage system
Local persistence is enabled by default with no additional configuration required. Your data will automatically persist across app restarts.
RNCrypto
For accelerated crypto operations, you can use the RNCrypto crypto provider. It is the most performant crypto provider available for React Native and Expo.
To use it, install the following package:
pnpm add cojson-core-rn
Pay Attention: The version of cojson-core-rn must be the same as the version of jazz-tools.
"dependencies": { "cojson-core-rn": "x.x.x", # same version as jazz-tools "jazz-tools": "x.x.x" # same version as cojson-core-rn }
Then add the following to your provider:
Quick Crypto
For accelerated crypto operations, you can use the RNQuickCrypto crypto provider.
To use it, install the following Packages:
pnpm add react-native-quick-crypto@1.0.0-beta.18 react-native-nitro-modules react-native-fast-encoder
Then add the following to your provider:
For configuration, use the RNQC Expo config plugin:
{ "expo": { "plugins": [ [ "react-native-quick-crypto", { "sodiumEnabled": true } ] ] } }
Need Help?
If you have questions about configuring the Jazz Provider for your specific use case, join our Discord community for help.