Skip to content

Getting Started

Your first DeltaBase app in 5 minutes

Let’s get you up and running with DeltaBase. No theory. No marketing speak. Just a working event-sourced app in 5 minutes.

  • Node.js 16+ (you probably have this)
  • An API key (we’ll give you one)
  • 5 minutes

During early access, join our Discord and ask for an API key: https://discord.gg/nibbio

We’ll get you set up immediately. No forms, no sales calls.

Terminal window
mkdir deltabase-quickstart
cd deltabase-quickstart
npm init -y
npm install @delta-base/server

Create index.js:

import { DeltaBase } from '@delta-base/server';
const deltabase = new DeltaBase({
apiKey: 'your-api-key-here' // Replace with your actual key
});
const eventStore = deltabase.getEventStore('quickstart');
async function main() {
console.log('Creating your first event...');
// Append an event
await eventStore.appendToStream('user-123', [
{
type: 'user.registered',
data: {
email: 'john@example.com',
name: 'John Doe'
}
}
]);
console.log('Event created! Reading it back...');
// Read the event
const events = await eventStore.readStream('user-123');
console.log('Events:', events);
console.log('Done! You just did event sourcing.');
}
main().catch(console.error);
Terminal window
node index.js

You should see:

Creating your first event...
Event created! Reading it back...
Events: [
{
streamId: 'user-123',
type: 'user.registered',
data: { email: 'john@example.com', name: 'John Doe' },
// ... other event metadata
}
]
Done! You just did event sourcing.
  1. You created an event - user.registered with some data
  2. DeltaBase stored it - In a stream called user-123
  3. You read it back - From the same stream

That’s event sourcing. Events go in, events come out. Everything else is just details.

Add another event to the same stream:

// Add this to your main() function, before reading events
await eventStore.appendToStream('user-123', [
{
type: 'user.email_changed',
data: {
oldEmail: 'john@example.com',
newEmail: 'john.doe@example.com'
}
}
]);

Run it again. You’ll see both events in order. That’s your audit trail.

This was just the basics. For a real application, check out:

You just stored your first events. Now you can:

  • Query events across streams
  • Subscribe to real-time updates
  • Build views from events
  • Handle complex business logic

Event sourcing isn’t scary. It’s just a different way of thinking about data. And once you get it, you’ll wonder how you ever built apps without it.