Skip to content

Creating Event Stores

Four ways to create event stores - use whichever fits your workflow

DeltaBase offers four ways to create event stores. Use whichever fits your workflow.

┌─────────────────────────────────────────────────────────────────────────┐
│ Creating Event Stores │
├──────────────┬──────────────┬──────────────┬───────────────────────────┤
│ Dashboard │ CLI │ SDK │ REST API │
│ (Panel) │ (IaC) │(Programmatic)│ (Universal) │
│ │ │ │ │
│ Visual UI │ deltabase │ management │ POST /event-stores │
│ Click to │ .config.ts │ Client │ │
│ create │ + deploy │ .create() │ curl ... │
└──────────────┴──────────────┴──────────────┴───────────────────────────┘

The visual way. Go to app.delta-base.com, click “Create Event Store”, and you’re done.

Steps:

  1. Sign in to the DeltaBase Panel
  2. Select your organization
  3. Click “Create Event Store”
  4. Enter a name and description
  5. Click “Create”

Best for: Quick experimentation, non-developers, visual thinkers.


The DevOps way. Define your event stores in code, deploy with a command.

Create a deltabase.config.ts file in your project:

import type { InfrastructureConfig as DeltaBaseConfig } from '@delta-base/server';
const config: DeltaBaseConfig = {
eventStores: [
{
name: 'my-service-events',
description: 'Events for my service',
subscriptions: [
{
id: 'my-projection',
eventFilter: ['user.created', 'user.updated', 'user.deleted'],
subscriberType: 'webhook',
webhook: {
url: `${process.env.SERVICE_URL}/api/projections/users/events`,
headers: {
Authorization: `Bearer ${process.env.PROJECTION_AUTH_TOKEN}`,
},
retryPolicy: {
maxAttempts: 5,
backoffMinutes: 2,
},
},
},
],
},
],
};
export default config;

Deploy your infrastructure:

Terminal window
pnpx @delta-base/cli deploy --api-key your-api-key

Best for: Teams, CI/CD pipelines, version-controlled infrastructure.

Learn more: Infrastructure as Code Guide


The programmatic way. Create event stores from your application code.

import { DeltaBase } from '@delta-base/server';
const deltabase = new DeltaBase({
apiKey: process.env.DELTABASE_API_KEY,
baseUrl: 'https://api.delta-base.com',
});
const managementClient = deltabase.getManagementClient();
// Create an event store
const eventStore = await managementClient.createEventStore({
name: 'tenant-123-events',
description: 'Events for tenant 123',
});
console.log('Created event store:', eventStore.name);

Best for: Multi-tenant SaaS apps, dynamic creation, automated setup.


The universal way. Works from any language or tool.

Terminal window
curl -X POST https://api.delta-base.com/api/event-stores \
-H "Authorization: Bearer your-api-key" \
-H "Content-Type: application/json" \
-d '{
"name": "my-event-store",
"description": "My application events"
}'

Response:

{
"id": "es_abc123",
"name": "my-event-store",
"description": "My application events",
"status": "active",
"createdAt": "2024-01-01T00:00:00.000Z"
}

Best for: Non-TypeScript applications, shell scripts, automation tools.

Learn more: API Reference


ScenarioRecommended Method
Getting started / learningDashboard or Local Development
Production deploymentsCLI with deltabase.config.ts
Multi-tenant SaaSSDK with dynamic creation
Non-TypeScript appsREST API
CI/CD automationCLI or REST API
Start
├─ Are you just experimenting?
│ └─ Yes → Use Dashboard or `deltabase dev`
├─ Do you need version-controlled infrastructure?
│ └─ Yes → Use CLI with deltabase.config.ts
├─ Do you create event stores dynamically (e.g., per tenant)?
│ └─ Yes → Use SDK
└─ Using a non-TypeScript language?
└─ Yes → Use REST API

For local development, you don’t need to create event stores manually. The deltabase dev command provides a local environment where you can create event stores via the Studio UI or SDK.

Terminal window
pnpx @delta-base/cli dev

This starts:

  • API Server at http://localhost:8787
  • Studio UI at http://localhost:3000

Create event stores through the Studio UI or use the SDK pointing to localhost:8787.