TypeScript SDK
The core TypeScript SDK works with any web framework. Framework-specific bindings (Angular, React, Vue) build on top of this.
Installation
Section titled “Installation”npm install @pulsabase/sdkimport { PulsaClient } from '@pulsabase/sdk';
const pb = new PulsaClient({ url: 'https://api.yourproject.pulsabase.io', clientKey: 'your-public-client-key', auth: { autoRefreshToken: true },});Query Examples
Section titled “Query Examples”// Fetch all usersconst users = await pb.from('users').find();
// Filtered queryconst adults = await pb.from('users') .where('age', { $gte: 18 }) .orderBy('name', 'asc') .limit(10) .find();
// Insertconst newUser = await pb.from('users').insert({ name: 'Alice', email: 'alice@example.com',});
// Updateawait pb.from('users') .where('id', userId) .update({ name: 'Alice Smith' });
// Deleteawait pb.from('users') .where('id', userId) .delete();// Sign upawait pb.auth.signUpWithPassword('user@example.com', 'securePassword');
// Sign inawait pb.auth.signInWithPassword('user@example.com', 'securePassword');
// Current userconst user = await pb.auth.getUser();Realtime
Section titled “Realtime”// Subscribe to table changespb.from('messages') .where('channel_id', channelId) .subscribe('INSERT', (message) => { console.log('New message:', message); });
// Custom channelsconst channel = pb.channel('typing-indicators');channel.on('typing', (data) => console.log(data));channel.send('typing', { userId: '123' });Storage
Section titled “Storage”// Upload a fileconst file = document.getElementById('file-input').files[0];await pb.storage.upload('user-123/profile.jpg', file);
// Get a presigned download URLconst url = await pb.storage.getDownloadUrl('user-123/profile.jpg');