Back to Docs
SDK Documentation
Official SDKs and framework adapters with clear production support, fallback behavior, and cache guarantees for every supported runtime.
Production Support Matrix
Every GA SDK supports authenticated evaluation and targeting context. Fallback behavior is explicit so production teams can decide what happens when the flag API is unreachable.
| SDK | Status | Runtime | Cache | Fallback contract |
|---|---|---|---|---|
| JavaScript / TypeScript | GA | Node.js 18+ | Configurable in-memory TTL cache | Returns configured defaultValue with ERROR reason |
| React | GA | React 18+ or 19+ | Keeps last-known flags between refreshes | Uses initial or last-known flags; unknown flags default to false |
| Vue | GA | Vue 3.3+ | Keeps last-known flags between refreshes | Uses initial or last-known flags; default values for missing flags |
| Angular | GA | Angular 17+ | Keeps last-known flags between refreshes | getFlag and pipe can return caller-provided defaults |
| Go | GA | Go 1.21+ | Thread-safe in-memory TTL cache | Returns errors so callers choose fallback behavior |
| Python | GA | Python 3.9+ | Thread-safe in-memory TTL cache | Returns configured default_value with ERROR reason |
| Ruby | GA | Ruby 3.0+ | Mutex-backed in-memory TTL cache | Raises typed exceptions so callers choose fallback behavior |
| Rust | GA | Rust stable | Thread-safe in-memory TTL cache | Returns Result so callers choose fallback behavior |
| Java | GA | Java 11+ | ConcurrentHashMap-backed TTL cache | isEnabled returns false on error; evaluate throws |
| Terraform | Preview | Terraform 1.0+ | Not applicable | Not applicable for runtime evaluation |
JavaScript / TypeScript
@buildrflags/sdkGAServer-side and backend evaluation
Full TypeScript typesConfigurable cache TTLTimeout controlsSafe default fallback
Installation
npm install @buildrflags/sdkInitialization
init.ts
import { createClient } from '@buildrflags/sdk';
const client = createClient({
apiKey: 'bf_production_xxxxxxxx',
});Evaluate a Flag
evaluate.ts
const enabled = await client.isEnabled('new-feature', {
userId: 'user-123',
attributes: { plan: 'pro' },
});
if (enabled) {
// Show the new feature
}Get All Flags
all-flags.ts
const results = await client.evaluateAll(
['feature-a', 'feature-b'],
);
for (const [key, result] of results) {
console.log(key, result.enabled);
}React
@buildrflags/reactGAClient-side UI rendering
React hooksSSR initial flagsAuto-refresh pollingLast-known fallback
Installation
npm install @buildrflags/reactInitialization
init.ts
import { BuildrFlagsProvider } from '@buildrflags/react';
export function App() {
return (
<BuildrFlagsProvider apiKey="bf_production_xxxxxxxx">
<Dashboard />
</BuildrFlagsProvider>
);
}Evaluate a Flag
evaluate.ts
import { useFlag } from '@buildrflags/react';
function Dashboard() {
const { enabled, isLoading } = useFlag('new-feature');
if (isLoading) return null;
return enabled ? <NewFeature /> : <CurrentFeature />;
}Get All Flags
all-flags.ts
import { useFlags } from '@buildrflags/react';
function DebugPanel() {
const { flags, error, refresh } = useFlags();
return <button onClick={refresh}>{Object.keys(flags).length} flags</button>;
}Vue
@buildrflags/vueGAVue and Nuxt UI rendering
ComposablesSSR initial flagsAuto-refresh pollingTypeScript types
Installation
npm install @buildrflags/vueInitialization
init.ts
import { createApp } from 'vue';
import { BuildrFlagsPlugin } from '@buildrflags/vue';
createApp(App).use(BuildrFlagsPlugin, {
apiKey: 'bf_production_xxxxxxxx',
});Evaluate a Flag
evaluate.ts
<script setup lang="ts">
import { useFlag } from '@buildrflags/vue';
const { enabled, isLoading } = useFlag('new-feature');
</script>Get All Flags
all-flags.ts
<script setup lang="ts">
import { useFlags } from '@buildrflags/vue';
const { flags, error, refresh } = useFlags();
</script>Angular
@buildrflags/angularGAAngular apps and dashboards
Structural directiveAsync pipeService APISSR initial flags
Installation
npm install @buildrflags/angularInitialization
init.ts
import { BuildrFlagsModule } from '@buildrflags/angular';
@NgModule({
imports: [
BuildrFlagsModule.forRoot({
apiKey: 'bf_production_xxxxxxxx',
}),
],
})
export class AppModule {}Evaluate a Flag
evaluate.ts
<div *ifFlag="'new-feature'; else currentFeature">
New feature
</div>
<ng-template #currentFeature>Current feature</ng-template>Get All Flags
all-flags.ts
constructor(private flags: BuildrFlagsService) {}
async refreshFlags() {
await this.flags.refresh();
console.log(this.flags.snapshot.flags);
}Go
github.com/buildrlab/buildrflags-goGABackend services and workers
Zero dependencies (stdlib only)Thread-safe cacheContext-awareExplicit errors
Installation
go get github.com/buildrlab/buildrflags-goInitialization
init.go
import buildrflags "github.com/buildrlab/buildrflags-go"
client, err := buildrflags.NewClient("bf_production_xxxxxxxx")
if err != nil {
log.Fatal(err)
}
defer client.Close()Evaluate a Flag
evaluate.go
enabled, err := client.IsEnabled(ctx, "new-feature",
&buildrflags.EvalContext{
UserID: "user-123",
Attributes: map[string]interface{}{
"plan": "pro",
},
},
)
if enabled {
// Show the new feature
}Get All Flags
all-flags.go
results, err := client.EvaluateAll(ctx, nil)
for key, result := range results {
fmt.Printf("%s: %v\n", key, result.Enabled)
}Python
buildrflagsGAPython web apps, jobs, and notebooks
Context manager supportThread-safe cacheRetry controlsSafe default fallback
Installation
pip install buildrflagsInitialization
init.py
from buildrflags import BuildrFlagsClient
client = BuildrFlagsClient(
api_key="bf_production_xxxxxxxx"
)Evaluate a Flag
evaluate.py
from buildrflags import EvaluationContext
result = client.evaluate("new-feature",
context=EvaluationContext(
user_id="user-123",
attributes={"plan": "pro"},
),
)
if result.enabled:
# Show the new featureGet All Flags
all-flags.py
flags = client.evaluate_all()
for key, result in flags.items():
print(f"{key}: {'ON' if result.enabled else 'OFF'}")Ruby
buildrflagsGARails, Sinatra, and Puma apps
Thread-safe (Puma compatible)Built-in cachingNo external dependenciesTyped exceptions
Installation
gem install buildrflagsInitialization
init.rb
require "buildrflags"
client = BuildrFlags::Client.new(
api_key: "bf_production_xxxxxxxx"
)Evaluate a Flag
evaluate.rb
result = client.evaluate("new-feature",
context: {
user_id: "user-123",
attributes: { plan: "pro" },
}
)
if result.enabled
# Show the new feature
endGet All Flags
all-flags.rb
flags = client.evaluate_all
flags.each do |key, result|
puts "#{key}: #{result.enabled}"
endRust
buildrflagsGARust services and CLIs
Sync and async APIsThread-safe cacheTyped errorsEvaluate all flags
Installation
cargo add buildrflagsInitialization
init.rs
use buildrflags::{BuildrFlagsClient, BuildrFlagsConfig};
let client = BuildrFlagsClient::new(BuildrFlagsConfig {
api_key: "bf_production_xxxxxxxx".to_string(),
base_url: None,
cache_ttl: None,
timeout: None,
})?;Evaluate a Flag
evaluate.rs
let enabled = client
.is_enabled("new-feature", None)
.unwrap_or(false);
if enabled {
// Show the new feature
}Get All Flags
all-flags.rs
let flags = client.evaluate_all(None)?;
for (key, result) in &flags {
println!("{key}: enabled={}", result.enabled);
}Java
com.buildrlab:buildrflagsGAJVM services and Spring apps
Java 11+Thread-safe cacheBuilder APISafe boolean helper
Installation
implementation "com.buildrlab:buildrflags:0.1.0"Initialization
init.java
BuildrFlagsClient client = BuildrFlagsClient.builder()
.apiKey("bf_production_xxxxxxxx")
.build();Evaluate a Flag
evaluate.java
EvaluationContext ctx = EvaluationContext.builder()
.userId("user-123")
.attribute("plan", "pro")
.build();
if (client.isEnabled("new-feature", ctx)) {
showNewFeature();
}Get All Flags
all-flags.java
EvaluationResult result = client.evaluate("new-feature");
System.out.printf("%s: %b%n",
result.getFlagKey(),
result.isEnabled());Terraform
BuildrLab/buildrflagsPreviewProvisioning environments, flags, and segments as code
Flags as codeEnvironment resourcesSegment resourcesImport support
Installation
terraform initInitialization
init.tf
terraform {
required_providers {
buildrflags = {
source = "BuildrLab/buildrflags"
}
}
}
provider "buildrflags" {
api_key = var.buildrflags_api_key
}Evaluate a Flag
evaluate.tf
resource "buildrflags_flag" "checkout" {
env_key = "production"
flag_key = "new_checkout"
name = "New Checkout"
enabled = false
}Read Flags as Code
all-flags.tf
data "buildrflags_flags" "production" {
env_key = "production"
}