Switching services off
Turn any Nexus product off with an environment variable or one line of config — without removing the code that uses it.
Every product is on by default. Switching one off makes it inert: it makes no network call, never throws, and returns a neutral value — flags fall back to your defaults, Remote Config to your defaults, lists are empty, events and logs are not even buffered, and background work (sockets, recorders, error handlers) does not start. Your code keeps compiling and running unchanged.
NEXUS_LIVE_ACTIVITIES_ENABLED=false # just Live Activities
NEXUS_ENABLED=false # everything — handy in tests and CI| Variable | Switches off | JS key | PHP / Python key | .NET NexusServices. |
|---|---|---|---|---|
NEXUS_REALTIME_ENABLED | rooms, emits, the socket | realtime | realtime | Realtime |
NEXUS_EVENTS_ENABLED | events | events | events | Events |
NEXUS_ERRORS_ENABLED | error capture | errors | errors | Errors |
NEXUS_LOGS_ENABLED | logs | logs | logs | Logs |
NEXUS_SESSIONS_ENABLED | sessions | sessions | sessions | Sessions |
NEXUS_FLAGS_ENABLED | feature flags (→ defaults) | flags | flags | Flags |
NEXUS_REMOTE_CONFIG_ENABLED | Remote Config (→ defaults) | remoteConfig | remote_config | RemoteConfig |
NEXUS_LINKS_ENABLED | deep links | links | links | Links |
NEXUS_SURVEYS_ENABLED | surveys | surveys | surveys | Surveys |
NEXUS_PUSH_ENABLED | push | push | push | Push |
NEXUS_IN_APP_ENABLED | in-app messages | inApp | in_app | InApp |
NEXUS_LIVE_ACTIVITIES_ENABLED | Live Activities | liveActivities | live_activities | LiveActivities |
NEXUS_REPLAY_ENABLED | session replay | replay | replay | Replay |
NEXUS_VOICE_ENABLED | voice | — | voice (Python) | Voice |
NEXUS_TELESCOPE_ENABLED | Telescope request tracing | telescope (Node) | telescope | Telescope |
false, 0, off and no all mean off.
In code
Nexus.init({ apiKey, services: { liveActivities: false } });
Nexus.init({ apiKey, enabled: false }); // everything
nexus.enabled('push'); // → booleanIn the browser there is no environment, so this is the only way.
Off wins
A service is on only if neither the code nor the environment turns it off. That means operations can always switch a product off in an incident with an environment variable, whatever the code says. Unknown service names are rejected, so a typo cannot silently leave something on.
