Kido Bag — The Shadcn for Distributed Systems
High-concurrency architecture blueprints & 125+ headless primitives by Duong Phuc Khanh (khanhdp.com). 100% white-box copy-and-paste primitives for PostgreSQL, Valkey, Kafka, and Bun.
The Shadcn Model for Backend
No heavy black-box npm dependencies. Copy the exact TypeScript files, schemas, and SQL scripts directly into your repo.
High-Concurrency Invariants
Every blueprint includes mathematical time-complexity proofs, lock-contention mitigation, and memory footprint budgets.
125+ Headless Primitives
Distributed locks, singleflight deduplicators, token bucket rate limiters, outbox workers, and memory-mapped queues.
White-Box Battle Blueprints
YouTube-Scale View Counter
Adaptive Slotted Write + HyperLogLog Deduplication + Anti-F5 Defense preventing 99.9% database write contention.
Enterprise AI RAG Copilot
Hybrid Dense-Sparse Embeddings + pgvector HNSW indexing + dynamic sliding chunk cache with citation verification.
Flash-Sale Zero-Oversell Engine
Lua SingleFlight atomic deduction + multi-level inventory sharding + distributed mutex with graceful stock rollback.
Tiered Storage & S3 Offload
Local NVMe write-through buffer + cold Parquet offload pipeline to S3 Glacier with DuckDB zero-copy query engine.
Realtime Distributed Feed
Fanout-on-write for standard accounts combined with fanout-on-read for celebrity nodes to eliminate thundering herd.
Zero-Downtime Migration Engine
Shadow dual-writing + real-time data consistency verifier + automated blue-green cutover with instant rollback.