Real-World Use Cases
Two common scenarios from banking and enterprise: giving early access to specific people, and rolling out features progressively by branch or region.
In this guide
- 1. Family & Friends Program— Early access for specific users via list-based segments
- 2. Branch-by-Branch Rollout— Gradual rollout by branch or region using rule-based targeting
1. Family & Friends Program
Scenario
You're a bank launching a new mobile payment feature. Before rolling it out to all 500,000 customers, you want to test it with a small group of trusted people: employees, partners, and select customers.
Who
50 employees + 20 partner contacts + 30 VIP customers
Goal
Validate the feature with real users before general availability
Requirement
Only whitelisted users see the feature, everyone else gets the old flow
Step 1: Create a List-Based Segment
In the Rollgate dashboard, go to Segments and create a new segment of type List-Based. Name it something like “Family & Friends”.
Then add the user IDs of your trusted testers. You can paste them comma-separated or one per line:
emp-marco-rossi, emp-giulia-bianchi, emp-luca-ferrari
partner-acme-001, partner-globex-042
vip-customer-1001, vip-customer-1002, vip-customer-1003Step 2: Create the Feature Flag
Create a boolean flag called mobile-payments-v2. Set the global rollout to 0% (nobody sees it by default).
Step 3: Add a Targeting Rule
In the flag's targeting section, add a rule with the condition User is in segment “Family & Friends”. Set the rule rollout to 100%.
Now the flag is enabled only for users in that segment. Global rollout stays at 0%, so nobody else sees the feature.
Step 4: Integrate in Your App
import { RollgateProvider, useFlag } from '@rollgate/sdk-react';
function App() {
return (
<RollgateProvider
apiKey="YOUR_CLIENT_KEY"
user={{
id: currentUser.id, // e.g. "emp-marco-rossi"
attributes: {
role: currentUser.role, // "employee", "partner", "customer"
branch: currentUser.branch,
},
}}
>
<PaymentsPage />
</RollgateProvider>
);
}
function PaymentsPage() {
const mobilePayments = useFlag('mobile-payments-v2', false);
if (mobilePayments) {
return <MobilePaymentsV2 />;
}
return <ClassicPayments />;
}import { RollgateClient } from '@rollgate/sdk-node';
const rollgate = new RollgateClient({
apiKey: process.env.ROLLGATE_SERVER_KEY,
enableStreaming: true,
});
await rollgate.init();
app.get('/api/payments/methods', async (req, res) => {
const user = await getAuthenticatedUser(req);
const showV2 = rollgate.isEnabled('mobile-payments-v2', false, {
userId: user.id,
attributes: { role: user.role, branch: user.branchCode },
});
if (showV2) {
return res.json(await getMobilePaymentMethods(user));
}
return res.json(await getClassicPaymentMethods(user));
});Workflow Summary
- 1. Create list-based segment with trusted user IDs
- 2. Create flag with 0% global rollout
- 3.Add targeting rule: “User in segment” → 100% rollout
- 4.Test with Family & Friends group
- 5.When ready, increase global rollout to 10% → 50% → 100%
- 6. Remove the flag from code once fully rolled out
2. Branch-by-Branch Rollout
Scenario
Your bank has 200+ branchesacross the country. You're launching a redesigned account opening flow and want to roll it out progressively: start with 3 pilot branches, then expand region by region.
Phase 1
3 pilot branches in Milan
Phase 2
All branches in Lombardy region
Phase 3
All branches nationwide
Step 1: Create Rule-Based Segments
Create segments that match users by their branch or region attribute:
Segment: “Milan Pilot Branches”
Type: Rule-Based • Condition: branch_id in MI-001, MI-002, MI-003
Segment: “Lombardy Region”
Type: Rule-Based • Condition: region equals lombardy
Step 2: Create the Flag with Phased Rules
Create a flag called new-account-opening with global rollout at 0%. Add targeting rules in priority order:
User in segment “Milan Pilot Branches”
Rollout: 100% • Enabled from day 1
User in segment “Lombardy Region”
Rollout: 100% • Enable after Phase 1 validation
Global rollout
Start at 0%, increase to 25% → 50% → 100% for nationwide rollout
Step 3: Integrate in Your App
The key is passing branch and region as user attributes so Rollgate can evaluate the targeting rules:
import { RollgateProvider, useFlag } from '@rollgate/sdk-react';
function App() {
const user = useAuthenticatedUser();
const branch = useBranchContext();
return (
<RollgateProvider
apiKey="YOUR_CLIENT_KEY"
user={{
id: user.id,
attributes: {
branch_id: branch.id, // e.g. "MI-001"
region: branch.region, // e.g. "lombardy"
role: user.role, // e.g. "teller", "manager"
},
}}
>
<BankingApp />
</RollgateProvider>
);
}
function AccountOpeningPage() {
const newFlow = useFlag('new-account-opening', false);
if (newFlow) {
return <NewAccountOpening />;
}
return <LegacyAccountOpening />;
}import { RollgateClient } from '@rollgate/sdk-node';
const rollgate = new RollgateClient({
apiKey: process.env.ROLLGATE_SERVER_KEY,
enableStreaming: true,
});
await rollgate.init();
app.post('/api/accounts/open', async (req, res) => {
const user = await getAuthenticatedUser(req);
const branch = await getBranchInfo(user.branchId);
const useNewFlow = rollgate.isEnabled('new-account-opening', false, {
userId: user.id,
attributes: {
branch_id: branch.id, // "MI-001"
region: branch.region, // "lombardy"
role: user.role, // "teller"
},
});
if (useNewFlow) {
return handleNewAccountFlow(req, res, user);
}
return handleLegacyAccountFlow(req, res, user);
});package main
import (
"net/http"
rollgate "github.com/rollgate/sdk-go"
)
var client *rollgate.Client
func init() {
client, _ = rollgate.NewClient(rollgate.Config{
APIKey: os.Getenv("ROLLGATE_SERVER_KEY"),
EnableStreaming: true,
})
}
func accountOpeningHandler(w http.ResponseWriter, r *http.Request) {
user := getUserFromContext(r.Context())
branch := getBranchInfo(user.BranchID)
useNewFlow := client.IsEnabled("new-account-opening", false,
rollgate.WithUser(user.ID),
rollgate.WithAttributes(map[string]interface{}{
"branch_id": branch.ID, // "MI-001"
"region": branch.Region, // "lombardy"
"role": user.Role, // "teller"
}),
)
if useNewFlow {
handleNewAccountFlow(w, r, user)
return
}
handleLegacyAccountFlow(w, r, user)
}Rollout Timeline
Phase 1: Pilot
Enable rule 1 (Milan Pilot Branches). Monitor error rates, user feedback, and completion rates at MI-001, MI-002, MI-003.
Phase 2: Regional
Enable rule 2 (Lombardy Region). All ~40 branches in the region get the new flow. If issues arise, disable the rule instantly for a 1-click rollback.
Phase 3: Nationwide
Increase global rollout progressively: 25% → 50% → 75% → 100%. Each step is a simple slider change in the dashboard. No code deploy needed.
Safety Tips for Regulated Industries
- ✓ Audit trail: Every flag change is logged with who changed it, when, and what the previous value was
- ✓ Instant rollback: If something goes wrong, disable the rule or set global rollout to 0% in one click
- ✓ No code deploy:Rollout changes happen from the dashboard, not from a code release — reducing deployment risk
- ✓ Gradual rollout: The percentage-based rollout is deterministic per user (based on user ID hash), so the same user always gets the same experience