@rivium/flags-node
v0.1.0
Published
Rivium Feature Flags SDK for Node.js - Server-side feature flag management
Maintainers
Readme
Installation
npm install @rivium/flags-nodeQuick Start
import { RiviumFlags } from '@rivium/flags-node';
const flags = new RiviumFlags({
apiKey: 'YOUR_API_KEY',
serverSecret: 'YOUR_SERVER_SECRET',
environment: 'production',
});
await flags.init();
// Check if a flag is enabled
const darkMode = flags.isEnabled('dark_mode', { userId: 'user-123' });
// Get flag value
const variant = flags.getValue('checkout_flow', { userId: 'user-123' });
// Full evaluation with targeting
const result = flags.evaluate('premium_banner', {
userId: 'user-123',
userAttributes: { plan: 'pro', country: 'US' },
});
console.log(result.enabled, result.value, result.variant);
// Refresh flags from server
await flags.refresh();Features
- Server-Side Evaluation — Secure evaluation with
apiKey+serverSecret(secrets never exposed to client) - Per-Request Context — Pass
userIdanduserAttributesper call with no shared state - Boolean & Multivariate Flags — Simple on/off toggles or multi-variant flags with weighted distribution
- Targeting Rules — Target users by attributes (equals, contains, regex, in, greater_than, and more)
- Rollout Percentages — Gradual rollouts with deterministic MD5-based bucketing
- Environment Overrides — Separate flag values per environment (development, staging, production)
- TypeScript — Full type safety with exported types and declarations
Documentation
For full documentation, visit rivium.co/docs.
License
MIT License — see LICENSE for details.
