Skip to main content

Installation

Learn how to install and set up Resync for your platform.

Choose Your Platform​

Select the SDK that matches your technology stack:


JavaScript SDK​

Requirements​

  • Node.js v16 or higher
  • npm or yarn package manager

Install via npm​

npm install resync-javascript

Install via yarn​

yarn add resync-javascript

Initialise​

import Resync from 'resync-javascript';

await Resync.init({
key: process.env.RESYNC_API_KEY,
appId: parseInt(process.env.RESYNC_APP_ID),
storage: localStorage,
environment: 'production',
});

React Native SDK​

Requirements​

  • React Native v0.64 or higher
  • Node.js v16 or higher
  • npm or yarn package manager

Install the SDK​

npm install resync-react-native

Or with yarn:

yarn add resync-react-native

Install Peer Dependencies​

Resync React Native requires the following peer dependencies:

npm install react-native-svg lucide-react-native @react-native-async-storage/async-storage

Or with yarn:

yarn add react-native-svg lucide-react-native @react-native-async-storage/async-storage

iOS Setup (React Native)​

If you're using React Native (not Expo), install iOS pods:

cd ios && pod install && cd ..

Expo Setup​

Resync works seamlessly with Expo. No additional configuration needed!

npx expo install resync-react-native react-native-svg @react-native-async-storage/async-storage

Get Your Credentials​

Before initializing Resync, you'll need:

  1. API Key - Your unique API authentication key
  2. App ID - Your application identifier

Get Credentials from Dashboard​

  1. Log in to Resync Dashboard
  2. Navigate to Settings → API Keys
  3. Copy your API key
  4. Note your Project or App ID (shown in the dashboard URL or Settings)

Initialization​

JavaScript Example​

import Resync from 'resync-javascript';

// Initialize as early as possible in your app
await Resync.init({
key: process.env.RESYNC_API_KEY,
appId: 7,
callback: () => {
console.log('Resync loaded successfully');
},
storage: someStorage, // Use localStorage for web
environment: 'production', // 'sandbox' or 'production'
});

React Native Example​

import Resync from 'resync-react-native';
import AsyncStorage from '@react-native-async-storage/async-storage';

// Initialize in App.tsx or index file
Resync.init({
key: process.env.RESYNC_API_KEY,
appId: 7,
callback: () => {
console.log('Resync loaded successfully');
},
storage: AsyncStorage, // Use any compatible storage for React Native
environment: 'production',
});

export default function App() {
return (
// Your app components
);
}

Environment Configuration​

Resync supports two environments:

Production​

environment: 'production'
  • Cache TTL: 6 hours
  • Optimized for performance
  • Use for live apps

Sandbox​

environment: 'sandbox'
  • Cache TTL: 0 (no caching)
  • Always fetches fresh data
  • Use for development and testing

Verify Setup​

Test your installation:

// After initialization
const config = Resync.getConfig('TEST_CONFIG');
console.log('Config:', config);

If you see output without errors, you're all set! 🎉


Troubleshooting​

"Module not found" error​

Make sure you've installed the package:

npm install resync-javascript
# or
npm install resync-react-native

"Storage is required" error​

Provide a valid storage object:

  • Web: Use localStorage
  • React Native: Use AsyncStorage, MMKV or any compatible storage

Peer dependency warnings (React Native)​

Install all required peer dependencies:

npm install react-native-svg lucide-react-native @react-native-async-storage/async-storage

Pods installation failed (iOS)​

Try cleaning and reinstalling:

cd ios
rm -rf Pods Podfile.lock
pod install
cd ..

Next Steps​

Need Help?​