Getting Started
TrustRelay is a trust and relay infrastructure built for modern applications. This guide walks you through setting up your first integration.
Prerequisites
Before you begin, make sure you have:
- A TrustRelay account — sign up at trustrelay.io
- Node.js 18 or later
- An API key from the TrustRelay dashboard
Installation
Install the TrustRelay SDK using your preferred package manager:
npm install @trustrelay/sdk
# or
pnpm add @trustrelay/sdk Configuration
Create a .env file at the root of your project and add your API key:
TRUSTRELAY_API_KEY=your_api_key_here
TRUSTRELAY_ENV=production Never commit your API key to version control. Add
.envto your.gitignore.
Basic Usage
Initialize the client and send your first relay request:
import { TrustRelay } from '@trustrelay/sdk';
const client = new TrustRelay({
apiKey: process.env.TRUSTRELAY_API_KEY
});
const result = await client.relay({
source: 'my-service',
payload: { message: 'hello' }
});
console.log(result.id); // relay event ID Next Steps
- Explore the API Reference for a full list of endpoints and options.
- Set up webhooks to receive real-time relay events.
- Review the security guide for production best practices.