Skip to content

Quick Start

Get up and running with Triplox quickly.

The easiest way to test Triplox is to just pull the docker image and start an in-memory or local node.

Terminal window
docker pull ghcr.io/fiv0/triplox:0.1.0-alpha.2
docker run -p 5490:5490 ghcr.io/fiv0/triplox:0.1.0-alpha.2

This will start a Triplox server with an in-memory DB to which you can connect at “localhost:5490”. If you want an persistent local node, you start the image with

Terminal window
docker run -p 5490:5490 -e TRIPLOX_STORAGE=local -v triplox-data:/var/lib/triplox ghcr.io/fiv0/triplox:0.1.0-alpha.2

In case you are already convinced and want to deploy Triplox in a distributed setting I suggest you have a look at the Operations section.

There is also the option to run Triplox in dev mode which is particular useful for testing.

Terminal window
docker run -p 5490:5490 -e TRIPLOX_STORAGE=dev ghcr.io/fiv0/triplox:0.1.0-alpha.2

In this case a new in-memory DB is created on every connection.

Afterwards you connect with your favorite client.

let node = ClientNode::connect("http://localhost:5490").await?;
// schema
node.execute_tx(vec![
TxOp::put([
(kw!(:db/ident), kw!(:name).into()),
(kw!(:db/valueType), kw!(:db.type/string).into()),
(kw!(:db/cardinality), kw!(:db.cardinality/one).into()),
]),
TxOp::put([
(kw!(:db/ident), kw!(:age).into()),
(kw!(:db/valueType), kw!(:db.type/long).into()),
(kw!(:db/cardinality), kw!(:db.cardinality/one).into()),
]),
]).await?;
// data
node.execute_tx(vec![
TxOp::put([
(kw!(:name), "alice".into()),
(kw!(:age), 30_i64.into()),
]),
TxOp::put([
(kw!(:name), "bob".into()),
(kw!(:age), 25_i64.into()),
]),
]).await?;
// query
let db = node.db().await?;
let rows = db.query(r#"{:find [?e ?name ?age]
:where [[?e :name ?name]
[?e :age ?age]]}"#).await?;
// => [[8796093022209, "alice", 30], [8796093022208, "bob", 25]]