Fictional developer-tool template · product behavior, metrics, customers, pricing, integrations and assurances are illustrative

Fictional SDK documentation sample

Quickstart

Preview the hierarchy for a first-job quickstart; commands and package names are illustrative.

1Install the SDK

Install the RELAY SDK via your package manager:

Terminal
$ npm install @relay/sdk

The SDK is fully typed. No additional @types packages needed.

2Initialize RELAY

Create a RELAY client with your API key. Generate one from thesample dashboard step.

relay.ts
import { Relay } from "@relay/sdk";

export const relay = new Relay({
  apiKey: process.env.RELAY_API_KEY,
});

Keep your API key secret

Never hardcode API keys. Use environment variables and .env files. Replace this sample with your maintained secrets guidance.

3Define your first job

Use relay.defineJob() to create a typed job handler. The payload type flows from enqueue to handler with full TypeScript inference.

jobs/send-welcome-email.ts
import { relay } from "../relay";

interface WelcomeEmailPayload {
  userId: string;
  email: string;
  firstName: string;
}

export const sendWelcomeEmail = relay.defineJob<WelcomeEmailPayload>({
  id:      "send-welcome-email",
  queue:   "notifications",
  retries: 3,

  async handler(payload) {
    // payload is fully typed — no casting needed
    await mailer.send({
      to:       payload.email,
      template: "welcome",
      data:     { firstName: payload.firstName },
    });
  },
});

4Enqueue a job

Call .enqueue() from anywhere — your API route, webhook handler, or another job.

api/auth/signup.ts
import { sendWelcomeEmail } from "../jobs/send-welcome-email";

export async function POST(request: Request) {
  const user = await db.createUser(await request.json());

  // Enqueue asynchronously — don't block the response
  await sendWelcomeEmail.enqueue({
    userId:    user.id,
    email:     user.email,
    firstName: user.firstName,
  });

  return Response.json({ user }, { status: 201 });
}

You're done!

Use this step to link a real dashboard and describe measured execution behavior. The fictional result below demonstrates the documentation pattern only.

Next steps