Sign inSign up

okjodom/bitsacco-web

By okjodom

Updated 6 months ago

Image
0

2.3K

okjodom/bitsacco-web repository overview

Bitsacco Web

Custom member experience for Bitsacco - a comprehensive Bitcoin SACCO platform built on BitsaccoServer for users in Kenya.

Feature Flags

This app uses FeatBit for feature flag management. Feature flags allow toggling features on and off without deploying new code.

Implementation

The feature flag system is implemented using the FeatBit JavaScript SDK with the builder pattern:

// Initialize client with FbClientBuilder
const client = new FbClientBuilder()
  .envSecret(secret)
  .api(apiUrl)
  .user({
    id: user.id,
    name: user.name,
    email: user.email,
    custom: {},
  })
  .bootstrap(DEFAULT_FLAGS)
  .build();
Feature Flag Configuration

Feature flags can be configured in two ways:

  1. JSON Configuration File (recommended)

    The app now supports reading feature flags from a JSON file that can be injected into the Docker container at runtime. This allows for easier configuration and deployment of feature flags in different environments.

    To use this method:

    • Create a features.json file with your feature flag configuration:
    {
      "features": [
        {
          "id": "membership",
          "variationType": "boolean",
          "variation": true
        },
        {
          "id": "personal-savings-withdraw",
          "variationType": "boolean",
          "variation": false
        }
        // Add other feature flags as needed
      ]
    }
    
    • Mount this file into the Docker container at /app/build/features.json when running the container:
    docker run -v ./config-features.json:/app/build/features.json bitsacco/app
    
  2. Environment Variables

    TBD

Available Feature Flags

See features.dev.json

Usage
import { useFeatureFlags } from "../components/Providers";
import { FEATURE_FLAGS } from "../services/featbit";

function MyComponent() {
  const { isEnabled } = useFeatureFlags();
  const isWithdrawEnabled = isEnabled(FEATURE_FLAGS.PERSONAL_SAVINGS_WITHDRAW);

  // Rest of component
}

Tag summary

Content type

Image

Digest

sha256:4e0c3a5b9

Size

61.1 MB

Last updated

6 months ago

docker pull okjodom/bitsacco-web:sha-71d5b0f