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 ... │└──────────────┴──────────────┴──────────────┴───────────────────────────┘Via Dashboard (Panel)
Section titled “Via Dashboard (Panel)”The visual way. Go to app.delta-base.com, click “Create Event Store”, and you’re done.
Steps:
- Sign in to the DeltaBase Panel
- Select your organization
- Click “Create Event Store”
- Enter a name and description
- Click “Create”
Best for: Quick experimentation, non-developers, visual thinkers.
Via CLI (Infrastructure as Code)
Section titled “Via CLI (Infrastructure as Code)”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:
pnpx @delta-base/cli deploy --api-key your-api-keyBest for: Teams, CI/CD pipelines, version-controlled infrastructure.
Learn more: Infrastructure as Code Guide
Via Server SDK
Section titled “Via Server SDK”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 storeconst 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.
Via REST API
Section titled “Via REST API”The universal way. Works from any language or tool.
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
Which Should You Use?
Section titled “Which Should You Use?”| Scenario | Recommended Method |
|---|---|
| Getting started / learning | Dashboard or Local Development |
| Production deployments | CLI with deltabase.config.ts |
| Multi-tenant SaaS | SDK with dynamic creation |
| Non-TypeScript apps | REST API |
| CI/CD automation | CLI or REST API |
Decision Flowchart
Section titled “Decision Flowchart”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 APILocal Development
Section titled “Local Development”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.
pnpx @delta-base/cli devThis 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.
What’s Next?
Section titled “What’s Next?”- Infrastructure as Code - Deep dive into CLI deployments
- Subscriptions & Streaming - React to events in real-time
- Deploy to Production - Get your app live