Installation

Install the Kulu SDK in your project

NPM Installation

1. Install Package

npm install @kulu/sdk

2. Import and Initialize

import { Kulu } from '@kulu/sdk';

const kulu = new Kulu('YOUR_SDK_KEY', { 
  debug: true  // Shows reset button for testing (set false in production)
});

while (!kulu.resourcesLoaded) {
  await new Promise(resolve => setTimeout(resolve, 100));
}

await kulu.init('user-123', 'optional description');

3. Cleanup

kulu.destroy();

Complete Example

import { Kulu } from '@kulu/sdk';

// Initialize SDK
const initKulu = async (userId: string, description?: string) => {
  try {
    const kulu = new Kulu('YOUR_SDK_KEY', { 
      debug: true  // Shows reset button for testing
    });
    
    // Wait for resources
    while (!kulu.resourcesLoaded) {
      await new Promise(resolve => setTimeout(resolve, 100));
    }
    
    // Initialize user
    await kulu.init(userId, description);
    
    return kulu;
  } catch (error) {
    console.error('[Kulu] Initialization failed:', error);
    throw error;
  }
};

// Usage
const kuluInstance = await initKulu('user-123', 'optional description');

// Cleanup on logout
const handleLogout = () => {
  kuluInstance.destroy();
  // Your logout logic here
};

Next Steps

After installing the SDK, head over to the Setup Guide to integrate Kulu with your specific framework: