<!-- tempo-docs-context -->
> Source: [/docs/server](https://tempo.xyz/developers/docs/server.md)
> Section: [Get Started](https://tempo.xyz/developers/get-started.md). Choose a starting point, send a test payment, get testnet funds, connect a coding agent, find the SDKs and CLI, and use the resource guides to plan payment workflows, liquidity, provider selection, and partner integrations.
> [Documentation index](https://tempo.xyz/developers/llms.txt) · [Docs skill](https://tempo.xyz/developers/SKILL.md)

> Tempo MCP: Use `search`, `find_pages`, `read_page`, and `code` at `https://mcp.tempo.xyz` for Tempo and related documentation.
> If an indexed page is missing or reflects an older site, read this site’s [documentation index](https://tempo.xyz/developers/llms.txt) and Markdown pages directly.

# Server utilities: Relay and Fee Payer Handler

Run these handlers when you want to sponsor fees from your own backend with your own policy. To have Tempo run the relay instead, use the hosted [Fee Payer API](https://tempo.xyz/developers/docs/api/fee-payer).

Server utilities are distributed through the Tempo API library, [`tapimo`](https://npm.im/tapimo). They work with frameworks that support either:

* The [Fetch API](https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API) through `handler.fetch`
* The [Node.js `RequestListener` API](https://nodejs.org/docs/latest-v24.x/api/http.html#httpcreateserveroptions-requestlistener) through `handler.listener`

## Connect a handler to your server

Use the [relay server dependency versions](https://tempo.xyz/developers/docs/server/relay-handler#create-a-relay-handler), create a handler once, then expose it through your server framework:

```ts twoslash
// @noErrors
import { createServer } from 'node:http'
import { Handler } from 'tapimo/server'
import { Account } from 'viem/tempo'

const handler = Handler.relay({
  apiKey: process.env.TEMPO_API_KEY,
  feePayer: {
    account: Account.fromSecp256k1('0x...'),
  },
})

createServer(handler.listener)              // Node.js
Bun.serve({ fetch: handler.fetch })         // Bun
Deno.serve(handler.fetch)                   // Deno
app.all('*', c => handler.fetch(c.request)) // Elysia
app.use(handler.listener)                   // Express
app.use(c => handler.fetch(c.req.raw))      // Hono
export const GET = handler.fetch            // Next.js
export const POST = handler.fetch           // Next.js
```

## Handlers

[Relay & Fee Payer Handler](https://tempo.xyz/developers/docs/server/relay-handler): Proxy RPC requests with fee sponsorship, automatic swaps, and simulation metadata.
