Skip to main content
Failpath relies on a single environment variable — FAILPATH_PROJECT_KEY — to authenticate your SDK and CLI. Where and how you set that variable depends on which environment your code is running in. This page covers local development, deployed backends, and test environments.

Development

When you run npx failpath init, the CLI writes your project key to a .env file in your repository root and adds .env to your .gitignore automatically. In local development, this file is all you need — both the CLI commands (publish, sync) and the SDK will read from it.
The init command updates your .gitignore to exclude .env automatically. If you use a different env file convention (for example .env.local), make sure your project key file is listed in .gitignore before committing.

Production and deployed backends

A repository .env file is not available in most deployed environments. You must set FAILPATH_PROJECT_KEY directly in your runtime environment using your platform’s secret or environment variable management.
Never commit FAILPATH_PROJECT_KEY to source control. Treat it as a secret with the same care as a database password or API key. If you accidentally expose it, rotate your project key from the Failpath dashboard immediately.

Disabling in tests

Set enabled: false to prevent the SDK from sending any telemetry during your test suite. When disabled, step() still executes the wrapped function and returns its result normally — only the network calls are skipped.
The ?? "test" fallback ensures the SDK does not throw when FAILPATH_PROJECT_KEY is not set in your test environment. If your tests need to assert which events are emitted, use the mock client instead:

Local API development

If you are developing against a local instance of the Failpath API itself, you can override the default endpoint (https://api.failpath.dev) by setting FAILPATH_DEV_ENDPOINT in your shell, or by passing --endpoint to any CLI command:
This option is intended for Failpath contributors and local API development only. Do not set FAILPATH_DEV_ENDPOINT in production deployments.