Installation

XTDB nodes can be embedded within your JVM application, or they can be started standalone through a pre-built XTDB JAR, via Docker, or using Clojure CLI tooling.

This guide will show you how to set up an in-memory node using the core module. You can then proceed to add further modules (eg for persistence) as required - see the documentation of the individual modules for more information.

Project dependency

XTDB depends on Java 8+.

  • deps.edn

  • pom.xml

com.xtdb/xtdb-core {:mvn/version "1.24.3"}
<dependency>
    <groupId>com.xtdb</groupId>
    <artifactId>xtdb-core</artifactId>
    <version>1.24.3</version>
</dependency>

Within your JVM application

First, add the core module as a project dependency. We can then start up an in-memory XTDB node with:

  • Clojure

  • Java

  • Kotlin

(require '[xtdb.api :as xt])

(xt/start-node {})
import xtdb.api.IXtdb;

public static void main(String[] args) {
    try(IXtdb xtdb = IXtdb.startNode()) {
        // ...
    }
    catch (IOException e) {
        // ...
    }
}
import xtdb.api.IXtdb

fun main() {
    IXtdb.startNode().use {
        // ...
    }
}

Using a pre-built XTDB JAR

You can start a standalone XTDB node, accessible through HTTP, using a pre-built XTDB JAR. XTDB pre-built JARs can be found on the relevant GitHub releases page - we’ll use xtdb-in-memory.jar.

Start it in the usual way, with java -jar xtdb-in-memory.jar. This will open an HTTP port with a console UI on port 3000 - open http://localhost:3000 in your favourite browser.

You can also build custom XTDB JARs with your choice of modules - see the XTDB build blog post for more details.

Via Docker

You can also start a standalone XTDB node using Docker, using:

docker run -p 3000:3000 ghcr.io/xtdb/xtdb-in-memory:1.24.3

Again, this opens up an HTTP server at http://localhost:3000.

Likewise, you can build custom XTDB Docker images - see the XTDB build blog post for more details.

Clojure CLI tooling

Similarly, to start XTDB using Clojure’s CLI tooling:

  • deps.edn

{:deps {org.clojure/clojure {:mvn/version "1.10.3"}
        com.xtdb/xtdb-core {:mvn/version "1.24.3"}
        com.xtdb/xtdb-http-server {:mvn/version "1.24.3"}}}
  • xtdb.edn

{:xtdb.http-server/server {:port 3000}}

Then, start the node with clojure -m xtdb.main.

You can get a listing of CLI flags using clojure -m xtdb.main -h.