Skip to content

A simple feature flag service that supports gradual rollouts, A/B testing, and user targeting for teams.

License

Notifications You must be signed in to change notification settings

Davidthecode/flagix

Repository files navigation

Flagix

Flagix logo

A simple feature flag service that supports gradual rollouts, A/B testing, and user targeting for teams.


Overview

Flagix is a lightweight feature flag management platform designed to help teams safely deploy and control features. With support for gradual rollouts, A/B testing, and user targeting, Flagix enables you to ship features faster while maintaining control over your releases.

Features

  • Feature Flags: Enable or disable features instantly without deploying code
  • Gradual Rollouts: Roll out features to a percentage of your users
  • A/B Testing: Run experiments with weighted variations
  • User Targeting: Target specific users, segments, or attributes
  • Real-time Updates: Changes reflect instantly in your applications
  • Multi-environment: Manage flags across development, staging, production, and more.
  • SDKs: Native JavaScript and React SDKs for easy integration
  • Analytics: Track flag usage and experiment results

Architecture

Flagix is built as a monorepo using Turborepo with the following key components:

  • Web App: Next.js dashboard for managing flags and viewing analytics
  • API: Express.js backend serving the REST API and real-time updates
  • Database: PostgreSQL with Prisma ORM for data persistence
  • SDKs: JavaScript and React libraries for client integration
  • Evaluation Core: Core logic for flag evaluation and targeting

Quick Start

Using the SDKs

Install the appropriate SDK for your application:

# JavaScript SDK
npm install @flagix/js-sdk

# React SDK
npm install @flagix/react
// JavaScript SDK

import { Flagix } from "@flagix/js-sdk";

// Initialize the SDK. 
await Flagix.initialize({
  apiKey: "<YOUR_API_KEY>",
});

// Set user context (triggers instant re-evaluation)
Flagix.setContext({ 
  userId: "user_123", 
  plan: "premium" 
});

// Evaluate a flag
const isEnabled = Flagix.evaluate("my-feature-flag");

// Listen for real-time updates
Flagix.onFlagUpdate((key) => {
  console.log(`Flag ${key} updated to:`, Flagix.evaluate(key));
});
// React SDK

// Configure the provider
import { FlagixProvider } from "@flagix/react";
import { useAuth } from "./hooks/use-auth";

const options = {
  apiKey: "<YOUR_API_KEY>",
};

export default function Providers({ children }: { children: React.ReactNode }) {
  const { user } = useAuth();

  return (
    <FlagixProvider
      options={options}
      context={user}
    >
      {children}
    </FlagixProvider>
  );
}


// Use in component
import { useFlag } from "@flagix/react";

export default function MyComponent() {
  const isFeatureEnabled = useFlag("my-feature-flag");

  return (
    <div>
      {isFeatureEnabled ? <NewFeature /> : <OldFeature />}
    </div>
  );
}

Documentation

For full technical references, advanced targeting guides, and framework-specific examples, visit our documentation:

docs.flagix.com

Quick Links

Contributions

Want to run Flagix locally or contribute a feature? Check out our Contributing Guide for a step-by-step guide.

License

Flagix is released under the MIT License - see the LICENSE file for details.

About

A simple feature flag service that supports gradual rollouts, A/B testing, and user targeting for teams.

Resources

License

Contributing

Stars

Watchers

Forks

Packages

No packages published