@gnldev/server has 34 recorded weekly downloads on npm, a decrease of 84.7% over the past 30 days, ranking #2868 of 3,247 tracked listings.
About @gnldev/server
@gnldev/server
Part of GNL, a full agent framework for TypeScript — works with the rest of it, or on its own.
Exposes the createGnl registry as auto-REST + OpenAPI + SSE. Every endpoint bottoms out in runDurable → the journal, replay and the at-most-once side-effect guarantee are inherited for free. (The durable counterpart to the common auto-REST pattern.)
Install:
pnpm add @gnldev/server— or use it from a repo clone:pnpm install && pnpm -r build.
npm i @gnldev/server # peer: @gnldev/durable · dep: hono
import { createRestApi } from '@gnldev/server';
import { serve } from '@hono/node-server';
import { SqliteStorage } from '@gnldev/durable/sqlite';
const api = createRestApi({
journal: new SqliteStorage('runs.db').runs,
agents: { support: { model: 'anthropic/claude-opus-4-8', tools, guard, maxSteps: 8 } },
});
serve({ fetch: api.fetch, port: 3000 }); // on its own port
// app.mount('/api', api) // inside a Hono app
Binding it to a Node server
createRestApi returns a fetch handler — callable, and carrying .fetch. On Node, bind it with the
bridge on this package's own subpath:
import { createServer } from 'node:http';
import { toNodeHandler } from '@gnldev/server/node';
express().use('/api', toNodeHandler(api)); // Express
await fastify.register(middie); fastify.use('/api', toNodeHandler(api)); // Fastify + @fastify/middie
koa.use(c2k((req, res, _next) => toNodeHandler(api)(req, res))); // Koa + koa-connect
createServer(toNodeHandler(api)).listen(3000); // node:http
nestApp.use('/api', toNodeHandler(api)); // Nest (Express or Fastify)
Three rules, all measured on live servers rather than reasoned about — and held there by a test that
boots Express 5, Fastify 5 and Koa 3 on a socket (a-node-framework-serves-the-api.test.ts):
Bind at the middleware layer, not as a route. On Fastify the difference is the whole story:
middleware runs before body parsing, a route runs after it. fastify.all('/api/*', …) looks correct,
passes every GET, and refuses a perfectly good POST — Fastify's built-in JSON parser has already
drained the stream, and the bridge answers 500 body_consumed_upstream.
On Koa, declare the third parameter. koa-connect switches on fn.length: a middleware with
fewer than three parameters is assumed not to terminate the response, so it calls next() straight
after and Koa sends its own 404 first — measured, 404 on every route (Koa 3.2; Koa 2 also logged
ERR_HTTP_HEADERS_SENT). Naming next without calling it selects the branch that waits, which is what a
handler that owns the response needs. koa-connect takes no path, so bound as above the API answers
every request, 404 included: to keep routes of your own, put it behind a check on ctx.path that calls
next() for anything outside the API's prefix (and strips the prefix from ctx.req.url), as the test does.
Mount before whatever parses request bodies. A parser that runs first reads the stream to the end
and hands the result to the framework, not to us. Get it wrong and the bridge says so
(body_consumed_upstream) instead of blaming your request. Your own routes keep the parser: it still
runs for everything mounted after.
Next.js (App Router)
No bridge: a route handler takes a Request and returns a Response, which is what the API is. One
catch-all route hands it every request under its folder, with that folder's prefix cut, since the API's
routes start at /agents:
// app/api/[...path]/route.ts
import { createRestApi } from '@gnldev/server';
import { PostgresStorage } from '@gnldev/durable/postgres';
const api = createRestApi({ storage: new PostgresStorage({ connectionString: process.env.DATABASE_URL }), agents: {} });
function handle(req: Request): Response | Promise<Response> {
const url = new URL(req.url);
url.pathname = url.pathname.replace(/^\/api(?=\/|$)/, '') || '/';
return api.fetch(new Request(url, req));
}
export { handle as GET, handle as POST, handle as PUT, handle as PATCH, handle as DELETE, handle as OPTIONS };
Measured on Next.js 16.4 with next build and next start, no next.config entry: the agent list, a
run, and a /stream read as server-sent events, on memory and on Postgres (raporlar/2026-10-21-frameworks).
That is the Node runtime, a route handler's default; the Edge runtime was not tried, and the stores need
Node (a process liveness, a driver). As everywhere, production refuses to start
without auth (or a deliberate allowOpenAccess: true).
Endpoints (per agent)
| Method | Path | Description |
|---|---|---|
| GET | /agents | List of registered agent metadata (client/playground selector) |
| POST | /agents/:name/run | Durable run {runId, prompt|messages, threadId?, approvals?} → {ok, runId, text, interrupts} |
| POST | /agents/:name/stream | SSE streaming run (schema below) |
| POST | /agents/:name/resume | {runId, approvals?} — the input is read from the journal |
| GET | /runs · /runs/:id | Run summaries / journal timeline |
| GET | /runs/:id/events | SSE — follow a run already started, by any process, from Last-Event-ID (or ?after=) |
| POST | /runs/:id/cancel | Cancel a run, in whichever process executes it |
| GET | /openapi.json | Generated schema |
| GET | /health | Liveness — process is alive. No storage access. Unauthenticated |
| GET | /ready | Readiness — can serve traffic; 503 if the journal is unreachable. Unauthenticated |
Health checks
/health and /ready answer two different questions, and pointing the wrong probe at the wrong one
causes the wrong action:…
Description from the npm listing.
- ai
- agent
- llm
- typescript
- ai-sdk
- durable
- exactly-once
- rest
- hono
- openapi
- fetch-handler
README badge
Show your rank in a README or on your website. The badge updates automatically.
Charts
Images: 30d · 1y · all time · 1600×900 dark
Adoption over time
7/30/90-day growth
Ranking history
Listing placement
Listing placement
Filled points are observed values; hollow points come from Internet Archive snapshots of the listing page. Dashed segments span periods with no observations — values between points are not interpolated.
Each band is one page of 20. Weekly downloads on a linear scale. Placement is projected from weekly downloads, so it can differ from the marketplace's own sort order. Hover a dot to see the listing.
Recent observations
Full history (156)Similar npm AI SDKs plugins
All 20 @gnldev/server alternativesData source
Weekly downloads (trailing 7 complete days) come from the official npm downloads API. Downloads include CI and mirrors and are not equivalent to installs or users. npm publishes no ratings.
Listing: https://www.npmjs.com/package/@gnldev/server. First seen Oct 21, 2026; last successful collection Oct 28, 2026. See the methodology.