# createSeedcord

`function` in `http` · v0.1.0-next.0

<https://docs.seedcord.org/packages/http/0.1.0-next.0/functions/create-seedcord>

Builds the HTTP-interactions engine, a `(request, ctx?) => Promise<Response>` handler.

The handler verifies the Ed25519 signature over the raw request bytes, rejects stale or replayed requests, answers a PING with an in-body PONG, and acks every other interaction with an empty 202. The engine dispatches a matched interaction through the manifest before the 202 goes out. Gates run first and the sender posts any refusal over the REST callback. `execute()` continues past the 202 under `ctx.waitUntil` when the caller passes one (the edge entry), and an engine-held in-flight set tracks it otherwise (node paths). It reads only the method, headers, and body. Mount it at any path.

Reads `DISCORD_PUBLIC_KEY` and `DISCORD_BOT_TOKEN` from the environment through envapt and throws a `SeedcordError` when either is missing or malformed.

```ts
createSeedcord(
    config: Config,
    manifest: RouteManifest
): (
    request: Request,
    ctx?: EngineContext
) => Promise<Response>
```

Builds the HTTP-interactions engine, a `(request, ctx?) => Promise<Response>` handler.

The handler verifies the Ed25519 signature over the raw request bytes, rejects stale or replayed requests, answers a PING with an in-body PONG, and acks every other interaction with an empty 202. The engine dispatches a matched interaction through the manifest before the 202 goes out. Gates run first and the sender posts any refusal over the REST callback. `execute()` continues past the 202 under `ctx.waitUntil` when the caller passes one (the edge entry), and an engine-held in-flight set tracks it otherwise (node paths). It reads only the method, headers, and body. Mount it at any path.

Reads `DISCORD_PUBLIC_KEY` and `DISCORD_BOT_TOKEN` from the environment through envapt and throws a `SeedcordError` when either is missing or malformed.

Parameters.

- `config` `Config`
- `manifest` `RouteManifest`

Returns `(request: Request, ctx?: EngineContext) => Promise<Response>`.
