State as code. Commits are transactions. Git is the database. GitHub is the showroom.
Warning
git-kv is just getting started! The SPEC just dropped, and we are about to break ground on the implementation.
This README is basesd on the spec, and is mostly here to generate hype and interest.
None of this is true (yet), but watch the repo to follow along.
Expect things to change as we build.
COMING SOON: GitHub Issues to track outstanding tasks, organized into Milestones according to the roadmap, which you can find in the spec doc.
git-kv is an auditable, versioned Key-Value store that uses Git as the database. It provides ledger-grade integrity, atomic multi-key transactions, and fast prefix-listing, all while remaining compatible with SaaS Git hosts like GitHub and GitLab.
It achieves this with a transparent "Stargate" gateway:
- Reads (
git fetch) pull from a GitHub mirror for CDN-class speed. - Writes (
git push) are routed to a tiny, self-hosted Stargate gateway that enforces all integrity guarantees before mirroring back to GitHub.
git-kv is designed for workflows where audit beats microseconds. It's a durable ledger for config, policies, and state, not a Redis replacement for 100k QPS.
- Ledger-Grade History: Every change is a signed, immutable, linear-history Git commit. No merge commits, no force-pushes.
- Atomic Multi-Key Transactions: Set 10,000 keys and delete 5,000 in a single, atomic transaction (
mset). This is validated on the server in O(1) time via client attestation. - Fast Prefix Listing: A dedicated
kv-indexref provides fastgit kv list --prefix user:operations without scanning all N keys. - Native Large File Support: Automatically chunks values >1MB using Content-Defined Chunking (FastCDC). This provides high-performance deduplication inside Git, with no Git-LFS required.
- Bounded Clone Size: Epochs (
git kv epoch new) snapshot the database, keeping new clones small and fast. - SaaS-Native Ergonomics: Developers work against
origin(GitHub/GitLab) as usual. The Stargate is a transparent proxy on thepushpath, giving you server-side hooks and guarantees without sacrificing your existing UI/CI/Actions workflow.
git-kv works by separating the read and write paths.
dev clone
git fetch origin ─────────→ GitHub (CDN, UI, Read Path)
git push origin ─────────→ Stargate (LAN, Authoritative Write Path)
│ pre-receive (O(1) attestation, policy)
└─ post-receive mirror → GitHubThis transparency is achieved with a simple Git config rule, set by git kv remote setup:
[remote "origin"]
url = git@github.com:your-org/repo.git # Reads
pushurl = ssh://git@stargate.local/org/repo.git # WritesThe Stargate is a minimal, self-hosted daemon that runs your bare repo and enforces all guarantees. It stores data across three core ref types, which are pushed atomically:
refs/kv/<ns>(Ledger): The authoritative, hash-sharded data (data/) and metadata (meta/).refs/kv-index/<ns>(Index): Prefix-sharded pointer files (.ref) for fast listing.refs/kv-chunks/<ns>@<epoch>(Chunks): Content-addressed blobs for large values.
(One-time setup)
- Deploy the
git-kv-stargatebinary to a server (stargate.local). - Initialize it as a bare repo with hooks and policy:
# On the Stargate server git-kv-stargate init --repo /srv/git/kv.git --mirror-remote git@github.com:your-org/kv.git systemctl start git-kv-stargate - On GitHub, configure the repo's
refs/kv/*branches as "protected" to block all direct pushes.
(Each developer, one time)
- Install the
git-kvclient CLI.# (Installation instructions TBD: e.g., go install ... or download from releases) - Clone the repo from GitHub as usual:
git clone git@github.com:your-org/kv.git cd kv - Run the
remote setupcommand. This reads.kv/policy.yamlfrom the repo and configures yourpushurlautomatically.git kv remote setup # > Configured origin.pushurl → ssh://git@stargate.local/org/kv.git
# Set a simple value (this creates one atomic commit)
git kv set cfg:feature:new-ui "true"
# Get the value
git kv get cfg:feature:new-ui
# > "true"
# Perform an atomic multi-key transaction
git kv mset --file changes.jsonl
# changes.jsonl
# {"op":"set","key":"cfg:feature:new-ui","ctype":"application/json","value_b64":"eyJhY3RpdmUiOnRydWV9"}
# {"op":"set","key":"user:42:avatar","ctype":"image/png","file":"avatar.png"}
# {"op":"del","key":"secret:old-token"}
# List all keys under a prefix (fast!)
git kv list --prefix cfg:
# > cfg:feature:new-ui
# In CI, wait for a change to be visible on the GitHub mirror
git kv wait --oid <commit-hash> --visible-on=githubgit kv remote setup: (First command) Configuresorigin.pushurlto point to Stargate.git kv get <key>: Reads a value.git kv set <key> <value>: Sets a value (string, file, or stdin).git kv del <key>: Deletes a value (writes a tombstone).git kv mset --file <batch.jsonl>: Executes a list ofset/delops atomically.git kv list [--prefix P]: Lists keys (fast, uses the index).git kv history <key>: Shows the commit log for a single key.git kv wait --oid <hash>: (For CI) Pauses a script until a commit is visible on the GitHub mirror.
git kv stargate status: Checks the health and mirror backlog of the Stargate.git kv stargate sync [--repair]: Audits and repairs a diverged GitHub mirror.git kv epoch new --label <name>: Creates a new, bounded snapshot for fast clones.
- Large Value Chunking: Automatic for files >
max_value_inline(e.g., 1MB). Uses FastCDC to minimize delta size. - Read-Side TTL: Set a
ttlin the metadata;git kv getwill return "not found" (exit 7) if it's expired. - Policy Enforcement: The
.kv/policy.yamlfile (enforced by Stargate) controls:stargate.push_url- Allowed signer keys (SSH/GPG)
- Allowed key prefixes (
user:*,cfg:*) - Max value sizes
The Stargate gateway is a critical service that must be run with High Availability for production use.
- HA Model: Active-Passive is the recommended deployment. A floating IP (
stargate.local) points to the leader, which holds a leader lock. The standby continuously mirrors the primary. - Health Checks:
/healthz: Is the repo readable and are hooks loaded?/readyz: Is this node the leader and is the mirror remote reachable?
- Observability: Stargate exposes a
/metricsendpoint for Prometheus with key SLOs:stargate_txn_latency_ms(p95 < 150ms)stargate_mirror_lag_seconds(p95 < 2s)stargate_mirror_backlog_size
- Recovery: If the GitHub mirror ever diverges from the Stargate (Source of Truth), an admin can force a repair:
git kv stargate sync --repair --ns main
This project is licensed under the MIND-UCAL License. See LICENSE file for details.
Pull Requests are welcome for issues marked with the Help Wanted label!
Please run make test and make lint before submitting.
For major architectural changes, please use Discussions to submit a RFC.