New:Microsoft Teams Notifications Are Now Available in Socket.Learn more →
Get Started

@strav/flag

Package Overview
Dependencies
Maintainers
1
Versions
75
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@strav/flag

Feature flags for the Strav framework

npmnpm
Version
0.4.27
Version published
Weekly downloads
5
-28.57%
Maintainers
1
Weekly downloads
 
Created
Source

@strav/flag

Feature flags for the Strav framework. Define, scope, and toggle features with database persistence, in-memory drivers, and per-user/team targeting.

Install

bun add @strav/flag
bun strav install flag

Requires @strav/core as a peer dependency.

Setup

import { FlagProvider } from '@strav/flag'

app.use(new FlagProvider())

Usage

import { flag } from '@strav/flag'

// Check if a feature is active
if (await flag.active('dark-mode')) {
  // feature is enabled
}

// Scoped to a user or team
if (await flag.for(user).active('beta-dashboard')) {
  // enabled for this user
}

// Rich values
const limit = await flag.value('upload-limit', 10)

Middleware

import { ensureFeature } from '@strav/flag'

router.get('/beta', ensureFeature('beta-dashboard'), betaHandler)

Drivers

  • Database — persistent feature flags in _strav_features
  • Array — in-memory driver for testing

CLI

bun strav flag:setup    # Create the features table

Documentation

See the full Flag guide.

License

MIT

FAQs

Package last updated on 22 May 2026

Related posts