What is a canary deploy
A canary deploy is the practice of exposing a new version of software to a small percentage of users before doing a full rollout. If something goes wrong, you revert instantly — without redeploying.
With CanaryGate, you do canary deploys at the feature level, not the infrastructure level.
Setting up the canary
1. Create a rollout flag
// In the dashboard: New Flag → Type: Rollout
// key: "v2-engine"2. Initialize with userId
const client = new CanaryGate(process.env.CANARYGATE_KEY!, {
userId: currentUser.id // Stable ID — the same user always sees the same result
})
await client.init()3. Ramp up gradually
| Phase | % | Suggested duration |
|---|---|---|
| Initial canary | 5% | 1-2h monitoring errors |
| Expansion | 20% | 4-8h |
| Ramp | 50% | 24h |
| GA | 100% | — |
Adjust the percentage in the dashboard. The change reaches clients in real time.
4. Evaluate in code
const useV2 = client.getFlag('v2-engine')?.enabled ?? false
if (useV2) {
return await processWithV2Engine(data)
} else {
return await processWithV1Engine(data)
}Instant rollback
If you detect a problem, set the percentage back to 0% in the dashboard — no redeployment, no downtime.
With auto-rollout (Pro plan)
Configure automatic percentage increases with a schedule:
10:00 → 5%
14:00 → 25%
next day 09:00 → 50%
48h later → 100%CanaryGate executes each step automatically. You can still pause or revert manually at any time.
Cleanup
Once the feature is at 100% and stable, remove the flag from the code and delete it in the dashboard to keep the project tidy.
// Before (with flag):
const isNewEngine = client.getFlag('v2-engine')?.enabled ?? false
if (isNewEngine) { ... }
// After (100% rollout, flag removed):
// Permanent code without conditional