Skip to content

Use this when you are not on Vite or Webpack and want to mount the Vibe server manually.

js
import express from "express";
import { routes } from "@vibenv/vibe-server/routes.js";
import { logger } from "@vibenv/logger/serverLogger.js";

const app = express();

app.use("/_vibe-agent", express.json());
app.use("/_vibe-agent", routes(logger));

app.listen(3000);

Once the router is mounted:

  • POST /_vibe-agent/prompt starts a new agent run.
  • GET /_vibe-agent/sse streams session updates via SSE.
  • GET /_vibe-agent/session-response returns the latest session state.

Make sure the built vibeagent.js file is served at the same URL you inject into your app (the default is /vibeagent.js). On webpack-dev-server, WebpackVibeAgentHandlerPlugin can serve it for you.