Skip to content

JetBrains/youtrackdb

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

24,713 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

source_files related_docs
core/src/main/java/com/jetbrains/youtrackdb/api/YourTracks.java
core/src/main/java/com/jetbrains/youtrackdb/api/YouTrackDB.java
core/src/main/java/com/jetbrains/youtrackdb/api/DatabaseType.java
core/src/main/java/com/jetbrains/youtrackdb/api/gremlin/**
pom.xml
examples/src/main/java/**
CLAUDE.md
console/README.md
server/README.md
driver/README.md

YouTrackDB

License official JetBrains project
Bluesky Zulip Medium Reddit


Issue tracker | Knowledge base | Roadmap

Join our Zulip community!

If you are interested in YouTrackDB, consider joining our Zulip community. Tell us about exciting applications you are building, ask for help, or just chat with friends πŸ˜ƒ

What is YouTrackDB?

YouTrackDB is a general use object-oriented graph database. YouTrackDB is being supported and developed by JetBrains and is used internally in production.

YouTrackDB's key features are:

  1. Fast data processing: Links traversal is processed with O(1) complexity. There are no expensive run-time JOINs.
  2. Object-oriented API: This API implements rich graph and object-oriented data models. Fundamental concepts of inheritance and polymorphism are implemented on the database level.
  3. Implementation of TinkerPop API and Gremlin query language: You can use both Gremlin query language for your queries and TinkerPop API out of the box. Support of GQL with seamless integration with Gremlin is in progress.
  4. Scalable development workflow: YouTrackDB works in schema-less, schema-mixed, and schema-full modes.
  5. Strong security: A strong security profiling system based on user, role, and predicate security. (Currently implemented using a private API. Implementation of the public API is in progress.)
  6. Encryption of data at rest: Optionally encrypts all data stored on disk.

Easy to install and use

YouTrackDB can run on any platform without configuration and installation.

If you want to experiment with YouTrackDB, please check out our REPL console.

docker run -it youtrackdb/youtrackdb-console

To install YouTrackDB as an embedded database, add the following dependency to your Maven project:

<dependency>
  <groupId>io.youtrackdb</groupId>
  <artifactId>youtrackdb-embedded</artifactId>
  <version>0.5.0-SNAPSHOT</version>
</dependency>

The youtrackdb-embedded artifact is a shaded uber-jar that relocates all third-party dependencies (Guava, Jackson, Groovy, etc.) under com.jetbrains.youtrackdb.shade, so they won't conflict with versions used by your application.

You also need to add a YTDB snapshot repository to your Maven pom.xml file:

<repositories>
  <repository>
    <name>Central Portal Snapshots</name>
    <id>central-portal-snapshots</id>
    <url>https://central.sonatype.com/repository/maven-snapshots/</url>
    <releases>
      <enabled>false</enabled>
    </releases>
    <snapshots>
      <enabled>true</enabled>
    </snapshots>
  </repository>
</repositories>

or in case of Gradle:

dependencies {
    implementation 'io.youtrackdb:youtrackdb-embedded:0.5.0-SNAPSHOT'
}

and

repositories {
    maven {
        url = uri("https://central.sonatype.com/repository/maven-snapshots/")
        mavenContent {
            snapshotsOnly()
        }
    }
}

If you want to work with YouTrackDB server, you can start it using the Docker image:

docker run -p 8182:8182 \
 -v $(pwd)/secrets:/opt/ytdb-server/secrets \
 -v $(pwd)/databases:/opt/ytdb-server/databases \
 -v $(pwd)/conf:/opt/ytdb-server/conf \
 -v $(pwd)/log:/opt/ytdb-server/log \
 youtrackdb/youtrackdb-server

and provide root password for the database in the secrets/root_password file.

YourTrackDB requires at least JDK 21.

To start to work with YouTrackDB:

package io.youtrackdb.examples;

import static org.apache.tinkerpop.gremlin.process.traversal.P.gt;

import com.jetbrains.youtrackdb.api.DatabaseType;
import com.jetbrains.youtrackdb.api.YourTracks;
import com.jetbrains.youtrackdb.api.gremlin.YTDBDemoGraphFactory;
import com.jetbrains.youtrackdb.internal.core.gremlin.io.YTDBIoRegistry;
import org.apache.tinkerpop.gremlin.structure.io.graphson.GraphSONMapper;
import org.apache.tinkerpop.gremlin.structure.io.graphson.GraphSONVersion;

/// Minimal example of usage of YouTrackDB as an embedded database.
/// This file is embedded into README.md by embedme β€” keep it self-contained.
public class ReadmeExample {

  public static void main(String[] args) throws Exception {
    // Create a YouTrackDB database manager instance and provide the root
    // folder where all databases will be stored.
    // We work with in-memory databases here, so we use "." as a root folder.
    try (var ytdb = YourTracks.instance(".")) {
      // Use YourTracks.instance("localhost", "root-name", "root-password")
      // if you want to connect to a server instead.

      // Create the database with demo data to play with it.
      try (var traversalSource = YTDBDemoGraphFactory.createModern(ytdb)) {
        // Prepare GraphSONMapper to check our results.
        var jsonMapper = GraphSONMapper.build()
            .version(GraphSONVersion.V1_0) // use the simplest version for brevity
            .addRegistry(YTDBIoRegistry.instance()) // add serializer for custom types
            .create().createMapper();

        // YTDB data manipulation is performed inside a transaction.
        // YTDBGraphTraversal will start a transaction automatically if one is
        // not started yet, but then you need to commit it manually and the
        // transaction borders become diluted.  We suggest using the
        // lambda-style API to automatically start/commit/rollback transactions.
        traversalSource.executeInTx(g -> {
          // Find a vertex with class "person" and property "name" equal to "marko".
          var v = g.V().has("person", "name", "marko").next();
          System.out.println("output:" + jsonMapper.writeValueAsString(v));
          // output:{
          //   "id":{..},
          //   "label":"person",
          //   "type":"vertex",
          //   "properties":{
          //     "name":[{"id":{..},"value":"marko"}],
          //     "age":[{"id":{..},"value":29}]
          //   }
          // }

          // Get the names of the people the vertex knows who are over 30.
          var friendNames = g.V(v.id()).out("knows").has("age",
              gt(30)).<String>values("name").toList();
          System.out.println("output:" + String.join(", ", friendNames));
          // output: josh
        });

        // Create an empty database with the name "tg", username "superuser",
        // admin role and password "adminpwd".
        ytdb.create("tg", DatabaseType.MEMORY, "superuser", "adminpwd", "admin");
        // Open a YTDBGraphTraversal instance for the new database.
        try (var newTraversal = ytdb.openTraversal("tg", "superuser", "adminpwd")) {
          newTraversal.executeInTx(g -> {
            // Create a vertex with class(label) "person" and properties.
            var v1 = g.addV("person")
                .property("name", "marko").property("age", 29).next();
            System.out.println("output:" + jsonMapper.writeValueAsString(v1));
            // output:{
            //   "id":{..},
            //   "label":"person",
            //   "type":"vertex",
            //   "properties":{
            //     "name":[{"id":{..},"value":"marko"}],
            //     "age":[{"id":{..},"value":29}]
            //   }
            // }

            // Create a vertex with class(label) "software" and properties.
            var v2 = g.addV("software")
                .property("name", "lop").property("lang", "java").next();
            // Connect both vertices by "created" relation.
            // We need to call iterate() here to execute the traversal flow.
            g.addE("created").from(v1).to(v2).property("weight", 0.4).iterate();
          });

          // Check the results of data modification after commit.
          traversalSource.executeInTx(g -> {
            var createdSoftware = g.V().has("person", "name", "marko")
                .out("created").<String>values("name").toList();
            System.out.println("output:" + String.join(", ", createdSoftware));
            // output: lop
          });
        }
      }
    }
  }
}

To check the full examples of usage of YouTrackDB both for server and embedded deployments of YTDB, please check out our examples project.

Stargazers over time

Stargazers over time