thingd-core
Core storage engine for thingd — an object-first data engine for applications and AI agents.
This crate provides the storage boundary: object CRUD, append-only events, durable job queues, full-text search, and graph links. It ships with two engines: an in-memory engine for fast prototyping and testing, and an optional SQLite-backed engine for durable production storage.
Why thingd-core?
Modern apps and AI agents commonly need:
- Object storage without designing relational schemas first
- Full-text search across objects and events
- Append-only event logs for audit trails and timelines
- Durable job queues with leases, retries, and dead-letter handling
- Graph links between objects, memories, and decisions
Today you stitch these together from 3-5 separate tools. thingd-core gives you all five primitives behind a single composable trait interface.
Feature Flags
| Feature | Default | Description |
|---|---|---|
sqlite |
No | Enables rusqlite-backed SqliteThingStore with FTS5 search, WAL mode, and auto-migration |
connectors |
No | Enables CSV/JSON file connectors for data import |
Quick Start
In-memory engine (zero setup)
use ;
let mut engine = new;
engine.put_object.unwrap;
let user = engine.get_object.unwrap;
assert_eq!;
SQLite engine (durable storage)
use ;
let mut db = open_in_memory.unwrap;
db.put_object.unwrap;
let user = db.get_object.unwrap;
assert_eq!;
Full-text search
use ;
let mut db = open_in_memory.unwrap;
db.put_object.unwrap;
db.put_object.unwrap;
let hits = db.search.unwrap;
assert!;
Append-only events
use ;
let mut db = open_in_memory.unwrap;
db.append_event.unwrap;
Durable job queues
use ;
let mut db = open_in_memory.unwrap;
let job = new.into;
db.push_job.unwrap;
let claimed = db.claim_job_with_options.unwrap;
assert!;
db.ack_job.unwrap;
Graph links
use ;
let mut db = open_in_memory.unwrap;
db.create_link.unwrap;
let neighbors = db.get_neighbors.unwrap;
assert_eq!;
Traits
The crate is built around composable traits:
| Trait | Description |
|---|---|
ObjectStore |
CRUD for versioned JSON objects in named collections |
EventLog |
Append-only event streams with sequence numbers |
QueueStore |
Job queues with lease/ack/nack lifecycle, retries, dead-letter |
Searcher |
Full-text search with collection filters and recency ranking |
LinkStore |
Typed graph links between objects |
ThingStore |
Super-trait combining all of the above |
Both MemoryEngine and SqliteThingStore implement all five traits.
Key Types
| Type | Description |
|---|---|
MemoryObject |
A versioned JSON object keyed by (collection, id) |
MemoryEvent |
An event with stream, type, body, and sequence number |
QueueJob |
A job with status, attempts, lease, and retry metadata |
SearchHit |
A search result with kind, collection, score, and body |
Link |
A typed directed edge between two object references |
ThingdError |
Error type (InvalidInput, NotFound, Conflict, Storage) |
Comparison
| Tool | Great at | Why thingd-core is different |
|---|---|---|
| SQLite | relational storage | object API, events, queues, search, graph |
| MongoDB | flexible documents | local-first, Rust, no server process |
| Redis / BullMQ | fast queues | durable local storage without Redis |
| LanceDB | vector search | broader memory runtime with events and queues |
| Diesel / SQLx | type-safe SQL | higher-level object/queue/event API |
License
Apache-2.0 — see LICENSE.