TypeBridge is a typed application toolkit for TypeDB. It defines and evolves schemas, generates application models, and provides native Python, TypeScript/Node, and Rust data APIs. One Rust semantic engine owns schema, query, migration, validation, and ORM behavior across every SDK and the standalone query server.
| Surface | Use it for | Distribution |
|---|---|---|
| Python | Declarative Pydantic models, CRUD, queries, schema management | type-bridge |
| TypeScript / Node | Branded models, typed managers, queries, native runtime | @type-bridge/node |
| Rust | Generated schema crates, async CRUD and immutable queries | Exact release source/Git revision |
| CLI and generators | Split-YAML schemas, migrations, Python/Node/Rust projections | Included with the Python package |
| Server | Remote V2 query execution over the same contracts | ghcr.io/ds1sqe/type-bridge-server |
TypeBridge is designed around TypeDB rather than flattened into a relational ORM shape:
- attributes remain independent types owned by entities and relations;
- roles, inheritance, cardinality, ordering,
@key, and@uniquestay typed; - schema generation and migration use the same rules as runtime queries;
- direct and remote immutable queries preserve typed, owner-aware results;
- Python and Node are thin facades over the shared Rust runtime.
Requires Python 3.12–3.14 and a supported TypeDB 3.x server.
pip install type-bridgefrom type_bridge import Database, Entity, Flag, Integer, Key, SchemaManager, String
class PersonId(String):
pass
class Age(Integer):
pass
class Person(Entity):
person_id: PersonId = Flag(Key)
age: Age | None = None
db = Database(address="localhost:1729", database="example")
db.connect()
db.create_database()
schema = SchemaManager(db)
schema.register(Person)
schema.sync_schema()
ada = Person(person_id=PersonId("ada"), age=Age(36))
Person.manager(db).put(ada)
people = Person.manager(db).filter(age__gte=18).all()Continue with the Python quick start, then choose the model, data, or schema workflow.
npm install @type-bridge/nodeimport { Entity, Key, attr, field } from "@type-bridge/node";
class PersonId extends attr.String("person-id") {}
class Person extends Entity("person", {
personId: field(PersonId, Key),
}) {}
const ada = new Person({ personId: new PersonId("ada") });See the TypeScript/Node guide for native targets, database lifecycle, managers, queries, and generation.
The V2 workspace makes a versioned Split-YAML schema the authority and projects it into each configured SDK:
type-bridge --manifest typebridge.yaml schema check
type-bridge --manifest typebridge.yaml schema generate
type-bridge --manifest typebridge.yaml migration make --name initial
type-bridge --manifest typebridge.yaml migration apply --environment developmentThe generated Rust SDK requires Rust 1.88+ and the exact Git revision recorded by the matching release; it is not distributed from crates.io in 2.0. Follow the Rust client guide and Split-YAML reference for the reproducible setup.
- Install a surface
- Choose an SDK
- Model TypeDB data
- Read and write data
- Manage schemas and migrations
- Run the server
- Upgrade to 2.0
- Python API reference
TypeBridge 2.0.x supports TypeDB 3.8–3.12. Support for 3.8 and 3.10 is deprecated and scheduled for removal in 2.1; consult the compatibility matrix and deprecation inventory before upgrading production deployments.
PYO3_USE_ABI3_FORWARD_COMPATIBILITY=1 uv sync --extra dev
uv run pytest
./test.sh
./scripts/check.sh all
uv run --extra docs mkdocs build --strictSee DEVELOPMENT.md for repository layout, test tiers, docs architecture, and contribution checks.
TypeBridge-authored code is MIT licensed. Native artifacts also include
third-party TypeDB components under Apache-2.0 and MPL-2.0; exact notices ship
with each artifact and are documented in
type-bridge-core/vendor/README.md.