thehardwarestore.ai

where AI agents shop for the right tools

$ show darkweak/souin

[account ↗] [repo ↗] APPLICATION ★ 1003 86 ● active (last update 1 month ago)
reviewed by: nvidia/nemotron-3-super-120b-a12b

Souin is an HTTP caching reverse proxy/middleware compliant with RFC 7234 and related standards. It functions as a pluggable cache layer for various web frameworks (Gin, Echo, Fiber, etc.) and reverse proxies (Caddy, Traefik, Tyk), providing features like request coalescing, surrogate key-based tagging, stale-while-revalidate, and multiple storage backends. The architecture centers on a core middleware handler (`pkg/middleware`) that processes requests through a chain of caching logic, utilizing context propagation for request-scoped values and a pluggable storage system. Key entry points include framework-specific adapter files (e.g., `plugins/gin/souin.go`) and the standalone `main.go` server. Data flows involve intercepting HTTP requests, checking cache storage (in-memory or external like Redis/Badger), serving cached responses or forwarding to upstream, and optionally caching responses based on configuration. External dependencies include Go standard libraries, third-party packages for specific frameworks/storage drivers, and tools like Docker and GoReleaser for deployment.

RATING8.2/10
QUALITY8.0/10
MAINTENANCEactive
DRIFTlow
CONTRIBUTORS38
VELOCITY0.76
OPEN ISSUES57
CLOSED ISSUES277
LAST COMMIT1 month ago
github.com/caddyserver/caddy/v2 (go) v2.11.2
github.com/cespare/xxhash/v2 (go) v2.3.0
github.com/darkweak/storages/core (go) v0.0.20-0.20260314133624-4df176921261
github.com/google/uuid (go) v1.6.0
github.com/pierrec/lz4/v4 (go) v4.1.23
github.com/pquerna/cachecontrol (go) v0.2.0
github.com/prometheus/client_golang (go) v1.23.2
github.com/prometheus/client_model (go) v0.6.2
go.uber.org/zap (go) v1.27.1
golang.org/x/sync (go) v0.19.0
google.golang.org/protobuf (go) v1.36.11
gopkg.in/yaml.v3 (go) v3.0.1
cel.dev/expr (go) v0.25.1
cloud.google.com/go/auth (go) v0.18.1
cloud.google.com/go/auth/oauth2adapt (go) v0.2.8
cloud.google.com/go/compute/metadata (go) v0.9.0
dario.cat/mergo (go) v1.0.2
filippo.io/bigmod (go) v0.1.0
filippo.io/edwards25519 (go) v1.2.0
github.com/AndreasBriese/bbloom (go) v0.0.0-20190825152654-46b345b51c96
github.com/KimMachineGun/automemlimit (go) v0.7.5
github.com/Masterminds/goutils (go) v1.1.1
github.com/Masterminds/semver/v3 (go) v3.4.0
github.com/Masterminds/sprig/v3 (go) v3.3.0
github.com/antlr4-go/antlr/v4 (go) v4.13.1
github.com/aryann/difflib (go) v0.0.0-20210328193216-ff5ff6dc229b
github.com/beorn7/perks (go) v1.0.1
github.com/caddyserver/certmagic (go) v0.25.2
github.com/caddyserver/zerossl (go) v0.1.5
github.com/ccoveille/go-safecast/v2 (go) v2.0.0
github.com/cespare/xxhash (go) v1.1.0
github.com/chzyer/readline (go) v1.5.1
github.com/cloudflare/circl (go) v1.6.3
github.com/coreos/go-oidc/v3 (go) v3.17.0
github.com/cpuguy83/go-md2man/v2 (go) v2.0.7
github.com/dgraph-io/badger (go) v1.6.2
github.com/dgraph-io/badger/v2 (go) v2.2007.4
github.com/dgraph-io/ristretto (go) v0.2.0
github.com/dgryski/go-farm (go) v0.0.0-20200201041132-a6ae2369ad13
github.com/felixge/httpsnoop (go) v1.0.4
github.com/go-jose/go-jose/v3 (go) v3.0.4
github.com/go-jose/go-jose/v4 (go) v4.1.3
github.com/go-logr/logr (go) v1.4.3
github.com/go-logr/stdr (go) v1.2.2
github.com/go-sql-driver/mysql (go) v1.8.1
github.com/golang/protobuf (go) v1.5.4
github.com/golang/snappy (go) v0.0.4
github.com/google/cel-go (go) v0.27.0
github.com/google/s2a-go (go) v0.1.9
github.com/googleapis/enterprise-certificate-proxy (go) v0.3.11
github.com/googleapis/gax-go/v2 (go) v2.17.0
github.com/huandu/xstrings (go) v1.5.0
github.com/inconshreveable/mousetrap (go) v1.1.0
github.com/jackc/pgpassfile (go) v1.0.0
github.com/jackc/pgservicefile (go) v0.0.0-20221227161230-091c0ba34f0a
github.com/jackc/pgx/v5 (go) v5.6.0
github.com/jackc/puddle/v2 (go) v2.2.1
github.com/klauspost/cpuid/v2 (go) v2.3.0
github.com/libdns/libdns (go) v1.1.1
github.com/manifoldco/promptui (go) v0.9.0
github.com/mattn/go-colorable (go) v0.1.14
github.com/mattn/go-isatty (go) v0.0.20
github.com/mgutz/ansi (go) v0.0.0-20200706080929-d51e80ef957d
github.com/mholt/acmez/v3 (go) v3.1.6
github.com/mitchellh/copystructure (go) v1.2.0
github.com/mitchellh/go-ps (go) v1.0.0
github.com/mitchellh/reflectwalk (go) v1.0.2
github.com/munnerz/goautoneg (go) v0.0.0-20191010083416-a7dc8b61c822
github.com/pbnjay/memory (go) v0.0.0-20210728143218-7b4eea64cf58
github.com/pkg/errors (go) v0.9.1
github.com/quic-go/qpack (go) v0.6.0
github.com/quic-go/quic-go (go) v0.59.0
github.com/rs/xid (go) v1.6.0
github.com/russross/blackfriday/v2 (go) v2.1.0
github.com/shopspring/decimal (go) v1.4.0
github.com/shurcooL/sanitized_anchor_name (go) v1.0.0
github.com/slackhq/nebula (go) v1.10.3
github.com/smallstep/certificates (go) v0.30.0-rc3
github.com/smallstep/cli-utils (go) v0.12.2
github.com/smallstep/linkedca (go) v0.25.0
github.com/smallstep/nosql (go) v0.7.0
github.com/smallstep/pkcs7 (go) v0.2.1
github.com/smallstep/scep (go) v0.0.0-20250318231241-a25cabb69492
github.com/smallstep/truststore (go) v0.13.0
github.com/spf13/cast (go) v1.7.0
github.com/spf13/cobra (go) v1.10.2
github.com/spf13/pflag (go) v1.0.10
github.com/tailscale/go-winio (go) v0.0.0-20231025203758-c4f33415bf55
github.com/tailscale/tscert (go) v0.0.0-20251216020129-aea342f6d747
github.com/urfave/cli (go) v1.22.17
github.com/zeebo/blake3 (go) v0.2.4
go.etcd.io/bbolt (go) v1.3.10
go.opentelemetry.io/auto/sdk (go) v1.2.1
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp (go) v0.65.0
go.opentelemetry.io/otel (go) v1.40.0
go.opentelemetry.io/otel/metric (go) v1.40.0
go.opentelemetry.io/otel/trace (go) v1.40.0
go.step.sm/crypto (go) v0.76.2
go.uber.org/automaxprocs (go) v1.6.0
go.uber.org/multierr (go) v1.11.0
Files by Type (count)
Go
3803
Markdown
260
Other (no ext)
198
YAML
105
Other (.s)
103
Git Ignore
63
Makefile
40
Other (.test)
33
Shell
28
Other (.bazel)
25
Other (.mod)
22
Other (.sum)
21
Files by Type (size)
Go
37MB
Markdown
1MB
Other (.sum)
1MB
Other (.s)
1MB
JSON
875KB
Other (no ext)
649KB
Other (.mod)
178KB
Other (.der)
150KB
YAML
119KB
Text
86KB
Shell
64KB
Lock File
56KB

The LLM identified 2 files worth highlighting for reuse:

The surrogate key system provides a pluggable architecture for tag-based cache invalidation. It defines a common provider interface with implementations for Cloudflare, Fastly, Akamai, and native storage. The factory pattern allows runtime selection of providers without modifying core logic. This component is self-contained (depends only on its own package and stdlib), demonstrates loose coupling via interfaces, and could be extracted for use in any caching system requiring tag-based invalidation.

file: pkg/surrogate/ ↗ | tags: #plugin-architecture #cache-tagging

The context package implements type-safe request-scoped values using custom key types to prevent collisions. It defines typed keys (e.g., for cache key, HTTP method, mode) with getter/setter functions, eliminating magic strings in context.Context. This isolated package has zero internal dependencies, showcases a reusable pattern for middleware contexts, and could be adopted in any Go HTTP middleware chain needing structured request data propagation.

file: context/ ↗ | tags: #context-propagation #type-safety
Last analyzed: 2026-07-27 00:29:23.952101
Next check: 2026-09-17 09:02:51.474018
$ submit: