Node.js

Chimpbase host for the Node.js runtime.

The Node.js host uses node:http internally and adapts between Node's callback-based HTTP API and the Web standard Request/Response that Chimpbase expects.

Install

npm install @chimpbase/node

Create a runtime

import { createChimpbase } from "@chimpbase/node";

const chimpbase = await createChimpbase({
  storage: { engine: "postgres", url: process.env.DATABASE_URL },
});

Server

Uses node:http.createServer() under the hood. Request/response conversion between Node's IncomingMessage/ServerResponse and Web APIs is handled automatically.

import { defineChimpbaseApp } from "@chimpbase/node";

export default defineChimpbaseApp({
  project: { name: "my-app" },
  httpHandler: handler,
  registrations: [/* ... */],
});

SQLite for local development

const chimpbase = await createChimpbase({
  storage: { engine: "sqlite", path: "./dev.db" },
});

Exports

import {
  createChimpbase,
  defineChimpbaseApp,
  loadChimpbaseApp,
  loadChimpbaseProject,
  runChimpbaseAction,
  startChimpbaseApp,
  syncChimpbaseSchema,
  syncChimpbaseWorkflowContracts,
} from "@chimpbase/node";