Node.js/TypeScript backend adapter for Toon Agent Bridge with Fastify, SSE, and WebSocket support.
npm install @programsmagic/toon-backend-node
# or
pnpm add @programsmagic/toon-backend-node
# or
yarn add @programsmagic/toon-backend-node
import { createServer } from '@programsmagic/toon-backend-node';
const server = await createServer({
port: 3000,
schemaSource: './openapi.json',
cors: true,
});
await server.start();
npx @programsmagic/toon-backend-node --schema ./openapi.json --port 3000
Or install globally:
npm install -g @programsmagic/toon-backend-node
toon-bridge --schema ./openapi.json --port 3000
Create a Fastify server from a schema.
Options:
port (number, default: 3000): Server porthost (string, default: ‘0.0.0.0’): Server hostschemaSource (string, required): Path to OpenAPI or agents.json filecors (boolean |
object, default: true): CORS configuration |
auth (AuthConfig, optional): Authentication configurationReturns: Server instance with fastify, schema, eventEmitter, and start() method
GET /health - Health checkGET /schema - Schema informationGET /events - SSE event streamGET /ws - WebSocket connection* - Auto-generated routes from schemaSee the examples directory for complete examples.
See the full documentation.
MIT