
Security News
Axios Maintainer Confirms Social Engineering Attack Behind npm Compromise
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.
@myflags/core
Advanced tools
MyFlags - The modern way to manage feature flags in your applications. Ship features faster, control releases with confidence, and deliver better user experiences.
The core package of MyFlags SDK, providing the fundamental functionality for feature flag management.
npm install @myflags/core
# or
yarn add @myflags/core
# or
pnpm add @myflags/core
import { MyFlagsSDK } from "@myflags/core";
// Initialize the SDK with your configuration
const sdk = new MyFlagsSDK({
apiKey: "your-api-key",
projectId: "your-project-id",
environment: "production", // optional, defaults to 'production'
refreshInterval: 600000, // optional, defaults to 10 minutes
retryCount: 3, // optional, defaults to 3 retries for failed API requests
retryDelay: 1000, // optional, defaults to 1000ms between retries
});
// Get all feature flags
const flags = await sdk.getFlags();
// Check if a specific feature is enabled
const isEnabled = await sdk.getFlag("feature_key");
interface MyFlagsConfig {
apiKey: string; // Required: Your MyFlags API key
projectId: string; // Required: Your MyFlags Project key
environment?: "production" | "development" | "testing"; // Optional: Environment
refreshInterval?: number; // Optional: Refresh interval in milliseconds
retryCount?: number; // Optional: Number of retries for failed API requests
retryDelay?: number; // Optional: Delay between retries in milliseconds
}
The main class for interacting with the MyFlags service.
| Option | Type | Default | Description |
|---|---|---|---|
| apiKey | string | - | Your MyFlags API key |
| projectId | string | - | Your project ID |
| environment | 'production' | 'development' | 'testing' | 'production' | Environment to use |
| refreshInterval | number | 600000 | Interval in milliseconds to refresh flags |
| retryCount | number | 3 | Number of retries for failed API requests |
| retryDelay | number | 1000 | Delay between retries in milliseconds |
getFlags<T extends Flag>(): Promise<T> - Get all feature flagsgetFlag(key: string): Promise<boolean> - Check if a specific feature is enabledsubscribe(callback: (flags: Flag) => void): Promise<() => void> - Subscribe to flag updates. The callback will be called immediately and then at the specified refresh interval. Returns an unsubscribe function to clean up the subscription.You can subscribe to flag updates to get real-time notifications when flags change:
const sdk = new MyFlagsSDK({
apiKey: "your-api-key",
projectId: "your-project-id",
refreshInterval: 5000, // Check for updates every 5 seconds
});
// Subscribe to flag updates
const unsubscribe = await sdk.subscribe((flags) => {
console.log("Flags updated:", flags);
});
// Later, when you want to stop receiving updates
unsubscribe();
Initialization
Error Handling
Performance
Security
See the Contributing Guide for details on how to contribute to this package.
This package is licensed under the MIT License - see the LICENSE file for details.
FAQs
Core SDK for MyFlags feature flag management
We found that @myflags/core demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.

Security News
The Axios compromise shows how time-dependent dependency resolution makes exposure harder to detect and contain.