cadish

module
v0.2.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 30, 2026 License: Apache-2.0

README

cadish

One binary: HTTP caching, TLS/ACME, load balancing, and Kubernetes ingress.

cadish is a single-binary HTTP cache server written in Go. It replaces the reverse-proxy + cache + load-balancer + ingress stack you normally chain together with one process and one config file:

  • Cache — two-tier RAM + NVMe, request coalescing, grace / stale-while-revalidate.
  • TLS — built-in termination with automatic ACME certificates. No proxy in front.
  • Load balancing — upstreams, health checks, sticky / sharded backends.
  • Config — a flat, declarative Cadishfile. No VCL.
  • cadish check — a config complexity report: regex-per-request, dead rules, estimated cost per request. Nothing else in the ecosystem has this.

🚧 Status: BETA — ships v1 plus the full v2 directive set. A single-binary HTTPS caching reverse proxy that serves a full production config end-to-end, plus the v2 normalizers ({device}/{geo}/normalize), multi-tenant {tenant} + group inheritance, and replace body transforms. See CHANGELOG.md for what shipped in each release.

Why cadish

Most stacks assemble the edge from separate tools: one for TLS, one for load balancing, one for caching, one for ingress. Each is excellent on its own, but running them together means several processes, several config languages, and glue code in between.

cadish does those jobs in one binary, driven by one declarative config: TLS termination with ACME, load balancing, HTTP caching (RAM and NVMe, local and at the edge), and Kubernetes ingress. The config language stays small and covers real-world use cases first. New ones are welcome as long as they don't cost performance, because speed is a hard constraint, not an afterthought.

Example Cadishfile

