The polymorphic database powered by types

TypeDB is a polymorphic database with a conceptual data model, a strong subtyping system, a symbolic reasoning engine, and a beautiful and elegant type-theoretic language: TypeQL.

Review features Read philosophy
  1. 1
  2. 2
  3. 3
  4. 4
  5. 5
  6. 6
  7. 7
  8. 8
  9. 9
  10. 10
  11. 11
  12. 12
  13. 13
  14. 14
  15. 15
  16. 16
  17. 17
  18. 18
  19. 19
  20. 20
  21. 21
  22. 22
  23. 23
  24. 24
  25. 25
  26. 26
  27. 27
  28. 28
  29. 29
  30. 30
  31. 31
  32. 32
  33. 33

match $user isa user,
    has full-name $name,
    has email $email;
get; # This returns all users of any type

match $user isa employee,
    has full-name $name,
    has email $email,
    has employee-id $id;
get; # This returns only users who are employees

match $user-type sub user;
$user isa $user-type,
    has full-name $name,
    has email $email;
get; # This returns all users and their type

Harness subtyping to trivially write polymorphic queries, returning data of multiple types by querying a common supertype. Queries are automatically resolved against the schema to retrieve all data matching the declared pattern. Variablize any part of your queries to return types and roles along with data. As new types are added to the schema, they are automatically included in the results of pre-existing queries against their supertype, so queries never have to be refactored.

Learn more

Solve object-relational mismatch entirely within the database

Object-relational mismatch has plagued engineers since OOP became dominant. Relational databases were never built to contend with object models and cannot model inheritance. Both document and graph databases struggle to represent data outside their niches, while multi-model databases do little to solve the fundamental mismatch problem. In all contemporary databases, the focus is on storage format rather than the abstract model itself. TypeDB is unique in implementing conceptual data models without forcing them into predefined structures.

  1. 1
  2. 2
  3. 3
  4. 4
  5. 5
  6. 6
  7. 7
  8. 8
  9. 9
  10. 10
  11. 11
  12. 12
  13. 13
  14. 14
  15. 15
  16. 16
  17. 17
  18. 18
  19. 19
  20. 20
  21. 21
  22. 22
  23. 23
  24. 24
  25. 25
  26. 26
  27. 27
  28. 28
  29. 29
  30. 30
  31. 31
  32. 32
  33. 33

insert

$john isa full-time-employee,
    has full-name "John Doe", 
    has primary-email "john.doe@vaticle.com",
    has email "j.doe@vaticle.com",
    has email "john@vaticle.com",
    has employee-id 183;
$readme isa file, has path "/home/johndoe/repos/typedb/readme.md";
$edit isa action, has name "edit file";
$kevin isa user, has email "kevin@vaticle.com";

$perm (subject: $john, object: $readme, action: $edit) isa permission;
$rqst (target: $perm, requestee: $kevin) isa change-request, has requested-change "revoke";

TypeDB uses the Enhanced Entity-Relationship model with a declarative schema and static type checking. This allows the natural implementation of a type hierarchy, multivalued attributes, and n-ary and nested relations. Leverage OOP concepts like abstraction, inheritance, and polymorphism without warping the conceptual model. Normalization, null values, and reification are things of the past.

Learn more

Extend your data model continuously without refactoring or migrations

Extending a database often involves lengthy migration processes in which queries and application code have to be refactored. This involves reconciling the disparate structures between datasets and constructing a new data model that captures the polymorphism, leading to breaking changes in your code. Migration to a new model obsoletes existing queries, introduces new fields to existing objects, and changes the type signature of query results. TypeDB's polymorphism enables you to extend your model without refactoring queries, migrating data, or modifying code.

  1. 1
  2. 2
  3. 3
  4. 4
  5. 5
  6. 6
  7. 7
  8. 8
  9. 9
  10. 10
  11. 11
  12. 12
  13. 13
  14. 14
  15. 15
  16. 16
  17. 17
  18. 18
  19. 19
  20. 20
  21. 21
  22. 22
  23. 23
  24. 24
  25. 25
  26. 26
  27. 27
  28. 28
  29. 29
  30. 30
  31. 31
  32. 32
  33. 33

match
$user isa user, has email $email;
$rsrc isa! $resource-type, has id $id;
$resource-type sub resource;
$own (resource: $rsrc, owner: $user) isa resource-ownership;
get $email, $resource-type, $id;

