A declarative API for creating data transformations in PostgreSQL. Correctness and performance are the key design goals. All state managed in Postgres for simplified architecture and efficient, provably correct transforms.
Applications often compute the same derived facts over and over — the same aggregate, join, or enrichment recomputed on every request. That recomputation is spikey read load: the cost lands at query time, scales with how often you read, and grows as the underlying data grows, so the queries that matter most are the ones that get slow under pressure.
Trellis inverts the trade-off. Instead of recomputing a derived table on every read, it maintains that table incrementally: when a source row changes, only the affected target rows are updated. This replaces spikey read load with a steady write load — work proportional to how fast the source changes, not to how often you query — and leaves behind a plain table that is cheap and predictable to read.
The trade-off is worth it when a fact is read far more often than its inputs change, or when read latency matters more than write throughput. It is the same bargain a database index makes — pay a little on write to make reads fast.
This repo is home to a few key components:
trellisis the rust crate that users will download and install into their application codecli(packagetrellis-cli) builds thetrellisoperator-facing binary, which wraps thetrellislibrary crate for defining transforms/relationships, running the live pipeline, and checking status from a shell — runcargo run -p trellis-cli -- --help(ortrellis --helponce installed) to see what it can dodocsoutlines the key ideas and decisions this project has takenclientsholds the Elixir and Ruby bindings for running Trellis inside a host app; docs/embedding.md is the guide to embedding itbenchmarkis a harness for measuring throughput, latency and other key-metricsgenerativeis a generative test suite that is used to validate correctness under various scenarios and loadstestkitis a reusable, test-only harness that spins up a throwaway PostgreSQL instance and hands out isolated, migrated databases per test scenario. It is never shipped in a user's binary — other crates pull it in as a dev-dependency and exercise it throughcargo test. Itstrellis-testkitbinary provisions the same kind of cluster for test suites written in other languages; seecargo run -p testkit --bin trellis-testkit -- --help.
This project uses asdf to define the default versions used for local/development work.
From the root of this project run asdf install postgres to make sure you have the appropriate version.
For MacOS you often need to set brew install
icu4cand then setexport PKG_CONFIG_PATH="$(brew --prefix icu4c)/lib/pkgconfig:$PKG_CONFIG_PATH"before running the asdf install command