Ravex

Framework Integrations

Use ChatEngine with Express, Fastify, NestJS, Hono, Koa, and more.

Framework Integrations

ChatEngine works with any Node.js HTTP server. Here are examples for popular frameworks.

Express

import express from "express";
import { createServer } from "http";
import { ChatEngine } from "@ravex/server";

const app = express();
const httpServer = createServer(app);

const engine = new ChatEngine(httpServer);

httpServer.listen(3000, () => {
  console.log("Express + Ravex running on port 3000");
});

Fastify

import Fastify from "fastify";
import { ChatEngine } from "@ravex/server";

const fastify = Fastify();

const engine = new ChatEngine(fastify.server);

fastify.listen({ port: 3000 }, () => {
  console.log("Fastify + Ravex running on port 3000");
});

NestJS

import { NestFactory } from "@nestjs/core";
import { AppModule } from "./app.module";
import { ChatEngine } from "@ravex/server";

async function bootstrap() {
  const app = await NestFactory.create(AppModule);

  const httpServer = app.getHttpServer();
  const engine = new ChatEngine(httpServer);

  await app.listen(3000);
  console.log("NestJS + Ravex running on port 3000");
}
bootstrap();

Hono (Node.js)

import { serve } from "@hono/node-server";
import { Hono } from "hono";
import { ChatEngine } from "@ravex/server";
import type { Server } from "http";

const app = new Hono();

const server = serve({ fetch: app.fetch, port: 3000 }, (info) => {
  console.log(`Hono + Ravex running on port ${info.port}`);
});

const engine = new ChatEngine(server as Server);

Koa

import Koa from "koa";
import { createServer } from "http";
import { ChatEngine } from "@ravex/server";

const app = new Koa();
const httpServer = createServer(app.callback());

const engine = new ChatEngine(httpServer);

httpServer.listen(3000, () => {
  console.log("Koa + Ravex running on port 3000");
});

Plain Node.js HTTP

See the Quick Start page.

Next Steps

On this page