Skip to Content
Server

Server

Backend primitives for Hono apps: auth, HTTP, jobs, MCP, notifications and realtime.

stableOn npm, used in production

npm i @dapplelight/signet-server

hono, zod and @modelcontextprotocol/server are optional peers, needed only by the modules that use them. Every module takes a config object and never reads env at import, so it runs on Workers, Node and Bun.

Add Signet's server kit to this API

Add the Signet MCP server so you can read Signet's docs: run claude mcp add signet -- bunx @dapplelight/signet-mcp, or add it to .cursor/mcp.json with command "bunx" and args ["@dapplelight/signet-mcp"].

Then install @dapplelight/signet-server along with hono and zod, and wire it into my Hono app: requestId() on "", rateLimit() on "/api/", errorHandler() through app.onError, and zValidator("json", schema) on every route that reads a body.

Throw ApiException for expected errors instead of returning ad-hoc JSON. Import from the subpath modules, such as @dapplelight/signet-server/http. Look up each module's options with the MCP tools before using it, then run my typecheck and tests.

Open in Cursor

Quick start

import { Hono } from "hono"
import { ApiException, errorHandler } from "@dapplelight/signet-server/http"
import { zValidator } from "@dapplelight/signet-server/http/validate"
import { requestId } from "@dapplelight/signet-server/middleware/request-id"
import { rateLimit } from "@dapplelight/signet-server/middleware/rate-limit"
import { z } from "zod"

const app = new Hono()
app.use("*", requestId())
app.use("/api/*", rateLimit({ max: 100, windowSeconds: 60, trust: "cloudflare" }))
app.onError(errorHandler({ isProduction: () => process.env.NODE_ENV === "production" }))

app.post("/api/orders", zValidator("json", z.object({ sku: z.string() })), (c) => {
  const { sku } = c.req.valid("json") // 400 with field errors if invalid
  if (sku === "sold-out") throw new ApiException(409, "Out of stock", "OUT_OF_STOCK")
  return c.json({ sku }, 201)
})

Modules