Skip to content

Model TypeDB data

TypeBridge models TypeDB concepts directly: attributes are independent types, entities and relations own attributes, relations declare roles, and player types play those roles.

Build a model

  1. Define attribute types and their value domains.
  2. Define entities, ownership, and inheritance.
  3. Define relations and roles.
  4. Express cardinality, keys, uniqueness, ordering, and metadata.
  5. Use abstract types for polymorphic contracts.
  6. Apply validation and serialization at the application boundary.

Python models are Pydantic classes. The TypeScript facade uses branded attribute and model constructors. Schema-first workspaces can generate both surfaces plus a Rust schema crate from the same authority.

Application projections

  • API DTOs generate create, patch, and output shapes without exposing persistence-only fields.
  • Code generation projects TypeQL or canonical workspace schemas into application-owned model packages.
  • TypeScript/Node explains branded attribute values and the JavaScript bigint boundary.
  • Rust explains generated create/model types and schema binding.

Once the model is defined, continue with read and write workflows.