About TamaDB

TamaDB is a basic document-oriented NoSQL database engine sitting at the core of data exchange within a smart-endpoints/dumb-pipes architecture. The term "basic" reflects its intentionally limited ability to perform complex operations at the document level — it is designed primarily as a high-performance cache for transferring JSON documents between data producers and consumers. The database stores JSON documents in a tree-like structure with unique identifiers, supports atomic attribute-level updates with history tracking, and provides multiple retrieval patterns. The system offers three document models (Closed, Open, and Hybrid) with optional JSON schema enforcement for data integrity.

What Problem Does TamaDB Solve?

In modern data architectures, systems need to exchange structured data between producers (sensors, applications, services) and consumers (dashboards, analytics, downstream services) with minimal latency and maximum reliability.

TamaDB is a high-performance transportation cache — a purpose-built intermediary that:

  • Receives JSON documents from multiple producers via dedicated channels
  • Validates documents against registered JSON schemas
  • Stores temporarily with configurable time-to-live (TTL)
  • Pushes updates to registered consumers in real-time via webhooks

TamaDB is not a general-purpose database. It is intentionally limited in scope: no complex queries, no joins, no aggregations. Its strength is speed, simplicity, and reliable data delivery.

Architectural Position

TamaDB and PamaDB together form the Transmission Layer — the intermediary between producers and consumers:

Architecture diagram showing the Transmission Layer: Producers send data to TamaDB, which can deliver directly to Consumers. PamaDB extends TamaDB for transformed delivery to Consumers.

How the Transmission Layer works:

  • Producers send data into the Transmission Layer via TamaDB (the entry point)
  • TamaDB validates, versions, stores, and can deliver directly to consumers
  • PamaDB extends TamaDB for delivery requirements outside TamaDB's scope (transformations, frozen documents, publishing)
  • Consumers receive data from either TamaDB or PamaDB, depending on the delivery criteria
  • Delivery criteria can be defined by either the producer or the consumer

Key principle: Dumb-pipe role. TamaDB never alters document content. It validates, stores, versions, and delivers — nothing more. PamaDB handles any transformation needs.

Core Concepts

Document

A JSON object stored in TamaDB. Documents are structured as trees of Bunches (objects) and Leaves (terminal values). Each leaf is independently versioned and has its own history.

Document_Type

The central organising concept. Every document belongs to exactly one Document_Type, which defines: the Master_Schema (what fields are valid and required), the document model (how strictly the schema is enforced), Channels (ingestion endpoints), TTL (document lifespan), and Subscriptions (notification targets).

Channels

An ingestion endpoint tied to a Document_Type. Producers push data to a channel URL. Each channel can have its own Channel_Schema (a subset of the Master_Schema), enrichment bindings (TamaDB injects fields the producer doesn't send), and status control (active, inactive, or blocked).

Upsert & Merge Semantics

TamaDB has a single ingestion operation — upsert. There is no separate "create" vs "update". If the document doesn't exist, it's created. If it exists, incoming fields are merged into the stored document. Fields present in the payload update (previous value goes to history). Fields absent from the payload are preserved unchanged. No data is ever removed by a store operation.

Subscriptions

Consumers register webhooks (callback URLs) and receive real-time updates. Subscriptions can be at the Document_Type level (fires for any document of that type) or D-Id level (fires for a specific document only). Payload is snapshotted at the moment of update — delivery is decoupled from the store.

Document TTL

Every document has a time-to-live. TamaDB is a cache, not an archive. TTL hierarchy: Document > Document_Type > Instance (most specific wins). Expired documents are soft-deleted. TTL=0 means "process and deliver, but don't cache" (transient).

Schema Validation

TamaDB validates documents on ingestion using JSON Schema (Draft 7). Required fields must be present, field types must match, and unknown fields are rejected under the Document Closed Model (DCM). Validation happens on the Enriched_Document (payload + channel-supplied fields).

Document Models

Model Increment Schema Required Unknown Fields Use Case
DCM (Document Closed Model) 1 Yes Rejected Strict data contracts
HDOM (Hybrid Document Open Model) 2 Yes Allowed as extensions Evolving schemas
DOM (Document Open Model) 3 Optional Allowed Schema-free rapid prototyping

TamaDB vs Alternatives

Alternative What TamaDB Does Differently
Redis Redis is a key-value store. TamaDB provides leaf-level versioning, merge semantics, schema validation, structured webhook delivery, and per-field history.
MongoDB MongoDB is a general-purpose document DB. TamaDB is a purpose-built transportation cache with per-leaf versioning, merge-only upsert (fields are never lost), and push-first webhook delivery. Schema-strict, short-lived, not designed for long-term storage or complex queries.
Kafka Kafka is a distributed log delivering raw events in order. TamaDB delivers the current merged state of a document to subscribers. They're complementary, not competing.
MQTT MQTT delivers messages. TamaDB receives messages, validates against a schema, merges into a versioned document state, and delivers the merged result. TamaDB adds structure and state to raw message passing.

Increment 1 — What's Delivered

Capabilities

Area What's Included
IngestionREST endpoint per Document_Type and per channel, upsert-merge semantics
ValidationDCM schema enforcement, required fields, type checking, conditional rules
IdentityD-Id extraction from document fields (identityKind annotations), single and composed keys
VersioningPer-leaf history with configurable depth, optimistic concurrency control
ChannelsRegistration, status management (active/inactive/blocked), schema assignment
EnrichmentStatic field injection per channel, conflict detection + policy resolution
DeliveryWebhook subscriptions (Document_Type-level and D-Id-level), envelope/raw format
TTLThree-scope hierarchy, background sweep, on-access check, TTL=0 transient processing
QuarantineRejected payload storage with policy control, read-only inspection API
StorageMemory, disk, hybrid, and auto strategies with runtime switching
ObservabilityStructured JSON logging, runtime-configurable levels and destination
APIFull REST/HTTP API (~40 endpoints) for all operations and configuration

Technology Stack

Layer Technology
RuntimeNode.js 22 (ESM)
LanguageTypeScript 6 (strict mode)
HTTP FrameworkFastify 5
Schema ValidationAjv 8 (JSON Schema Draft 7)
LoggingPino 10 (structured JSON)
TestingVitest 4 + fast-check 4 (property-based)

Roadmap

Increment 2

  • HDOM (Hybrid Document Open Model) — schema validation for known fields, extensions allowed
  • Discrete leaf updates — update individual fields by path without sending full document
  • Foreign D-Ids (full) — dynamic/rule-based identity derivation
  • Library Sections — category-based document grouping
  • Subscription updates — in-place modification of active subscriptions
  • Schema adoption — propagate mode auto-adopts latest Retrieval_Schema version

Increment 3

  • DOM (Document Open Model) — no schema enforcement, fully dynamic
  • Alien D-Ids — documents with no identity (immutable, non-updatable one-shots)
  • Element-level arrays — address individual array elements (sparse transmission)

Future Vision

  • PamaDB — data publishing layer (transformations, frozen documents, hard subscriptions)
  • Sanitation — validate stored documents against template schemas
  • Multi-protocol — gRPC, WebSocket ingestion alongside REST
  • Idempotent updates — detect and skip duplicate payloads
  • Storage segmentation — per-Document_Type data isolation

End-to-End Data Flow

Sequence diagram showing the end-to-end data flow: Producer sends POST to TamaDB, which processes through 9 pipeline steps (parse, enrich, extract D-Id, validate, merge, version, TTL, match subscriptions, snapshot), returns 201 to Producer, then delivers webhook POST to Consumer who responds 200 OK.