Prompt
How do I separate code deployment from feature exposure?
Latest observation
A good way to think about this is: deploy code whenever you’re ready, but decide separately when users can actually see or use it.
Core idea
Split your release process into two steps:
-
Code deployment
Ship the new code to production infrastructure. -
Feature exposure
Keep the new behavior hidden until you explicitly enable it.
This lets you:
- reduce release risk,
- deploy early and often,
- test in production safely,
- roll out gradually,
- turn features off quickly if needed.
Common techniques
1) Feature flags / feature toggles
Wrap new functionality in a conditional check.
Example:
if (featureFlags.newCheckoutFlow) {
renderNewCheckout()
} else {
renderOldCheckout()
}
Benefits:
- easy gradual rollout,
- can target specific users,
- can disable quickly without redeploying.
Best for:
- new UI,
- backend logic changes,
- experiments / A/B tests.
2) Configuration-driven behavior
Move exposure control into config, env vars, or remote settings.
Example:
NEW_SEARCH_ENABLED=false- toggle in admin console
- per-environment config
This is simpler than a full feature-flag platform, but less flexible.
3) Branch by abstraction / interface swapping
Introduce an abstraction layer so both old and new implementations can coexist.
Example:
PaymentProcessorinterface- old and new implementations
- choose implementation based on flag/config
Useful when:
- the change is deep in the system,
- you need to migrate incrementally.
4) Canary releases / progressive delivery
Deploy the code to everyone, but expose it only to a small slice of traffic.
Example rollout:
- 1%
- 5%
- 25%
- 100%
This is often combined with feature flags.
5) Dark launch / shadow traffic
Deploy the code and run it in parallel without showing the result to users.
Useful to:
- measure performance,
- validate correctness,
- compare outputs.
Good practice pattern
A typical safe flow is:
- Merge code behind a flag.
- Deploy to production with the flag off.
- Validate in production.
- Enable for internal users / QA.
- Roll out to a small percentage.
- Expand gradually.
- Remove old code once stable.
Important guidelines
- Default off for risky features.
- Keep flags short-lived; delete them after rollout.
- Centralize flag management so it’s auditable.
- Monitor metrics when turning features on.
- Avoid flag spaghetti: too many nested flags make code hard to maintain.
Simple mental model
- Deployment = “Can the code run?”
- Exposure = “Can the user see/use it?”
If you want, I can also show:
- a concrete example in your stack,
- an architecture diagram,
- or a rollout checklist.