Quick Start

Get Koolbase running in your app in under 5 minutes. Pick your platform to get started.

Choose your platform

In a hurry? Skip to a running app

Create a project, open the Designer, describe a screen, and press Run: the real app — your data, your sign-in — opens in a phone frame in about three minutes, and you can export the Flutter project whenever you want the code. The steps below are the same thing by hand.
1

Get your API key

Log in to your Koolbase dashboard, create a project, then create an environment. Copy the public API key:

pk_live_6e4abe2ffba691e8e44093d9

Environments

Each environment in a project gets its own public API key and scopes feature flags, remote config, and version policy — but not your data. For true dev/prod separation, use separate projects (see Projects & Environments). Never ship a production key in a development build.
2

Install the SDK

Add the Koolbase SDK to your pubspec.yaml:

pubspec.yaml
YAML
dependencies:
  flutter:
  sdk: flutter
  koolbase_flutter: ^12.14.0

Or install via CLI:

flutter pub add koolbase_flutter
3

Initialize the SDK

Call Koolbase.initialize() before runApp():

lib/main.dart
Dart
import 'package:flutter/material.dart';
import 'package:koolbase_flutter/koolbase_flutter.dart';

export const metadata = {
  title: 'Quick Start',
  description: 'Get Koolbase running in your app in under 5 minutes. Pick your platform to get started.',
}
void main() async {
  WidgetsFlutterBinding.ensureInitialized();
  await Koolbase.initialize(const KoolbaseConfig(
    publicKey: 'pk_live_your_key_here',
    baseUrl: 'https://api.koolbase.com',
  ));
  runApp(const MyApp());
}
4

Register and login users

lib/auth_screen.dart
Dart
// Register
final user = await Koolbase.auth.register(
  email: '[email protected]',
  password: 'securepassword',
);
// Login
final session = await Koolbase.auth.login(
  email: '[email protected]',
  password: 'securepassword',
);
// Current user
final me = Koolbase.auth.currentUser;
// Logout
await Koolbase.auth.logout();
5

Store and query data

lib/posts_repository.dart
Dart
// Insert — optimistic write, syncs when online
await Koolbase.db.insert(
  collection: 'posts',
  data: {'title': 'Hello Koolbase', 'published': true},
);
// Query — cache-first, returns instantly
final result = await Koolbase.db
    .collection('posts')
    .where('published', isEqualTo: true)
    .limit(20)
    .get();
if (result.isFromCache) {
  debugPrint('Served from local cache');
}
// Fetch related records in one query
final withAuthors = await Koolbase.db
    .collection('posts')
    .populate(['author_id:users'])
    .get();
// Update / delete a single record by id
await Koolbase.db.doc(id).update({'title': 'Updated'});
await Koolbase.db.doc(id).delete();
// Manually sync pending offline writes
await Koolbase.db.syncPendingWrites();

Offline-first

Queries return cached data instantly and refresh from the network in the background. Writes are saved locally first and synced automatically when online.
6

Upload files

lib/profile_screen.dart
Dart
// Upload
await Koolbase.storage.upload(
  bucket: 'avatars',
  path: 'user_${userId}.jpg',
  file: file,
);
// Get download URL
final url = await Koolbase.storage.getDownloadUrl(
  bucket: 'avatars',
  path: 'user_${userId}.jpg',
);
7

Feature flags and remote config

lib/home_screen.dart
Dart
// Feature flag
if (Koolbase.isEnabled('new_checkout')) {
  // show new checkout UI
}
// Remote config
final timeout = Koolbase.configInt('timeout_seconds', fallback: 30);
final apiUrl = Koolbase.configString('api_url', fallback: 'https://api.myapp.com');
final darkMode = Koolbase.configBool('force_dark_mode', fallback: false);

What's next