1
Create a project
Sign in to failpath.dev and create a new project. Once the project is created, copy your project key — it looks like
fp_project_xxx. You’ll use it in the next step to connect your repository.2
Initialize your repository
Run The
failpath init at the root of your repository, passing your project key:init command sets up everything Failpath needs in your repo:3
Install the SDK
Add
@failpath/sdk to your backend project using your preferred package manager:4
Instrument a function
Import Each call to
createTypedFailpathClient and failpathFlows from the generated .failpath/sdk.ts helper, then wrap your backend logic with run() and step(). Adjust the relative import path to match where your client file lives.The example below instruments a checkout handler with two steps:step() queues a running event before the wrapped function executes, then queues a success or error event when it completes. Telemetry sends in the background by default. Call flush() before a short-lived process exits, or use a platform waitUntil hook when your runtime provides one.If the function throws, the SDK records the error and rethrows the original exception — your existing error handling is not affected.5
Publish your flow
Push your local flow graph to the Failpath dashboard:Before sending anything,
publish validates .failpath/flows.json, regenerates .failpath/sdk.ts, and reports any structural errors. Once validation passes, your flow definition is live on the dashboard and ready to receive events from your instrumented functions.The
.env file created by init is enough for local development, but you also need to set FAILPATH_PROJECT_KEY in your deployment environment. Platforms such as Vercel, Railway, and Convex each have their own environment variable configuration — add FAILPATH_PROJECT_KEY there so your deployed backend can send events to Failpath.