Lightweight client-side SDK for consuming Brave Ship feature flags and maintenance windows.
@farmart-tech/brave-client-sdk is the primary entry point for web and mobile applications to consume feature flags. It provides a simplified, read-only interface to the Brave Ship ecosystem, built on top of the performant Firebase adapter.
npm install @farmart-tech/brave-client-sdk
# or
pnpm add @farmart-tech/brave-client-sdk
firebase ^11.5.0@farmart-tech/brave-firebase-adapterimport { FeatureFlagReader } from '@farmart-tech/brave-client-sdk';
import { getFirestore } from 'firebase/firestore';
// 1. Initialize
const db = getFirestore(app);
const reader = new FeatureFlagReader({
db,
workspace: 'production',
userContext: { userId: 'current-user-id' }
});
// 2. Simple Check
const isEnabled = await reader.getFeatureFlag('new_feature').then(f => f?.getIsEnabled());
// 3. Detailed Evaluation (useful for debugging)
const details = await reader.getFeatureFlag('experimental_ui').then(f => f?.evaluateWithDetails());
console.log(`Enabled: ${details.isEnabled}. Reason: ${details.reason}`);
import { WindowReader } from '@farmart-tech/brave-client-sdk';
const windowReader = new WindowReader({ db, workspace: 'production' });
const config = await windowReader.getRemoteConfig('my_web_app');
if (config?.getIsInMaintenance('web')) {
// Show maintenance UI
}
Comprehensive API documentation is available at: https://fmt-feature-management.web.app/docs/client-sdk/
MIT © FarMart