Getting started · § 1.1

1.1Introduction

What Relay is, what it is for, and how the pieces fit together.

Relay is an API toolkit for small teams. You write route handlers as plain functions, and Relay handles hosting, environments, secrets, logs, and webhooks. There is no server to manage and no YAML to learn.

The mental model

A Relay project is a folder of routes plus one config file:

text
my-api/
├── relay.toml
└── routes/
    ├── users.ts        →  /users
    ├── users/[id].ts   →  /users/:id
    └── health.ts       →  /health

Each file exports a handler. Deploying uploads the folder, builds it, and atomically swaps traffic to the new build:

ts
// routes/health.ts
export default function handler() {
  return Response.json({ ok: true });
}

What Relay gives you

PieceWhat it does
RoutesFile-based HTTP endpoints with zero boilerplate
Environmentsstaging and production targets with instant promotion
SecretsEncrypted per-environment values, injected at runtime
Logs and metricsStructured logs, p50/p95/p99 latency, error rates
WebhooksSigned events pushed to your own endpoints

Where to go next