The DynamoDB-first multi-language data contract.
One specification. Three runtimes. TableTheory keeps Go, TypeScript, and Python in lock-step on the same single-table model — verified on every commit by the P0 contract scenarios.
Where TableTheory shows up
Three distinct data domains in the Theory Cloud stack — one contract behind all of them.
Single-table modeling, marshaling, queries, and transactions across Go, TS, and Python.
How theory-mcp-server uses TableTheory to persist per-agent memory entries.
Tenants, sessions, MFA enrollments, and credentials persisted by Autheory — fail-closed encryption.
One model. Three runtimes.
Pick a language and ship the same contract.
go get github.com/theory-cloud/tabletheory@vX.Y.Z
```go package main import ( "log" "github.com/aws/aws-lambda-go/lambda" "github.com/theory-cloud/tabletheory" ) // Models are plain Go structs with theorydb: + json: struct tags. type Note struct { PK string `theorydb:"pk" json:"pk"` SK string `theorydb:"sk" json:"sk"` Body string `json:"body"` } var db *tabletheory.LambdaDB func init() { // Cold-start initialization — reused across invocations. var err error db, err = tabletheory.NewLambdaOptimized() if err != nil { log.Fatal(err) } } func handler() error { return db.Model(&Note{ PK: "USER#42", SK: "NOTE#welcome", Body: "Hello, Theory Cloud.", }).Create() } func main() { lambda.Start(handler) } ```npm install --save-exact https://github.com/theory-cloud/tabletheory/releases/download/vX.Y.Z/theory-cloud-tabletheory-ts-X.Y.Z.tgz
```typescript import { DynamoDBClient } from '@aws-sdk/client-dynamodb'; import { TheorydbClient, defineModel } from '@theory-cloud/tabletheory-ts'; // Models are declared explicitly via defineModel. const Note = defineModel({ name: 'Note', table: { name: 'notes' }, keys: { partition: { attribute: 'PK', type: 'S' }, sort: { attribute: 'SK', type: 'S' }, }, attributes: [ { attribute: 'PK', type: 'S', roles: ['pk'] }, { attribute: 'SK', type: 'S', roles: ['sk'] }, { attribute: 'body', type: 'S', optional: true }, ], }); const ddb = new DynamoDBClient({ region: 'us-east-1' }); const db = new TheorydbClient(ddb).register(Note); await db.create('Note', { PK: 'USER#42', SK: 'NOTE#welcome', body: 'Hello, Theory Cloud.', }); ```pip install https://github.com/theory-cloud/tabletheory/releases/download/vX.Y.Z/tabletheory_py-X.Y.Z-py3-none-any.whl
```python from dataclasses import dataclass import boto3 from theorydb_py import ModelDefinition, Table, theorydb_field # Models are plain dataclasses with theorydb_field roles. @dataclass(frozen=True) class Note: pk: str = theorydb_field(roles=["pk"]) sk: str = theorydb_field(roles=["sk"]) body: str = theorydb_field() client = boto3.client("dynamodb", region_name="us-east-1") model = ModelDefinition.from_dataclass(Note, table_name="notes") table = Table(model, client=client) table.put(Note(pk="USER#42", sk="NOTE#welcome", body="Hello, Theory Cloud.")) ```Quick starts
The deepest-value sections, ranked by how often new consumers reach for them.
Set up Lambda init for Go, TS, or Python.
Tag a struct with theorydb tags and you're done.
Single-table queries, GSIs, conditional reads.
Version-conditional writes across all runtimes.
KMS-backed field encryption that fails closed.
The P0 specification every runtime is tested against.