@supabase/middleware - v0.2.0
    Preparing search index...

    Interface WithFeatureFlagConfig

    Per-instance configuration the consumer passes to withFeatureFlag(config, handler).

    Keep this surface small — every field becomes part of the public API.

    interface WithFeatureFlagConfig {
        name: string;
        evaluate: (
            req: Request,
        ) => boolean | FeatureFlagVerdict | Promise<boolean | FeatureFlagVerdict>;
        rejectStatus?: number;
        rejectBody?: unknown;
    }
    Index
    name: string

    Human-readable name for the flag. Echoed back on ctx.featureFlag.name and the default rejection body.

    evaluate: (
        req: Request,
    ) => boolean | FeatureFlagVerdict | Promise<boolean | FeatureFlagVerdict>

    Decide whether the flag is enabled for this request.

    Return true/false for a simple on-off check, or a FeatureFlagVerdict to also record a variant or provider payload. Async is fine.

    rejectStatus?: number

    HTTP status when the flag rejects. Default is 404 — "this feature doesn't exist for you yet" — a softer reveal than 403 that avoids tipping off attackers about the existence of gated functionality.

    404

    rejectBody?: unknown

    Body when the flag rejects.

    { error: 'feature_disabled', flag: <name> }