🐻

KUMA

Entity-Native Storage Engine for the BEAM

One entity. One actor. One writer.
No conflicts. Ever.

↓
0
writes/sec per entity
0
shards per context
0
lock conflicts
<0
read latency

CAPABILITIES

Built Different

⟫

EVENT SOURCED

Append-only log of facts. Complete audit trail. Time travel to any point in history.

⊑

ACTOR PER ENTITY

One process. One mailbox. One writer. No locks, no conflicts, no surprises.

⬑

SQLITE SHARDS

WAL mode, durable before ack, readable backups. Your data, your files.

⛨

GDPR NATIVE

export() and delete() are single operations. Compliance by design.

βŽ”

CLUSTERING

Multi-node with consistent hashing. Zero-downtime migration. Scale horizontally.

β—ˆ

PROJECTIONS

Async read models via rqlite. Eventually consistent queries. Decoupled reads.

QUICK START

Gleam in Action

main.gleam
import kuma
import kuma/entity.{Entity}
import kuma/event.{Event}

// Define your entity type
pub type Account {
  Account(id: String, balance: Int, name: String)
}

// Define your events
pub type AccountEvent {
  Deposited(amount: Int)
  Withdrawn(amount: Int)
  Renamed(name: String)
}

pub fn main() {
  // Start Kuma with 16 shards
  let assert Ok(ctx) = kuma.start(kuma.Config(
    path: "/data/accounts",
    shards: 16,
  ))

  // Create an entity β€” spawns a dedicated actor
  let assert Ok(account) = kuma.spawn(ctx, "acc_001", Account(
    id: "acc_001",
    balance: 0,
    name: "Savings",
  ))

  // Append events β€” durable before ack
  kuma.append(account, Deposited(amount: 1000))
  kuma.append(account, Deposited(amount: 500))
  kuma.append(account, Withdrawn(amount: 200))

  // Read state β€” from actor memory, <1ms
  let assert Ok(state) = kuma.read(account)
  // state.balance == 1300 βœ“

  // GDPR: export all data for a user
  let assert Ok(data) = kuma.export(account)

  // GDPR: right to be forgotten
  kuma.delete(account)
}

INTERNALS

Architecture

architecture.txt
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚  KUMA β€” Entity-Native Storage Engine                          β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚                                                                  β”‚
β”‚  Client Request                                                β”‚
β”‚       β”‚                                                          β”‚
β”‚       β–Ό                                                          β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    hash(entity_id)    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”          β”‚
β”‚  β”‚ Router      │───────────────────▢│ Shard N      β”‚          β”‚
β”‚  β”‚             β”‚                    β”‚ (1 of 16+)   β”‚          β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜                    β””β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”˜          β”‚
β”‚                                            β”‚                    β”‚
β”‚                                            β–Ό                    β”‚
β”‚                                    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”              β”‚
β”‚                                    β”‚ Entity Actor β”‚              β”‚
β”‚                                    β”‚ (1:1 per ID) β”‚              β”‚
β”‚                                    β””β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”˜              β”‚
β”‚                                           β”‚                      β”‚
β”‚                              β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”          β”‚
β”‚                              β–Ό            β–Ό            β–Ό          β”‚
β”‚                        β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”‚
β”‚                        β”‚ State    β”‚ β”‚ Events   β”‚ β”‚ Publish  β”‚    β”‚
β”‚                        β”‚ (memory) β”‚ β”‚ (SQLite) β”‚ β”‚ (async)  β”‚    β”‚
β”‚                        β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”˜    β”‚
β”‚                                                        β”‚          β”‚
β”‚                                                        β–Ό          β”‚
β”‚                                                  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”‚
β”‚                                                  β”‚Projectionsβ”‚    β”‚
β”‚                                                  β”‚ (rqlite)  β”‚    β”‚
β”‚                                                  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜    β”‚
β”‚                                                                  β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

USE CASES

When to Use Kuma

β–Έ

Per-Entity CRUD

Each entity is an isolated actor with its own lifecycle and state.

β–Έ

Event Sourcing

Append-only event log with full replay and time travel capabilities.

β–Έ

Audit Trails

Every mutation is recorded. Nothing is ever lost or overwritten.

β–Έ

GDPR Compliance

Export and delete are first-class operations, not afterthoughts.

β–Έ

High-Write Throughput

50K+ writes/sec per entity. Actor isolation means no contention.

β–Έ

Multi-Tenant Systems

Natural isolation at the entity level. Perfect for SaaS backends.