TypeDB is a truly polymorphic database. Queries are written in a high-level declarative language and resolved against the schema at query-time. Variables implicitly match all valid types, so queries never have to be updated when new subtypes are added. Attributes and relations are always implemented in the same way, so cardinality changes never require a change to the underlying model. All this means that extensions to the data model are trivial, and don't require refactors.

Learn more

Avoid data redundancy and ensure data consistency in real-time

Resolving complex dependencies in data requires intricate combinations of query patterns that are computationally intensive to run. Precomputing data is often the only practical solution. This leads to stale, inconsistent, and incorrect data, creating problems when real-time, accurate data is critical. TypeDB's symbolic rules infer new data at query time, eliminating delay in synchronization. This ensures real-time access to consistent data backed by a single source of truth, avoiding data redundancy.

  1. 1
  2. 2
  3. 3
  4. 4
  5. 5
  6. 6
  7. 7
  8. 8
  9. 9
  10. 10
  11. 11
  12. 12
  13. 13
  14. 14
  15. 15
  16. 16
  17. 17
  18. 18
  19. 19
  20. 20
  21. 21
  22. 22
  23. 23
  24. 24
  25. 25
  26. 26
  27. 27
  28. 28
  29. 29
  30. 30
  31. 31
  32. 32
  33. 33

define
rule transitive-team-membership:
    when {
        (team: $team-1, member: $team-2) isa team-membership;
        (team: $team-2, member: $member) isa team-membership;   
    } then {
        (team: $team-1, member: $member) isa team-membership;
    };

match
$user isa user, has email $email;
$team isa team, has name $name;
(team: $team, member: $user) isa team-membership;
get $email, $name;

TypeDB's built-in reasoning engine allows rules to be defined in the schema and resolved at query time. Rules are constructed using first-order logic and define how new facts can be inferred from existing data. When a query is issued, matching rules are triggered using the most recent data available. This allows all computed data to be built on a single source of truth, ensuring accuracy and consistency without delay or redundancy.

Learn more

Develop on TypeDB with a powerful set of developer tools

With a diverse ecosystem of tools, you can develop applications on TypeDB the way you want. Deploy servers locally or in the cloud, as single nodes or clusters, and connect with a range of asynchronous clients.

Write robust code with TypeDB using native language drivers

With APIs delivered as native libraries in your language, you can write robust code with TypeDB using an asynchronous, reactive, stateful, and programmatic API.

View GitHub Learn more
cargo add typedb-driver
pip install typedb-driver
npm install typedb-driver
com.vaticle.typedb:typedb-driver # from https://repo.vaticle.com/repository/maven/
#include <typedb_driver.h>
#include <typedb.hpp>

C#

dotnet add package TypeDB.Driver

Go

go get github.com/vaticle/typedb-driver/go

Request your language

Run fully managed databases in TypeDB Cloud

TypeDB Cloud lets you deploy secure, scalable, and highly available databases on demand, for development or production. With project and team administration, it's easy to manage and monitor multiple deployments across your organization.

Learn more Sign up

Global deployment, cloud agnostic

Deploy in regions across AWS, GCP, and Azure (coming soon), with different databases in different cloud providers and geographies.

Scalability on demand, native clustering

Connect to clusters with topology-aware clients which can load balance requests across multiple replicas within a cluster.

Secure by default, roles and encryption

Ensure a high level of protection to safeguard data and maintain confidentiality with fully secured by default, with authentication as well as storage and network encryption.

Always available, automatic failover

Guarantee constant access to data thanks to synchronous replication and replicas which will automatically failover if the primary fails.

Teams and projects, organizational governance

Create teams, members and projects to manage databases across the entire organization with ease.

Join the global community of engineers developing with TypeDB

Open collaboration is a core value of the TypeDB community, and members actively discuss solutions on Discord and make contributions on GitHub. New faces are always welcome, and we hope to see you soon.

Discord

Twitter

YouTube

LinkedIn

Learn why developers love TypeDB

TypeDB is a polymorphic database that empowers engineers to address intricate challenges that are beyond the capabilities of conventional SQL or NoSQL modeling paradigms. Learn why they're building with TypeDB.

Get started today

Deploy locally or in the cloud and start building now, or explore more about TypeDB and how its unique capabilities as a polymorphic database can refine and empower your applications.

Start building

Cloud or container, a polymorphic database with a conceptual data model, a strong subtyping system, a symbolic reasoning engine, and a type-theoretic language is minutes away.

Deploy
Feedback