Installation
Get DeltaBase running in your project
Install the package
Section titled “Install the package”DeltaBase is distributed as a single npm package:
npm install @delta-base/server
That’s it. No complex setup. No database configuration. No infrastructure provisioning.
Get an API key
Section titled “Get an API key”During early access, join our Discord and ask for an API key: https://discord.gg/nibbio
We’ll get you set up immediately. No waiting.
Test your setup
Section titled “Test your setup”Create a test file to verify everything works:
import { DeltaBase } from '@delta-base/server';
const deltabase = new DeltaBase({ apiKey: 'your-api-key-here'});
async function test() { const eventStore = deltabase.getEventStore('test');
console.log('Testing DeltaBase connection...');
try { await eventStore.appendToStream('test-stream', [ { type: 'test.event', data: { message: 'Hello DeltaBase!' } } ]);
const events = await eventStore.readStream('test-stream'); console.log('Success! Events:', events.length); } catch (error) { console.error('Failed:', error.message); }}
test();
Run it:
node test.js
If you see “Success! Events: 1”, you’re ready to build.
Environment setup
Section titled “Environment setup”Never hardcode API keys. Use environment variables:
DELTABASE_API_KEY=your-api-key-here
Update your code:
import { DeltaBase } from '@delta-base/server';
const deltabase = new DeltaBase({ apiKey: process.env.DELTABASE_API_KEY});
TypeScript support
Section titled “TypeScript support”DeltaBase includes full TypeScript definitions. No additional setup needed:
import { DeltaBase, EventStore } from '@delta-base/server';
interface UserRegistered { type: 'user.registered'; data: { email: string; name: string; };}
const deltabase = new DeltaBase({ apiKey: process.env.DELTABASE_API_KEY!});
const eventStore: EventStore = deltabase.getEventStore('users');
// Fully typedawait eventStore.appendToStream<UserRegistered>('user-123', [ { type: 'user.registered', data: { email: 'john@example.com', name: 'John Doe' } }]);
Framework integration
Section titled “Framework integration”Express.js
Section titled “Express.js”import express from 'express';import { DeltaBase } from '@delta-base/server';
const app = express();const deltabase = new DeltaBase({ apiKey: process.env.DELTABASE_API_KEY});
app.use((req, res, next) => { req.eventStore = deltabase.getEventStore('app'); next();});
app.post('/users', async (req, res) => { await req.eventStore.appendToStream(req.body.userId, [ { type: 'user.created', data: req.body } ]); res.json({ success: true });});
Next.js
Section titled “Next.js”import { DeltaBase } from '@delta-base/server';
export const deltabase = new DeltaBase({ apiKey: process.env.DELTABASE_API_KEY});
// pages/api/users.jsimport { deltabase } from '../../lib/deltabase';
export default async function handler(req, res) { const eventStore = deltabase.getEventStore('users');
if (req.method === 'POST') { await eventStore.appendToStream(req.body.userId, [ { type: 'user.created', data: req.body } ]); res.json({ success: true }); }}
Serverless (Vercel, Netlify)
Section titled “Serverless (Vercel, Netlify)”Works out of the box. DeltaBase is designed for serverless:
import { DeltaBase } from '@delta-base/server';
const deltabase = new DeltaBase({ apiKey: process.env.DELTABASE_API_KEY});
export default async function handler(req, res) { const eventStore = deltabase.getEventStore('webhooks');
await eventStore.appendToStream('webhook-events', [ { type: 'webhook.received', data: req.body } ]);
res.json({ received: true });}
Local development
Section titled “Local development”For local development, you can use the same API key. DeltaBase automatically handles:
- Connection pooling
- Error retry
- Rate limiting
No need for a local event store or complex setup.
Production checklist
Section titled “Production checklist”Before going live:
- API key stored in environment variables
- Error handling implemented
- Logging configured
- Event schemas documented
Getting help
Section titled “Getting help”If something doesn’t work:
- Check your API key is correct
- Verify your internet connection
- Join our Discord: https://discord.gg/nibbio
We’re usually online and respond quickly.
What’s next?
Section titled “What’s next?”Now that DeltaBase is installed, you can:
- Get Started - Your first event in 5 minutes
- Build Your First App - Complete tutorial
- Set Up Real-time Updates - Make it reactive
DeltaBase is designed to get out of your way so you can focus on building great software.