@farmart-tech/brave-client-sdk
v3.0.0
Published
> Lightweight client-side SDK for consuming Brave Ship feature flags.
Readme
@farmart-tech/brave-client-sdk
Lightweight client-side SDK for consuming Brave Ship feature flags.
@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.
Features
- 📖 Read-Only Safety: Designed purely for consumption, preventing accidental modifications.
- ⚡ Real-time Updates: Reflect feature flag changes instantly without page reloads.
- 🛡️ Environment Isolation: Dedicated workspaces for production, staging, and development.
- 📦 Zero-Config Caching: Efficiently caches feature flags and segments locally.
- 🔍 Full Evaluation: Supports complex targeting and hashing-based rollouts out-of-the-box.
Installation
npm install @farmart-tech/brave-client-sdk
# or
pnpm add @farmart-tech/brave-client-sdkPeer Dependencies
firebase^11.5.0@farmart-tech/brave-firebase-adapter
Quick Start
Basic Feature Flag Evaluation
import { 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}`);Documentation
Comprehensive API documentation is available at: https://fmt-feature-management.web.app/docs/client-sdk/
License
MIT © FarMart
