Introduction
Switchflag is a feature flag platform built for the edge. Ship features safely with targeting rules, percentage rollouts, and per-environment configuration.
What is Switchflag?
Switchflag gives you a full-stack feature flagging system: a dashboard to manage flags, an SDK to evaluate them, and observability to see what's happening. Flags are fetched once and evaluated client-side, so there's no network round-trip on every getFlag() call.
Key Features
- Targeting rules — 10 operators (
equals,contains,startsWith,in,percent, etc.) evaluated in order, first match wins - Percentage rollouts — Consistent hashing ensures the same user always lands in the same bucket
- Multi-environment — Each flag has independent configuration per environment (development, staging, production)
- Multi-tenant — Organization-based access control with owner/admin/member roles and email invitations
- Audit logging — Every flag change is recorded with who changed what and when
- Type-safe SDK — Zod schemas as the single source of truth for both runtime validation and TypeScript types
How It Works
- Create a project and define your feature flags in the dashboard
- Configure targeting rules and rollout percentages per environment
- Install the SDK in your application
- Evaluate flags client-side with zero network overhead per call
import { createClient } from '@switchflag/sdk'
const client = createClient({ apiKey: 'sf_production_...' })
const result = await client.getFlag<boolean>('new-checkout-flow', {
userId: 'user-123',
country: 'GB',
})
if (result.value) {
// show new checkout
}Architecture
The SDK ships in two variants:
- Standard — In-memory
Mapcache, suited for long-lived server processes - Edge — Uses
fetchwithcache: 'force-cache'andnext: { revalidate: 60 }, delegating caching to the edge network since edge functions are ephemeral