Create Base
Initialize a VisibleBase Base with the default database and HTTP service.
Install the packages:
pnpm add @visiblebase/base @visiblebase/clientPrepare provider env. On first boot Base fills VISIBLEBASE_ADMIN_SECRET_KEY and VISIBLEBASE_TOKEN_SIGNING_KEY automatically:
OPENAI_API_KEY="..."
OPENAI_BASE_URL="https://api.openai.com/v1"Create Base:
import { Base } from "@visiblebase/base";
const base = new Base();The default database is stored at:
.base/visiblebase.sqliteThe default SQLite path uses Node’s built-in node:sqlite, so Node >=22.13.0 is required.
If you need a specific database, provide database_url:
const base = new Base({
database_url: process.env.VISIBLEBASE_DATABASE_URL,
});Base initializes itself automatically on the first serve(), handleRequest(), models(), or invoke() call.
If your Base needs its own business tables, pass Drizzle schema when creating Base:
import { sqliteTable, text } from "drizzle-orm/sqlite-core";
const notes = sqliteTable("notes", {
id: text("id").primaryKey(),
title: text("title").notNull(),
status: text("status").notNull(),
});
const base = new Base({
schema: {
notes,
},
});
await base.table("notes").insert({
id: "note_1",
title: "First note",
status: "draft",
});Tables registered in schema use the same database connection as Base. On the first table() operation, Base initializes both its default Runtime tables and these business tables.
Only if you need to replace Base's Runtime-owned products/models table objects should you pass Runtime schema to the first init() call.
Start the HTTP service:
const server = await base.serve({
host: "127.0.0.1",
port: 3001,
});
console.log(`VisibleBase listening on http://${server.host}:${server.port}`);This service is the shared Base used by later products. Management and business data are handled through your own database and product backend for now.