PyForge is sold only here, on the official py-forge.com website — beware of imitations.

All articles
Feature FlagsGoPythonDevOps

Stop Paying the SaaS Tax: Self-Hosted Feature Flags with FlagForge CLI

PyForge Team 5 min read2026-10-16

SaaS feature management platforms excel at charging enterprise prices for simple boolean checks and key-value lookups. When your monthly bill hits four figures just to evaluate flags, it's time to own your release infrastructure.

The Architecture: Go Engine + Embedded SQLite

FlagForge CLI is built as a single Go binary compiled for zero-dependency execution. It embeds SQLite using WAL (Write-Ahead Logging) mode, enabling sub-millisecond flag evaluations local to your network or deployed alongside your services as a sidecar container.

Integrating with Python Microservices

You don't need heavyweight vendor SDKs or complex background sync threads. A lightweight local client wrapper querying the FlagForge daemon yields ultra-fast evaluation with predictable fallback defaults.

python
import requests
from typing import Optional

class FlagForgeClient:
    def __init__(self, host: str = "http://127.0.0.1:8080", timeout: float = 0.05):
        self.host = host.rstrip("/")
        self.timeout = timeout

    def is_enabled(self, flag_key: str, user_id: Optional[str] = None, default: bool = False) -> bool:
        try:
            payload = {"user_id": user_id} if user_id else {}
            resp = requests.post(
                f"{self.host}/v1/evaluate/{flag_key}",
                json=payload,
                timeout=self.timeout
            )
            if resp.status_code == 200:
                return resp.json().get("enabled", default)
        except Exception:
            pass  # Fallback gracefully if sidecar is unreachable
        return default

# Quick execution context
client = FlagForgeClient()
if client.is_enabled("v2_async_pipeline", user_id="usr_99482"):
    # Execute canary code path
    pass

Canary Rollouts & Instant Kill-Switches

FlagForge supports percentage-based canary distribution, targeting rules, and instant global kill-switches. Changes update state instantly in SQLite, propagated across instances without external cache brokers like Redis.

Every toggle event is logged locally to an append-only audit trail, providing full audit compliance while running entirely within your Docker or Kubernetes cluster.