trigger.fyi
v0.2.0
Published
Push notifications to yourself, from anywhere in your code. fyi("John Doe signed up")
Maintainers
Readme
trigger.fyi
Push notifications to yourself, from one line of code.
Know when someone signs up, pays, or does something meaningful in your product, without checking another dashboard.
Install
npm install trigger.fyiQuickstart
Set your key, import, and call. Three lines.
// TRIGGER_FYI_SECRET_KEY=fyi_… in your environment
import fyi from "trigger.fyi"
await fyi("John Doe signed up")The string you pass is the notification's title — the bold line on your phone. The second line defaults to your app's name, or say more with body:
fyi("€29 payment", { body: "Pro plan, annual" })Every other key you pass becomes metadata, stored with the event and filterable in the feed, like structured logs:
fyi("Deploy live", { sha: "7f3a2c1", env: "prod" })No key yet? npx trigger.fyi mints one and starts watching it, right in your terminal.
Levels
fyi("Someone paid") // a notification
fyi.log("Nightly backup done") // on the record, not on the lock screen —
// shows in the feed and terminal, no push
fyi.critical("Payments are failing") // high urgency; breaks through silent
// mode where the platform allowsWatch from your terminal
The package is also the CLI:
npx trigger.fyi # watches your project's app (from env/.env) — or mints one
npx trigger.fyi fyi_xxxx # watch a specific app
npx trigger.fyi --json # one JSON object per line, for jq and friendsEvents stream in live with a terminal bell. Press p for a QR code that puts the same feed on your phone as notifications. npx trigger.fyi login links your account so a bare run watches every app you own.
The CLI reads .env files only to find TRIGGER_FYI_* lines — nothing else is read, kept, or sent.
Latency
Your hot path never pays for us. fyi() is one POST to the nearest Cloudflare edge with a hard three-second cap, push delivery happens after our server has already responded, and nothing here can throw. Don't want to spend even the roundtrip? Don't await it — but on serverless platforms, hand the promise to your runtime's waitUntil (or just await; it can't fail your flow) so the platform doesn't freeze it mid-send.
No SDK required
The SDK is a thin wrapper over one HTTP request. The same notification from your shell:
curl -d "John Doe signed up" https://trigger.fyi/fyi_…With a body and metadata:
curl -H "content-type: application/json" \
-d '{"title": "€29 payment", "body": "Pro plan, annual", "meta": {"plan": "pro"}}' \
https://trigger.fyi/fyi_…Any language that can make a POST can send to your phone.
Options
| Option | Type | Default | Description |
| ---------- | -------- | ------------------------ | ------------------------------------------------------ |
| body | string | your app's name | The notification's second line. |
| key | string | TRIGGER_FYI_SECRET_KEY | Your key. Overrides the environment variable. |
| endpoint | string | https://trigger.fyi | Base URL. Also settable via TRIGGER_FYI_ENDPOINT. |
| anything else | string \| number \| boolean | — | Stored as metadata with the event. |
It never throws
fyi() never throws and never rejects. Success resolves { ok: true, id }; any failure, missing key, network error, timeout, bad response, resolves { ok: false, error }.
const result = await fyi("Someone paid")
if (!result.ok) {
// handle it, or ignore it
}This is deliberate. A signup flow must not fail because a notification did not send. Await the result if you want it; fire and forget if you do not. Sends time out after three seconds so they never hold up your code.
It runs anywhere with a global fetch: Node 18+, Bun, Deno, browsers, and edge runtimes. Zero dependencies.
