Get started
Mirexa is one Go program with nothing to install beside it: no external database, no JVM, no coordinator. Build it, start a node, write some candles and read them back, from the command line and from Go. You need Go 1.25 or newer, make and git, on Linux.
-
Build
shellgit clone https://github.com/AmiraliOmidvar/mirexa.git cd mirexa make buildThe binaries land in
./bin:server(the node),cli(the one command-line tool: ingest, query and subscribe from a shell, bulk-load files, issue access tokens and certificates for a cluster; see Command line) anddashboard(the web console’s API). -
Start a node
shell./bin/server -data-dir ./dataAddress What answers there :8080The data port: Mirexa’s binary protocol, which the CLI and the Go SDK speak. :9090/metrics(Prometheus),/healthand/ready. If the port is taken, the node does not start.check it is upcurl -s localhost:9090/ready {"ready":true,"started":"…","checks":[{"name":"tcp_listener","status":"healthy"},{"name":"data_dir","status":"healthy"}]}Authentication is on from the first start. With no keys configured, the node makes its own: a signing key in
./data/auth/issuer.keyand an admin token in./data/auth/admin.token, which it re-mints every 20 minutes while it runs. Every client below reads that file. The startup log names both paths.The data port listens on every interface. Anything that can reach port 8080 still needs a token, but traffic is plaintext until you turn on TLS. Step 6 covers narrower tokens and your own keys. -
Write some candles
The CLI reads CSV from standard input, one bar per line:
timestamp,open,high,low,close,volume. A timestamp is RFC 3339 or Unix nanoseconds. A stream is namedexchange:symbol:timeframe.candles.csv2026-10-20T09:30:00Z,67012.50,67248.75,66981.25,67104.00,148.2 2026-10-20T09:31:00Z,67104.00,67190.10,67055.00,67171.30,96.4 2026-10-20T09:32:00Z,67171.30,67202.00,67120.45,67140.80,121.9shell./bin/cli ingest -stream binance:BTCUSDT:1m -token-file data/auth/admin.token < candles.csv ingested 3 candles into binance:BTCUSDT:1m in 1 batch(es)The command returns once the node has written the batch to its write-ahead log and fsynced it, so an acknowledged candle survives a crash.
-
Read them back
Every data command takes the token the same way. To skip the flag, set
MIREXA_TOKENonce:export MIREXA_TOKEN=$(cat data/auth/admin.token). The token lasts an hour and the node re-mints it, so-token-file, which reads the current one, is the better habit: an exported copy goes stale.a time range./bin/cli query -stream binance:BTCUSDT:1m -token-file data/auth/admin.token \ -start 2026-10-20T09:30:00Z -end 2026-10-20T09:33:00Z 2026-10-20T09:30:00Z,67012.5,67248.75,66981.25,67104,148.2 2026-10-20T09:31:00Z,67104,67190.1,67055,67171.3,96.4 2026-10-20T09:32:00Z,67171.3,67202,67120.45,67140.8,121.9The start is inclusive and the end exclusive. Add
-gapsto get the missing bars as rows too, markedgap; through the Go SDK each one also says whether the market was closed or the data is missing.longer bars, made at query time./bin/cli query -stream binance:BTCUSDT:1m -token-file data/auth/admin.token \ -start 2026-10-20T09:30:00Z -end 2026-10-20T09:33:00Z -rollup 3m 2026-10-20T09:30:00Z,67012.5,67248.75,66981.25,67140.8,366.5-rollupbuilds bars of any length the rules allow from the stored ones (or, with-ticks, from trades) and stores nothing. To have the node store a derived timeframe as data arrives, declare it with./bin/cli lineage set.history, then live./bin/cli subscribe -stream binance:BTCUSDT:1m -backfill -token-file data/auth/admin.tokenSends the stored history first, then every new bar as it is written. Stop it with Ctrl+C.
-
Use it from Go
shellgo get github.com/AmiraliOmidvar/mirexa/clientmain.gopackage main import ( "context" "fmt" "log" "os" "strings" "time" "github.com/AmiraliOmidvar/mirexa/client" ) func main() { // The node's admin token. The client reads the file on every connect and // renews the session over the open connection before the token expires. c, err := client.Dial("localhost:8080", client.Options{ TokenSource: func() (string, error) { b, err := os.ReadFile("data/auth/admin.token") return strings.TrimSpace(string(b)), err }, }) if err != nil { log.Fatal(err) } defer c.Close() ctx := context.Background() stream := client.NewStreamID("binance", "ETHUSDT", "1m") start := time.Now().Truncate(time.Minute).Add(-3 * time.Minute) // Three closed one-minute bars. DurabilityAcked returns once they are in // the write-ahead log and the log is fsynced. bars := []client.Candle{ {Timestamp: start.UnixNano(), Open: 2412.10, High: 2415.80, Low: 2409.55, Close: 2414.95, Volume: 182.4}, {Timestamp: start.Add(time.Minute).UnixNano(), Open: 2414.95, High: 2418.20, Low: 2413.10, Close: 2416.40, Volume: 96.7}, {Timestamp: start.Add(2 * time.Minute).UnixNano(), Open: 2416.40, High: 2417.05, Low: 2411.75, Close: 2412.60, Volume: 141.2}, } if err := c.IngestCandles(ctx, stream, bars, client.DurabilityAcked); err != nil { log.Fatal(err) } resp, err := c.QueryCandles(ctx, client.QueryRequest{ StreamID: stream, StartTime: start.UnixNano(), EndTime: start.Add(3 * time.Minute).UnixNano(), }) if err != nil { log.Fatal(err) } for _, p := range resp.Points { fmt.Println(time.Unix(0, p.Candle.Timestamp).UTC().Format(time.RFC3339), p.Candle.Close) } }The same package has a
Batcherthat groups records into batches for you,QueryCandlesRowsfor ranges too large for one response,QueryColumnsto read only the columns you need (the closes of a long history, say) as slices,SubscribeStreamfor live data, ticks alongside candles, and a client that reconnects on its own (DialResilient). A shed write is retried for you; a write whose fate is unknown after a dropped connection is returned asErrAmbiguous, never retried blindly. The Go client reference covers all of it, and there is a Python client with pandas and polars, whosequery_columnsdoes the same into NumPy arrays. -
Tokens and keys
Access tokens are Ed25519-signed and checked offline: the node needs only a public key to trust. The admin token carries every permission. For anything else, mint a token with only what it needs, from the node’s own key:
shell./bin/cli token issue -key data/auth/issuer.key \ -perms READ_CANDLES,LIST_STREAMS -validity 30m > token ./bin/cli streams -token-file token exchange,symbol,timeframe binance,BTCUSDT,1m 1 stream(s)The node’s key is fine on a laptop, but it lives on the node, and it can mint any permission. For anything real, keep the signing key elsewhere and give the node only its public half. Once
trusted_keyslists a key, the node generates nothing.make a signing key./bin/cli token keygen -dir ./keys -name opsIt prints the configuration to add. Put it in a file, say
mirexa.yaml, and restart the node with it:mirexa.yamlstorage: data_dir: ./data security: auth: trusted_keys: - name: ops public_key: "…the base64 line keygen printed…"shell./bin/server -config mirexa.yaml ./bin/cli token issue -key keys/ops.key \ -perms READ_CANDLES,WRITE_CANDLES,LIST_STREAMS -validity 30m > token- The data permissions are
READ_CANDLES,WRITE_CANDLES,READ_TICKS,WRITE_TICKSandLIST_STREAMS; listing streams needsLIST_STREAMS.ADMIN_CLUSTERis for the control listener whencontrol.admin_authis on, andADMIN_STREAMfor changing stream settings from a client over the data port. Command line, Authentication lists what each command needs. - A token lives at most one hour. In Go, pass
Options.TokenSourceinstead ofToken: the client calls it to renew the session over the open connection before the token expires, and again on every reconnect, so a token file refreshed in time keeps a long-running program connected. The CLI does the same with-token-file. - Keep
ops.keyoff the node: it can mint any permission. A single token cannot be revoked. To cut off a key's outstanding tokens early on a single node, take the key out oftrusted_keysand restart; a cluster can revoke a key through its control API, and every node stops accepting its tokens within about a quarter of a second. - A cluster does not make its own key: every node must list the same
trusted_keys, and a clustered node with authentication on and none listed refuses to start. security.auth.enabled: falseturns authentication off. A client is then accepted with no token, and the permissions it asks for are taken on trust, still capped bysecurity.max_permissions. Do not expose such a node to an untrusted network.
- The data permissions are
-
Configure it
Every setting lives in one YAML file passed with
-config;configs/example.yamlwalks through the main sections. Any of them can also be set from the environment asMIREXA_<SECTION>_<FIELD>, for exampleMIREXA_NETWORK_ADDR=127.0.0.1:8080. The ones to know first:Setting Default What it does network.addr:8080Where the data port listens. observability.addr:9090Metrics, health and readiness. control.addr127.0.0.1:9091The control listener, with control.enabled: true: stream calendars and lineage (./bin/cli calendar,./bin/cli lineage).wal.sync_policyalwaysAcknowledge a write only after an fsync. intervalsyncs on a timer instead: faster, but a crash can lose the last moments of acknowledged writes.storage.decoded_chunk_cache_bytes256 MiB Memory for recently read chunks, held compressed (about 12 bytes a candle). security.auth.enabledtrueRequire a signed token on the data port. With no trusted_keys, a single node makes its own key and admin token (step 6).security.tls_enabledfalseTLS 1.3 on the data port, with cert_fileandkey_file.
Where next
- The clientsGo and Python: every call, option and error, with examples run against a node.
- The command lineEvery
mirexa-clicommand and flag, including calendars, lineage and cache size. - How Mirexa worksStorage, the write and read paths, clustering and the client, with the tests behind each claim.
- Deploy with the dashboardA Docker Compose stack: the node, the dashboard API and a proxy that serves the web console.
- The benchmarkMirexa against QuestDB, ClickHouse, TimescaleDB, InfluxDB and Parquet files with DuckDB.