Liking cljdoc? Tell your friends :D

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
juxt/crux-core {:mvn/version "{crux_version}-beta"}
pom.xml
<dependency>
    <groupId>juxt</groupId>
    <artifactId>crux-core</artifactId>
    <version>{crux_version}-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
(require '[crux.api :as crux])

(crux/start-node {})
Java
link:example$test/crux/docs/Install.java[role=include]

link:example$test/crux/docs/Install.java[role=include]
link:example$test/crux/docs/Install.java[role=include]
Kotlin
link:example$test/crux/docs/Install.kt[role=include]

link:example$test/crux/docs/Install.kt[role=include]

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:21.02-1.15.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 "{crux_version}-beta"}
        juxt/crux-http-server {:mvn/version "{crux_version}-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.

Can you improve this documentation? These fine people already did:
James Henderson, Daniel Mason, Alistair & Andrea Crotti
Edit on GitHub

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close