An untested caching proxy for the CDISC Library API.
It exists because repeatedly hammering the same upstream endpoint is wasteful, slow, and something only raccoons with a network cable would design.
Badgers reviewed the design. They were unimpressed, but approved it anyway. 🦝🦡
MIT licensed. Use it, fork it, question it.
cdisc-proxy is a read-only reverse HTTP proxy with deterministic caching, built specifically for CDISC Library API endpoints.
It sits between your clients and the CDISC API and ensures that:
- identical requests are treated identically
- upstream calls are minimized
- concurrency does not turn into chaos
- Proxies GET requests under
/api/mdr/... - Talks to CDISC Library API using an API key
- Canonicalizes requests to avoid cache poisoning
- Uses two-tier caching
- L1: Redis / Valkey (fast)
- L2: sled+filesystem blobs or PostgreSQL (durable)
- Uses single-flight request coalescing
- Applies negative caching for errors
- Applies backpressure to upstream calls
- Survives high concurrency without panicking
- ❌ Write or mutate upstream data
- ❌ Pretend bad upstream responses are your fault
- ❌ Authenticate users beyond an optional shared key
- ❌ Care about badly written clients
- Test it
- Break it
- Patch it
- Repeat it
git clone https://github.com/your-org/cdisc-proxy.git
cd cdisc-proxy
cargo build --releaseBinary:
target/release/cdisc-proxyapk add --no-cache ca-certificates libgcc libstdc++ redis postgresql-client
cp target/release/cdisc-proxy /usr/local/bin/
mkdir -p /etc/conf.dRun:
cdisc-proxy /etc/conf.d/cdisc-proxy.confapt update
apt install -y redis postgresql-client ca-certificates
cp target/release/cdisc-proxy /usr/local/bin/Run:
cdisc-proxy /etc/cdisc-proxy.yamlFROM alpine:3.20
RUN apk add --no-cache ca-certificates libgcc libstdc++
COPY cdisc-proxy /usr/local/bin/cdisc-proxy
COPY cdisc-proxy.yaml /etc/cdisc-proxy.yaml
EXPOSE 8080
ENTRYPOINT ["/usr/local/bin/cdisc-proxy", "/etc/cdisc-proxy.yaml"]Example:
server:
port: 8080
listen: ["0.0.0.0"]
auth_key: null
cdisc:
base_url: "https://library.cdisc.org/api"
api_key: "REDACTED"
cache:
l1:
driver: "redis"
address: "redis://127.0.0.1:6379"
ttl: "10m"
l2:
storage_path: "/var/lib/cdisc-proxy"
postgres_dsn: null
ttl: "30d"
cleanup_enabled: true
cleanup_interval: "1h"
scheduler:
enabled: false
interval: "1h"GET /api/...— proxied CDISC Library API callsGET /health— cached + live health checks
Response header:
X-Cache-Tier: L1-HIT | L2-HIT | MISS
MIT.
Do what you want.
If it breaks, check your config before blaming the badgers.