React Native SDK for Koolbase — Backend as a Service built for mobile developers.
Auth, database, storage, realtime, functions, feature flags, remote config, version enforcement, code push, logic engine, analytics, and cloud messaging — one SDK, one initialize() call.
1. Create a free account at app.koolbase.com
2. Create a project and copy your public key from Environments
3. Add the SDK:
npm install koolbase-react-native
# or
yarn add koolbase-react-native4. Initialize at app startup:
import { Koolbase } from 'koolbase-react-native';
await Koolbase.initialize({
publicKey: 'pk_live_xxxx',
baseUrl: 'https://api.koolbase.com',
});That's it. Every feature below is now available via Koolbase.*.
// Register
await Koolbase.auth.register({ email: 'user@example.com', password: 'password' });
// Login
const session = await Koolbase.auth.login({ email: 'user@example.com', password: 'password' });
// Current user
const me = Koolbase.auth.currentUser;
// Logout
await Koolbase.auth.logout();
// Password reset
await Koolbase.auth.forgotPassword('user@example.com');// Insert
await Koolbase.db.insert('posts', { title: 'Hello', published: true });
// Query
const { records } = await Koolbase.db.query('posts', {
filters: { published: true },
limit: 10,
orderBy: 'created_at',
orderDesc: true,
});
// Populate related records
const { records } = await Koolbase.db.query('posts', {
populate: ['author_id:users'],
});
// Update / Delete
await Koolbase.db.update('record-id', { title: 'Updated' });
await Koolbase.db.delete('record-id');const { records, isFromCache } = await Koolbase.db.query('posts', { limit: 20 });
if (isFromCache) console.log('Served from local cache');
await Koolbase.db.syncPendingWrites();const { url } = await Koolbase.storage.upload({
bucket: 'avatars',
path: `user-${userId}.jpg`,
file: { uri: imageUri, name: 'avatar.jpg', type: 'image/jpeg' },
});
const downloadUrl = await Koolbase.storage.getDownloadUrl('avatars', `user-${userId}.jpg`);
await Koolbase.storage.delete('avatars', `user-${userId}.jpg`);const unsubscribe = Koolbase.realtime.subscribe('messages', (event) => {
if (event.type === 'created') setMessages(prev => [event.record, ...prev]);
});
// Cleanup
unsubscribe();if (Koolbase.isEnabled('new_checkout')) { ... }
const timeout = Koolbase.configNumber('timeout_seconds', 30);
const apiUrl = Koolbase.configString('api_url', 'https://api.myapp.com');
const dark = Koolbase.configBool('force_dark_mode', false);const result = Koolbase.checkVersion('1.2.3');
if (result.status === 'force_update') {
// block and show update screen
}await Koolbase.initialize({
publicKey: 'pk_live_xxxx',
baseUrl: 'https://api.koolbase.com',
codePushChannel: 'stable',
});
// Bundle values override Remote Config + Feature Flags transparently
const timeout = Koolbase.configNumber('api_timeout_ms', 3000);
// Directive handlers
Koolbase.codePush.onDirective('force_logout_all', (value) => {
if (value) Koolbase.auth.logout();
});
Koolbase.codePush.applyDirectives();// Define flows in your bundle's flows.json
// Execute from anywhere in your app
const result = Koolbase.executeFlow('on_checkout_tap', { plan: user.plan });
if (result.hasEvent) {
switch (result.eventName) {
case 'show_upgrade': navigation.navigate('Upgrade'); break;
case 'go_checkout': navigation.navigate('Checkout'); break;
}
}await Koolbase.initialize({
publicKey: 'pk_live_xxxx',
baseUrl: 'https://api.koolbase.com',
analyticsEnabled: true,
appVersion: '1.0.0',
});
// Custom events
Koolbase.analytics.track('purchase', { value: 1200, currency: 'GHS' });
// Screen views
Koolbase.analytics.screenView('checkout');
// User identity
Koolbase.analytics.identify(user.id);
Koolbase.analytics.setUserProperty('plan', 'pro');
// On logout
Koolbase.analytics.reset();await Koolbase.initialize({
publicKey: 'pk_live_xxxx',
baseUrl: 'https://api.koolbase.com',
messagingEnabled: true,
});
// Register FCM token (after obtaining from @react-native-firebase/messaging)
const fcmToken = await messaging().getToken();
await Koolbase.messaging.registerToken({
token: fcmToken,
platform: 'android', // or 'ios'
});
// Send to a specific device
await Koolbase.messaging.send({
to: deviceToken,
title: 'Your order is ready',
body: 'Pick up at counter 3',
data: { order_id: '123' },
});Full documentation at docs.koolbase.com
Manage your projects at app.koolbase.com
MIT