example.com, *.example.com {
    tls { acme you@example.com }

    cache { ram 10GiB; disk /var/cache/cadish 2TiB }

    upstream web {
        to      https://origin.example.com
        sticky  by cookie PHPSESSID else client_ip
        health  GET / expect 301 interval 5s
    }

    @nocache path /panel/* /private/* /checkout/*
    pass     @nocache
    pass     method POST

    cache_ttl status 404 410   ttl 60s grace 1h
    cache_ttl default          ttl 2s  grace 24h
}

Install

Download a release binary (linux/darwin, amd64/arm64) from the releases page:

# pick the asset for your OS/arch, then:
tar xzf cadish_*_linux_amd64.tar.gz
./cadish version

Go install (needs Go 1.26+):

go install github.com/cadi-sh/cadish/cmd/cadish@latest

Container image (multi-arch, from GHCR):

docker run --rm -p 80:80 -p 443:443 \
  -v "$PWD/Cadishfile:/etc/cadish/Cadishfile:ro" \
  ghcr.io/cadi-sh/cadish:latest

See docs/getting-started.md for the first-run walkthrough and docs/deployment.md / the Helm chart for production.

Documentation

The full docs are in docs/ — getting started, the cookbook, the Cadishfile reference, migrating from Varnish, and deployment. New contributors: see CONTRIBUTING.

Build & test

make build     # go build -> ./build/cadish
make test      # go test ./...
make race      # go test ./... -race
make check     # go vet ./... && go test ./...

License

Apache License 2.0 — see LICENSE.

Directories

Path Synopsis
cmd
cadish command
Command cadish is a single-binary HTTP cache server: two-tier HTTP caching, load balancing, and Kubernetes ingress, with built-in TLS + ACME.
Command cadish is a single-binary HTTP cache server: two-tier HTTP caching, load balancing, and Kubernetes ingress, with built-in TLS + ACME.
Package edgebundle assembles a deployable Cloudflare Worker bundle from a projected EdgeIR.
Package edgebundle assembles a deployable Cloudflare Worker bundle from a projected EdgeIR.
internal
admin
Package admin is cadish's opt-in observability / command-center surface: a separate HTTP server (its own listener, off by default, auth-gated) that serves a single-page dashboard from embedded assets plus a JSON API and an optional Prometheus endpoint.
Package admin is cadish's opt-in observability / command-center surface: a separate HTTP server (its own listener, off by default, auth-gated) that serves a single-page dashboard from embedded assets plus a JSON API and an optional Prometheus endpoint.
cache
Package cache implements a two-tier, bounded, sharded-LRU object cache for the cadish HTTP cache server.
Package cache implements a two-tier, bounded, sharded-LRU object cache for the cadish HTTP cache server.
cadishfile
Package cadishfile implements a lexer, parser, AST, and formatter for the Cadishfile: cadish's flat, Caddy-style configuration format.
Package cadishfile implements a lexer, parser, AST, and formatter for the Cadishfile: cadish's flat, Caddy-style configuration format.
cfsign
Package cfsign produces AWS CloudFront *canned-policy* signed URLs, and an origin.Origin that re-signs and fetches each request through them.
Package cfsign produces AWS CloudFront *canned-policy* signed URLs, and an origin.Origin that re-signs and fetches each request through them.
check
Package check implements `cadish check`: it loads a Cadishfile (resolving `import` directives), then produces a per-site complexity report — the headline differentiator of cadish.
Package check implements `cadish check`: it loads a Cadishfile (resolving `import` directives), then produces a per-site complexity report — the headline differentiator of cadish.
classify
Package classify turns a request's User-Agent into a small, bounded device class ("desktop", "mobile", "tablet", "bot", …) for the `{device}` cache-key normalizer.
Package classify turns a request's User-Agent into a small, bounded device class ("desktop", "mobile", "tablet", "bot", …) for the `{device}` cache-key normalizer.
cli
Package cli implements cadish's command-line subcommands.
Package cli implements cadish's command-line subcommands.
cluster
Package cluster turns N cadish nodes in a region into a sharded / cooperative cache.
Package cluster turns N cadish nodes in a region into a sharded / cooperative cache.
config
Package config loads a Cadishfile from disk and turns each site block into a runtime *Site that the server can execute: a compiled *pipeline.Pipeline, a *cache.Store built from the site's `cache { … }` block, and the site's origin.Origin composed from its `upstream`/`origin chain` directives.
Package config loads a Cadishfile from disk and turns each site block into a runtime *Site that the server can execute: a compiled *pipeline.Pipeline, a *cache.Store built from the site's `cache { … }` block, and the site's origin.Origin composed from its `upstream`/`origin chain` directives.
edgedeploy
Package edgedeploy is the Cadish Edge management plane's Cloudflare API client.
Package edgedeploy is the Cadish Edge management plane's Cloudflare API client.
edgeir
Package edgeir projects a compiled *pipeline.Pipeline into a versioned, serializable EdgeIR — the single, explicit JSON contract a small generic JavaScript worker (Cadish Edge) interprets at the edge.
Package edgeir projects a compiled *pipeline.Pipeline into a versioned, serializable EdgeIR — the single, explicit JSON contract a small generic JavaScript worker (Cadish Edge) interprets at the edge.
gateway
Package gateway runs the in-cluster Kubernetes Gateway API controller: it watches GatewayClass / Gateway / HTTPRoute objects, translates the HTTP routing they describe into a Cadishfile, and hot-swaps cadish's live routing through Server.ApplyConfig — the SAME atomic swap the Ingress controller (internal/ingress) uses (D55/D58).
Package gateway runs the in-cluster Kubernetes Gateway API controller: it watches GatewayClass / Gateway / HTTPRoute objects, translates the HTTP routing they describe into a Cadishfile, and hot-swaps cadish's live routing through Server.ApplyConfig — the SAME atomic swap the Ingress controller (internal/ingress) uses (D55/D58).
geo
Package geo turns a request into a small, bounded geo class (an ISO-ish country code like "US"/"ES", or "unknown") for the `{geo}` cache-key normalizer.
Package geo turns a request into a small, bounded geo class (an ISO-ish country code like "US"/"ES", or "unknown") for the `{geo}` cache-key normalizer.
ingress
Package ingress translates Kubernetes Ingress objects into a Cadishfile and runs the in-cluster controller that keeps cadish's live routing in sync with them.
Package ingress translates Kubernetes Ingress objects into a Cadishfile and runs the in-cluster controller that keeps cadish's live routing in sync with them.
k8s
Package k8s resolves cadish `k8s://service.namespace:port` upstream targets to the live set of ready pod IP:port endpoints via the Kubernetes API (EndpointSlices), using a client-go SharedInformer with a warm local cache and event-driven re-resolution.
Package k8s resolves cadish `k8s://service.namespace:port` upstream targets to the live set of ready pod IP:port endpoints via the Kubernetes API (EndpointSlices), using a client-go SharedInformer with a warm local cache and event-driven re-resolution.
lb
Package lb implements cadish's load-balancing primitives: a pool of backends (an Upstream) that picks one backend per request according to a balancing policy, keeps the eligible set healthy with active probes and passive ejection, and tracks pod/IP churn behind dns:// and k8s:// targets without a reload.
Package lb implements cadish's load-balancing primitives: a pool of backends (an Upstream) that picks one backend per request according to a balancing policy, keeps the eligible set healthy with active probes and passive ejection, and tracks pod/IP churn behind dns:// and k8s:// targets without a reload.
logs
Package logs implements `cadish logs` — the NCSA-style access-log tail.
Package logs implements `cadish logs` — the NCSA-style access-log tail.
metrics
Package metrics is the cheap, lock-free observability seam between the request datapath (internal/server) and the admin/dashboard surface (internal/admin).
Package metrics is the cheap, lock-free observability seam between the request datapath (internal/server) and the admin/dashboard surface (internal/admin).
origin
Package origin is cadish's upstream-fetch layer.
Package origin is cadish's upstream-fetch layer.
origin/chain
Package chain composes an ordered list of origins into a single fallback origin.
Package chain composes an ordered list of origins into a single fallback origin.
origin/httporigin
Package httporigin is cadish's generic HTTP/HTTPS upstream origin: given a base URL, it fetches an object by joining the request Key onto that base, forwards the Range header for partial/seek requests, and streams the response body so the server can tee it into the cache while serving the client.
Package httporigin is cadish's generic HTTP/HTTPS upstream origin: given a base URL, it fetches an object by joining the request Key onto that base, forwards the Range header for partial/seek requests, and streams the response body so the server can tee it into the cache while serving the client.
origin/peerorigin
Package peerorigin is the cadish peer-cache read-through origin (#7).
Package peerorigin is the cadish peer-cache read-through origin (#7).
origin/s3origin
Package s3origin is cadish's S3-compatible upstream origin (e.g.
Package s3origin is cadish's S3-compatible upstream origin (e.g.
pipeline
Package pipeline is cadish's request-evaluation engine: it compiles a parsed Cadishfile site (the semantics-free AST from internal/cadishfile) into an executable Pipeline and evaluates each request through the cache lifecycle.
Package pipeline is cadish's request-evaluation engine: it compiles a parsed Cadishfile site (the semantics-free AST from internal/cadishfile) into an executable Pipeline and evaluates each request through the cache lifecycle.
proxyproto
Package proxyproto is a small, dependency-free reader for the HAProxy PROXY protocol (v1 text + v2 binary) headers, used by cadish's opt-in PROXY-protocol listener (internal/server) to recover the real client address when cadish sits behind an L4/TCP-passthrough load balancer (HAProxy send-proxy, AWS NLB, GCP TCP LB) that prepends the original client/server tuple before the TLS/HTTP bytes.
Package proxyproto is a small, dependency-free reader for the HAProxy PROXY protocol (v1 text + v2 binary) headers, used by cadish's opt-in PROXY-protocol listener (internal/server) to recover the real client address when cadish sits behind an L4/TCP-passthrough load balancer (HAProxy send-proxy, AWS NLB, GCP TCP LB) that prepends the original client/server tuple before the TLS/HTTP bytes.
ratelimit
Package ratelimit is cadish's in-memory, per-node token-bucket rate limiter — the stateful server-side half of the native `rate_limit` security primitive.
Package ratelimit is cadish's in-memory, per-node token-bucket rate limiter — the stateful server-side half of the native `rate_limit` security primitive.
server
Package server is cadish's HTTP caching reverse proxy: the layer that turns the pure pipeline decisions (internal/pipeline), the two-tier cache (internal/cache) and the origin layer (internal/origin) into a live net/http handler.
Package server is cadish's HTTP caching reverse proxy: the layer that turns the pure pipeline decisions (internal/pipeline), the two-tier cache (internal/cache) and the origin layer (internal/origin) into a live net/http handler.
tlsacme
Package tlsacme implements cadish's TLS termination with automatic ACME (Let's Encrypt) certificate issuance — the "Caddy half" of cadish: a site that declares `tls { acme you@example.com }` gets HTTPS with auto-renewing certs and no proxy in front.
Package tlsacme implements cadish's TLS termination with automatic ACME (Let's Encrypt) certificate issuance — the "Caddy half" of cadish: a site that declares `tls { acme you@example.com }` gets HTTPS with auto-renewing certs and no proxy in front.
vcladapt
Package vcladapt is a best-effort Varnish VCL → Cadishfile converter (the `cadish adapt` command).
Package vcladapt is a best-effort Varnish VCL → Cadishfile converter (the `cadish adapt` command).
version
Package version exposes cadish's build/version information.
Package version exposes cadish's build/version information.
test
integration
Package integration holds the real-binary, Docker-based end-to-end harness (backlog #4 / task #34).
Package integration holds the real-binary, Docker-based end-to-end harness (backlog #4 / task #34).
origin command
Command test-origin is a small, configurable HTTP origin for exercising cadish end-to-end: deterministic synthetic objects, tunable latency, optional flakiness, ETag/Last-Modified, and Range support.
Command test-origin is a small, configurable HTTP origin for exercising cadish end-to-end: deterministic synthetic objects, tunable latency, optional flakiness, ETag/Last-Modified, and Range support.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL