Skip to content

Latest commit

 

History

History
80 lines (56 loc) · 2.63 KB

File metadata and controls

80 lines (56 loc) · 2.63 KB
title Quickstart
description Install the `dbx` CLI, start the daemon, mint a token, and write your first aggregate.

EventDBX ships as a single CLI named dbx. Follow the steps below to go from zero to a running daemon with authenticated client access.

npm install -g eventdbx
dbx start --foreground
  • Omit --foreground to run as a background service.
  • Use --restrict=strict once your schemas are locked in.
  • Logs stream to stdout; press Ctrl+C to stop the daemon when running in the foreground.

Generate boostrap token for initial access

dbx token bootstrap --stdout
  • Revoke tokens with dbx token revoke <jti> if they leak.
  • Mint short-lived tokens with dbx token generate ... --ttl 10m.
  • See Authorization for scoping --action/--resource and tenants.
import { createClient } from "eventdbxjs";

const client = createClient({
  ip: process.env.EVENTDBX_HOST ?? "127.0.0.1",
  port: Number(process.env.EVENTDBX_PORT) || 6363,
  token: process.env.EVENTDBX_TOKEN,
  tenantId: "default",
});

await client.connect();

await client.create("person", "p-110", "person_created", {
  payload: {
    fist_name: "Demo",
    last_name: "Demo",
    email: "jane@example.com",
  },
  metadata: { "@createdBy": "<current-id>" },
  note: "person created by <email>",
});

const history = await client.events("person", "p-110");
console.log("Event count:", history.length);

await client.disconnect();

Swap in the Python, Java, PHP, .NET, or Go SDKs described on the Client SDKs page if you prefer another language.

Next steps

  • Schema setup: use CLI schema commands to create and evolve schemas (e.g., dbx schema create ..., dbx schema add ..., dbx schema remove ..., dbx schema field ..., dbx schema alter ...), or edit the schema.json files under your shard folders if you prefer to define them manually; see dbx schema --help for the full command surface.
  • Snapshots and verification: dbx aggregate snapshot <aggregate> <id> materializes the latest state, and dbx aggregate verify recomputes Merkle roots when you need to prove integrity.
  • Replication: run dbx watch standby to stream changes to a standby node, or dbx push/pull for one-off syncs.
  • Plugins: configure HTTP or TCP plugins to fan events out to downstream services once your domain is populated.

Every CLI command accepts --config <path> if you need to target a custom configuration file or environment.