Skip to content

DeltaBase

API reference for DeltaBase

@delta-base/server


DeltaBase client for interacting with the Delta-Base platform.

This is the main entry point for the SDK that provides access to:

  • Management operations (create/delete event stores)
  • Event store operations (append/read events)
  • Event bus functionality (subscriptions and real-time updates)
// Initialize the client
const client = new DeltaBase({
apiKey: "your-api-key"
});
// Access various functionality
const management = client.getManagement();
const eventStore = client.getEventStore("my-store");
const eventBus = client.getEventBus("my-store");

new DeltaBase(config): DeltaBase

Creates a new DeltaBase client instance.

DeltaBaseConfig

Configuration options for connecting to the Delta-Base platform

DeltaBase

If neither apiKey nor headers are provided in the configuration

// Create with API key (standard authentication)
const client = new DeltaBase({ apiKey: "your-api-key" });
// Create with custom URL (production)
const prodClient = new DeltaBase({
baseUrl: "https://api.delta-base.com",
apiKey: "your-api-key"
});
// Create with custom headers (internal service authentication)
const internalClient = new DeltaBase({
baseUrl: "https://api.delta-base.com",
headers: {
'X-Deltabase-Internal-Service': 'auth-service',
'X-Deltabase-Internal-Token': 'internal-token'
}
});

getEventBus(eventStoreName): EventBus

Get an EventBus client for a specific event store

string

The name of the event store to manage subscriptions for

EventBus

An EventBus client instance configured for the specified event store

const eventBus = client.getEventBus("my-event-store");
const subscription = await eventBus.createSubscription({
name: "user-events",
eventFilter: "user.*"
});

getEventStore(eventStoreName): EventStore

Get an EventStore client for a specific event store

string

The name of the event store to connect to

EventStore

An EventStore client instance configured for the specified event store

const eventStore = client.getEventStore("my-event-store");
await eventStore.appendToStream("user-123", [
{ type: "UserCreated", data: { userId: "123", name: "John" } }
]);

getManagement(): ManagementClient

Get a ManagementClient for managing event stores

ManagementClient

A ManagementClient instance for creating and managing event stores

const management = client.getManagement();
const eventStore = await management.createEventStore({
name: "my-event-store"
});