React Native SDK for Koolbase — auth, database, storage, realtime, feature flags, and functions in one package.
npm install koolbase-react-native
# or
yarn add koolbase-react-nativeimport { Koolbase } from 'koolbase-react-native';
await Koolbase.initialize({
publicKey: 'pk_live_your_key_here',
baseUrl: 'https://api.koolbase.com',
});await Koolbase.auth.register({ email: 'user@example.com', password: 'password' });
await Koolbase.auth.login({ email: 'user@example.com', password: 'password' });
const user = Koolbase.auth.currentUser;
await Koolbase.auth.logout();await Koolbase.db.insert('posts', { title: 'Hello', published: true });
const { records } = await Koolbase.db.query('posts', { filters: { published: true }, limit: 10 });
await Koolbase.db.update('record-id', { title: 'Updated' });
await Koolbase.db.delete('record-id');
// Populate related records
const { records } = await Koolbase.db.query('posts', {
populate: ['author_id:users'],
});const { url } = await Koolbase.storage.upload({
bucket: 'avatars',
path: 'user-123.jpg',
file: { uri: fileUri, name: 'avatar.jpg', type: 'image/jpeg' },
});if (Koolbase.isEnabled('new_checkout')) {
// show new checkout
}
const timeout = Koolbase.configNumber('timeout_seconds', 30);const result = await Koolbase.functions.invoke('send-email', {
email: 'user@example.com',
});Full docs at docs.koolbase.com
MIT
Koolbase v1.1.0 ships with offline-first support powered by AsyncStorage.
// Cache-first reads — returns local data instantly
const { records, isFromCache } = await Koolbase.db.query('posts', {
filters: { published: true },
limit: 20,
});
if (isFromCache) {
console.log('Served from local cache');
}
// Optimistic writes — saved locally first, synced when online
await Koolbase.db.insert('posts', { title: 'Hello', published: true });
// Manual sync
await Koolbase.db.syncPendingWrites();The SDK automatically syncs pending writes when network connectivity is restored.
import { Koolbase, FunctionRuntime } from 'koolbase-react-native';
// Deploy a TypeScript function (Deno)
await Koolbase.functions.deploy({
name: 'send-email',
code: `
export async function handler(ctx) {
return { ok: true };
}
`,
runtime: FunctionRuntime.Deno,
});
// Deploy a Dart function
await Koolbase.functions.deploy({
name: 'process-order',
code: dartCode,
runtime: FunctionRuntime.Dart,
});
// Invoke a function
const result = await Koolbase.functions.invoke('send-email', {
to: 'user@example.com',
});