@tiny-factories/relay-sdk
v0.1.0
Published
Relay SDK — connect apps to a Relay server (Inbox, third-party integrations)
Downloads
92
Maintainers
Readme
@tiny-factories/relay-sdk
Connect apps to a Relay server — read the inbox feed, approve/reject items, and integrate third-party clients over HTTP.
npm install @tiny-factories/relay-sdkQuick start
import { connect, fetchInboxFeed } from "@tiny-factories/relay-sdk";
const relay = connect({
relayUrl: "https://your-relay.example.com",
apiToken: process.env.RELAY_TOKEN!,
});
const inbox = await fetchInboxFeed(relay);
console.log(inbox.items);connect() normalizes the relay URL and token; the returned config is passed to
the other helpers.
Local discovery (Node only)
When Relay is running on the same machine, the CLI writes a status file to
~/.relay/status.json. The Node-only entry point reads it so you don't have to
hard-code a URL:
import { discoverLocalRelayWithStatusFile } from "@tiny-factories/relay-sdk/node";
const local = await discoverLocalRelayWithStatusFile();
if (local) {
// local.url points at the running server
}The @tiny-factories/relay-sdk/node subpath imports node:fs/node:os and is not
browser-safe — use the root @tiny-factories/relay-sdk entry in browser/edge environments.
Exports
| Entry | Use |
| --- | --- |
| @tiny-factories/relay-sdk | Browser/edge-safe: connection, client (inbox), discovery (fetch-based), formatting helpers, types |
| @tiny-factories/relay-sdk/node | Node-only: local discovery via ~/.relay/status.json |
License
MIT
