Skip to content
/ typedb Public

TypeDB: the power of programming, in your database

License

Notifications You must be signed in to change notification settings

typedb/typedb

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

TypeDB

Factory CircleCI GitHub release Discord Discussion Forum Hosted By: Cloudsmith

Introducing TypeDB

TypeDB is a next-gen database with a modern programming paradigm that lets you build data applications faster, safer, and more elegantly. Its intuitive and powerful data model unifies the strengths of relational, document and graph databases without their shortcomings. TypeQL, its groundbreaking query language, is declarative, functional, and strongly-typed, drastically simplifying data handling and logic. So now, even the most nested and interconnected datasets can be managed with ease. With TypeDB, we’ve reinvented the database for the modern programming era.

Getting started

IMPORTANT NOTE: As of version 3.0, TypeDB & TypeQL are now written in Rust! The first Rust release went live in December 2024. TypeDB is currently in a phase of rapid iteration, with new features and patches being launched regularly. You can browse the roadmap blog post. TypeDB 3.0 comes with a new storage data structure and architecture that significantly boosts performance when compared against version 2.x. We’re aiming to release preliminary benchmarks of TypeDB 3.0 in early 2025.

Why TypeDB?

  • TypeDB was crafted to natively express and combine diverse data features, allowing users to build advanced data models from a set of simple and intuitive building blocks.
  • TypeDB's type system provides safety and flexibility at the same time, which makes both prototyping and building performant, production-ready data applications fast, elegant, and enjoyable.
  • With TypeDB, and its query language TypeQL, we envision databases catching up with modern typed programming languages, allowing users to write clear, intuitive, and easy to maintain code.
  • TypeDB comes with a mature ecosystem including language drivers and a graphical user interface: TypeDB Studio!

Database Fundamentals

The schema

TypeDB schemas are based on a modern type system that natively supports inheritance and interfaces, and follows a conceptual data modeling approach, in which user-defined types subtype (based on their function) three root types: entitiesrelations, and attributes.

  • Entities are independent objects,
  • Relations depend on their role interfaces played by either entities or relations,
  • Attributes are properties with a value that can be owned by entities or relations.

Interface and inheritance for these types can be combined in many ways, resulting in highly expressive ways of modeling data.

define

attribute full-name value string;
attribute id value string;
attribute email sub id;
attribute employee-id sub id;

entity user,
    owns full-name,
    owns email @unique,
    plays mentorship:trainee;
entity employee,
    owns employee-id @key,
    plays mentorship:mentor;

relation mentorship,
    relates mentor,
    relates trainee;

The query language

The query language of TypeDB is TypeQL. The syntax of TypeQL is fully variablizable and provides native support for polymorphic queries. The language is based on fully declarative and composable patterns, mirroring the structure of natural language.

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

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

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

Functions

Functions, a new concept in TypeDB 3.0 and a cornerstone of TypeQL's query model, are like subqueries you can re-use and invoke whenever you want. You can learn more about them from the TypeQL Functions Documentation.

Effective database engineering

TypeDB breaks down the patchwork of existing database paradigms into three fundamental ingredients: types, inheritance, and interfaces. This provides a unified way of working with data across all database applications, that directly impacts development:

Installation and editions

TypeDB editions

  • TypeDB Cloud — multi-cloud DBaaS
  • TypeDB Enterprise — allows you to deploy TypeDB Cloud in your own environment
  • TypeDB Core — Open-source edition of TypeDB ← This repository

For a comparison of all three editions, see the Deploy page on our website.

Download and run TypeDB Core

You can download TypeDB from the GitHub Releases.

Check our Installation guide to get started.

Compiling TypeDB Core from source using Bazel

Note: You DO NOT NEED to compile TypeDB from the source if you just want to use TypeDB. See the "Download and Run TypeDB Core" section above.

  1. Make sure you have the following dependencies installed on your machine:

  2. You can build TypeDB with either one of the following commands, depending on the targeted architecture and Operation system:

    $ bazel build //:assemble-linux-x86_64-targz
    $ bazel build //:assemble-linux-arm64-targz
    $ bazel build //:assemble-mac-x86_64-zip
    $ bazel build //:assemble-mac-arm64-zip
    $ bazel build //:assemble-windows-x86_64-zip

    Outputs to: bazel-bin/.

  3. If you're on a Mac and would like to run any bazel test commands, you will need to install:

    • snappy: brew install snappy
    • jemalloc: brew install jemalloc

Compiling TypeDB Core from source using Cargo

For macs:

Install prerequisites:

  1. Rustup
  2. brew install protoc

Resources

Developer resources

Useful links

If you want to begin your journey with TypeDB, you can explore the following resources:

Contributions

TypeDB and TypeQL are built using various open-source frameworks and technologies throughout its evolution. Today TypeDB and TypeQL use Speedb, pest, SCIP, Bazel, gRPC, ZeroMQ, and Caffeine.

Thank you!

In the past, TypeDB was enabled by various open-source products and communities that we are hugely thankful to: RocksDB, ANTLR, Apache Cassandra, Apache Hadoop, Apache Spark, Apache TinkerPop, and JanusGraph.

Package hosting

Package repository hosting is graciously provided by Cloudsmith. Cloudsmith is the only fully hosted, cloud-native, universal package management solution, that enables your organization to create, store and share packages in any format, to any place, with total confidence.

Licensing

It's released under the Mozilla Public License 2.0 (MPL 2.0). For license information, please see LICENSE.