@programsmagic/toon-backend-node
v0.1.0
Published
Node.js/TypeScript backend adapter for Toon Agent Bridge with Fastify, SSE, and WebSocket support
Maintainers
Readme
@toon/backend-node
Node.js/TypeScript backend adapter for Toon Agent Bridge with Fastify, SSE, and WebSocket support.
Installation
npm install @toon/backend-node
# or
pnpm add @toon/backend-node
# or
yarn add @toon/backend-nodeQuick Start
import { createServer } from '@toon/backend-node';
const server = await createServer({
port: 3000,
schemaSource: './openapi.json',
cors: true,
});
await server.start();CLI Usage
npx @toon/backend-node --schema ./openapi.json --port 3000Or install globally:
npm install -g @toon/backend-node
toon-bridge --schema ./openapi.json --port 3000API
createServer(options)
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 configurationauth(AuthConfig, optional): Authentication configuration
Returns: Server instance with fastify, schema, eventEmitter, and start() method
Endpoints
GET /health- Health checkGET /schema- Schema informationGET /events- SSE event streamGET /ws- WebSocket connection*- Auto-generated routes from schema
Examples
See the examples directory for complete examples.
Documentation
See the full documentation.
License
MIT
