Crux is becoming XTDB!

You can read the rename announcement, or head to this page on the new XTDB site (where you'll be taken in 10 seconds).

Menu

Installation

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

This guide will show you how to set up an in-memory node using the crux-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

Crux depends on Java 8+.

  • deps.edn

  • pom.xml

juxt/crux-core {:mvn/version "20.09-1.12.0-beta"}
<dependency>
    <groupId>juxt</groupId>
    <artifactId>crux-core</artifactId>
    <version>20.09-1.12.0-beta</version>
</dependency>

Within your JVM application

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

  • Clojure

  • Java

(require '[crux.api :as crux])

(crux/start-node {})
import crux.api.Crux;
import crux.api.ICruxAPI;

public static void main(String[] args) {
    try(ICruxAPI cruxNode = Crux.startNode()) {
        // ...
    }
}

Using a pre-built Crux JAR

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

Start it in the usual way, with java -jar crux-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 Crux JARs with your choice of modules - see the Crux build blog for more details.

Via Docker

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

docker run -p 3000:3000 juxt/crux-in-memory:20.09-1.12.0

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

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

Clojure CLI tooling

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

  • deps.edn

{:deps {org.clojure/clojure {:mvn/version "1.10.1"}

        juxt/crux-core {:mvn/version "20.09-1.12.0-beta"}
        juxt/crux-http-server {:mvn/version "20.09-1.12.0-alpha"}}}
  • crux.edn

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

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

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