# Chronix > Chronix is an embedded-first time-series database in Rust, with forecasting and anomaly detection in the engine — a Cargo dependency or a server. Chronix is a Rust crate (`chronix` on crates.io) and a server (`chronixd`) built on the same engine and file format. The Rust API is documented at https://docs.rs/chronix; the source is at https://github.com/hupe1980/chronix. The full text of every page below is at https://hupe1980.github.io/chronix/llms-full.txt. ## Learn - [Quickstart: embedded](https://hupe1980.github.io/chronix/learn/quickstart/): Add Chronix to a Rust project, write points and query them with the builder, SQL and PromQL — an embedded time-series database in five minutes. - [Quickstart: the server](https://hupe1980.github.io/chronix/learn/server/): Run chronixd with demo data, query it with PromQL and SQL, open the console and connect Grafana — a time-series server in five minutes. - [Your first gateway monitor](https://hupe1980.github.io/chronix/learn/gateway/): Build a solar-roof health monitor with Chronix: a declared detector that judges each quarter hour on the wall clock and resumes after a reboot. ## Guides - [Send data to Chronix](https://hupe1980.github.io/chronix/guides/ingest/): Point Prometheus remote write, Telegraf, the OpenTelemetry Collector, Kafka or MQTT at Chronix — the endpoints and settings each client needs. - [Connect Grafana](https://hupe1980.github.io/chronix/guides/grafana/): Use Chronix as a Prometheus or Flight SQL data source in Grafana, import the bundled dashboards, and add annotations and alerts. - [Use the console](https://hupe1980.github.io/chronix/guides/console/): The page built into chronixd: run PromQL and SQL, see forecasts and anomalies on the chart, inspect cardinality and explain a query. - [Use Chronix from an AI agent](https://hupe1980.github.io/chronix/guides/ai-agents/): Connect Claude Code, Claude Desktop or any MCP client to Chronix over HTTP or stdio, and let an agent query, forecast and detect anomalies. - [Forecast and detect anomalies](https://hupe1980.github.io/chronix/guides/forecast-and-detect/): Forecast a series and find anomalies inside Chronix from Rust or SQL: choosing a model, intervals, detectors, multivariate checks and drift. - [Rollups and retention](https://hupe1980.github.io/chronix/guides/rollups-and-retention/): Keep raw data for days and summaries for years: declare calendar rollup tiers, set retention per measurement, and delete data safely. - [Back up and restore](https://hupe1980.github.io/chronix/guides/backup-and-restore/): Take hard-linked checkpoints of a Chronix data directory, schedule them, verify a backup and restore a database or a single measurement. - [Secure a server](https://hupe1980.github.io/chronix/guides/secure-a-server/): Turn on authentication, TLS and mTLS, API keys, Cedar policies and namespace isolation for chronixd, with a production checklist. - [Run on a gateway](https://hupe1980.github.io/chronix/guides/run-on-a-gateway/): Fit Chronix on a 512 MB gateway: the small preset, memory budgets, fsync on flash, serial reads and the numbers to expect. - [Tune performance](https://hupe1980.github.io/chronix/guides/tune-performance/): Make Chronix faster: tiering, cardinality, runtime settings, the metrics that show a bottleneck, and measured benchmark results. - [Operate a server](https://hupe1980.github.io/chronix/guides/operate/): Deploy chronixd, monitor it, inspect a data directory, upgrade across format generations, handle a full disk and troubleshoot. - [Use Chronix from Python](https://hupe1980.github.io/chronix/guides/python/): Install the Python client, write and query Chronix over HTTP, and read results as Arrow tables through Flight SQL. - [Examples](https://hupe1980.github.io/chronix/guides/examples/): Thirty-plus runnable Chronix programs, from a quickstart to a year on a gateway: forecasting, detection, pipelines, security, storage. ## Reference - [HTTP API](https://hupe1980.github.io/chronix/reference/http-api/): Every chronixd HTTP endpoint: writes, queries, triggers, annotations, namespaces, admin and MCP, with request and response shapes. - [PromQL](https://hupe1980.github.io/chronix/reference/promql/): The PromQL Chronix answers: Prometheus HTTP API endpoints, supported functions and modifiers, conformance pin and empty-result explanations. - [SQL](https://hupe1980.github.io/chronix/reference/sql/): SQL in Chronix: tables and system columns, the forecasting and anomaly-detection functions, window functions and ASOF joins. - [gRPC and Flight SQL](https://hupe1980.github.io/chronix/reference/grpc-and-flight/): The chronixd gRPC service and Arrow Flight SQL endpoint: methods, ports, authentication and how to connect ADBC and JDBC clients. - [Configuration](https://hupe1980.github.io/chronix/reference/configuration/): Every Chronix setting: the embedded ChronixConfig and the chronixd TOML file, section by section, with defaults and environment variables. - [chronixd command line](https://hupe1980.github.io/chronix/reference/cli/): Every chronixd flag, environment variable and subcommand: running the server, the demo, checking a config, inspect and the MCP stdio server. - [Metrics](https://hupe1980.github.io/chronix/reference/metrics/): Every Prometheus metric chronixd exports on /metrics, with its type, labels and what it measures, plus cardinality and tracing settings. - [Data model](https://hupe1980.github.io/chronix/reference/data-model/): Points, series, measurements, tags and fields in Chronix; value types including exact decimals; time sharding, cardinality and last-write-wins. - [Security reference](https://hupe1980.github.io/chronix/reference/security/): Cedar actions and policy schema, the audit log format, hardening settings, key rotation, webhook signing and how each control is enforced. - [Rust API](https://hupe1980.github.io/chronix/reference/rust-api/): A map of the chronix crate's public API onto docs.rs: opening a database, writing, querying, analytics, maintenance and errors. - [Cluster (frozen)](https://hupe1980.github.io/chronix/reference/cluster/): The frozen Chronix cluster tier: the chronixd-cluster binary, MetaNode and DataNode roles, Raft metadata, region routing and what is unsupported. ## How it works - [Architecture](https://hupe1980.github.io/chronix/explanation/architecture/): How the Chronix workspace is laid out: the published crates, the one seam between engine and server, and what each crate owns. - [Storage engine](https://hupe1980.github.io/chronix/explanation/storage/): The Chronix LSM write path and read path: WAL, memtable, time-sharded .csx segments, the catalog and the on-disk format generation. - [Write-ahead log](https://hupe1980.github.io/chronix/explanation/wal/): How the Chronix WAL makes acknowledged writes durable: record format, fsync policies, group commit, sealing of encrypted columns and replay. - [Memtable and segments](https://hupe1980.github.io/chronix/explanation/memtable-and-segments/): The in-memory memtable and the columnar .csx segment format: row groups, column blocks, blooms, zone maps and flush. - [Compaction](https://hupe1980.github.io/chronix/explanation/compaction/): How Chronix merges segments in the background: tiered compaction, deduplication, tombstones and what a reader sees mid-compaction. - [Encoding](https://hupe1980.github.io/chronix/explanation/encoding/): How Chronix compresses columns: pcodec first, ALP and the XOR codecs behind it, and per-block adaptive selection by trial encoding. - [Float encoding](https://hupe1980.github.io/chronix/explanation/encoding-floats/): Why pcodec and ALP beat XOR codecs on metric data: recovering the decimal behind a double, with measured ratios on real meter data. - [Integer, timestamp and dictionary encoding](https://hupe1980.github.io/chronix/explanation/encoding-integers-and-time/): How Chronix encodes integers, timestamps and strings: delta-of-delta, frame-of-reference bit packing, pcodec timestamps and dictionaries. - [Query execution](https://hupe1980.github.io/chronix/explanation/query/): How a Chronix query runs: layered pruning with blooms and zone maps, the inverted tag index, bounded-memory scans, caches and DataFusion. - [Forecasting models](https://hupe1980.github.io/chronix/explanation/forecasting/): The forecasting models inside Chronix — exponential smoothing, Holt-Winters, ARIMA and SARIMA — how each is fitted and when it wins. - [Intervals and model selection](https://hupe1980.github.io/chronix/explanation/forecast-intervals-and-selection/): How Chronix builds prediction intervals and picks a forecasting model by rolling-origin cross-validation, and what coverage to expect. - [Anomaly detection](https://hupe1980.github.io/chronix/explanation/anomaly-detection/): The anomaly detectors in Chronix — z-score, MAD, IQR, CUSUM, forecast residual and seasonal thresholds — how each works and when to use it. - [Multivariate analysis](https://hupe1980.github.io/chronix/explanation/multivariate/): Correlation, VAR, Mahalanobis distance, PCA and isolation forests in Chronix: detecting anomalies across several series at once. - [Preprocessing, models and compute](https://hupe1980.github.io/chronix/explanation/preprocessing-and-models/): Preprocessing pipelines, the model registry and lifecycle, drift detection, and the compute engine and its parallelism budget. - [Streaming and triggers](https://hupe1980.github.io/chronix/explanation/streaming-and-triggers/): The Chronix change-data-capture bus, subscriptions, the trigger DSL and webhook delivery: how events flow from a write to an alert. - [Server architecture](https://hupe1980.github.io/chronix/explanation/server/): How chronixd is put together: the HTTP, gRPC and Flight SQL surfaces, wire-protocol decoding, ingestion connectors and tracing. - [Object storage](https://hupe1980.github.io/chronix/explanation/object-storage/): The Chronix cold tier: Hive-partitioned Parquet on S3, GCS or Azure, how segments are archived, and how SQL and other engines read it. - [Security internals](https://hupe1980.github.io/chronix/explanation/security/): How Chronix enforces security: request authentication, Cedar evaluation per route, namespace scoping, column encryption and the audit chain. - [Testing](https://hupe1980.github.io/chronix/explanation/testing/): How Chronix is tested: property tests, crash tests with a child that aborts mid-write, deterministic simulation, fuzzing and conformance suites.