Project Case Study

SleepyDB

0 Sessions
0 Lines Changed
0 Files
2.7M Tokens
70.1h Time

The build story

SleepyDB is a serverless database engine that accepts Postgres connections but stores data on S3 using SQLite as its execution layer — built to let apps use familiar SQL tooling against cloud object storage. The proxy-owned transaction model exists because SQLite's transaction semantics don't stretch across multiple databases, each with its own transaction system, so the proxy layer has to hold that contract together. Performance wasn't a priority until it was: once real numbers came in, a 13k-line sprint with a step-plan doc driving parallel worktrees became the right tool to close the gap fast. A parallel thread ran alongside all of this — diagnosing 8-minute CI builds for a client app, where the culprit turned out to be webpack cache invalidation and ephemeral BuildKit, not the Next.js compiler itself.

Work timeline

Lines of code over time

Key Decisions

01
Established the Postgres-on-S3 architecture, defined the VFS layer, and laid out the pg-function mapping that would guide all subsequent implementation.
02
Built the Postgres wire-protocol proxy and worked through correctness bugs — including a max() aggregate returning wrong answers — along with cast and operator compatibility shims.
03
Implemented transaction ownership in the proxy, WAL/VFS surgery for disk durability, connection admission control, and promotion-epoch storage fixes.
04
Ran the P0 performance plan: read-side VFS batching (44.7k→70k reads), O(1) telemetry routing, plan caching, and SQLite adapter tuning to drive throughput numbers toward targets.
05
Assigned red-team, security-reviewer, and architect roles to audit the build, then executed fix-waves covering lease/CAS, auth (S1A), and kernel hardening (S1B).
06
Built a token-based CSS design system from scratch, iterated through five visual versions via browser screenshot review, and fixed a latent dialog-overlay bug present since v1.
07
Profiled the Next.js browser-build pipeline for a production app, identifying that webpack cache invalidation and ephemeral BuildKit — not the compiler — accounted for the majority of an 8-minute build.

Source Breakdown

codex
97%
117 sessions
claude
3%
4 sessions

Project arc

Core Design & Storage Layer
Established the Postgres-on-S3 architecture, defined the VFS layer, and laid out the pg-function mapping that would guide all subsequent implementation.
Protocol & Compatibility Bridge
Built the Postgres wire-protocol proxy and worked through correctness bugs — including a max() aggregate returning wrong answers — along with cast and operator compatibility shims.
Concurrency & Durability
Implemented transaction ownership in the proxy, WAL/VFS surgery for disk durability, connection admission control, and promotion-epoch storage fixes.
Performance Optimization
Ran the P0 performance plan: read-side VFS batching (44.7k→70k reads), O(1) telemetry routing, plan caching, and SQLite adapter tuning to drive throughput numbers toward targets.
Security & Correctness Review
Assigned red-team, security-reviewer, and architect roles to audit the build, then executed fix-waves covering lease/CAS, auth (S1A), and kernel hardening (S1B).
Admin UI Design System
Built a token-based CSS design system from scratch, iterated through five visual versions via browser screenshot review, and fixed a latent dialog-overlay bug present since v1.
Build Pipeline Profiling
Profiled the Next.js browser-build pipeline for a production app, identifying that webpack cache invalidation and ephemeral BuildKit — not the compiler — accounted for the majority of an 8-minute build.

Technologies

PostgreSQL wire protocol SQLite VFS internals S3 / object storage architecture Elixir / Phoenix / LiveView Next.js webpack internals BuildKit / Docker layer mechanics Content-addressed caching CSS custom properties / token systems Git worktrees Build performance profiling Browser automation via MCP Shell experiment harness scripting WCAG 2.2 contrast verification Python scripting for bulk file edits WebAssembly (wasm SWC)

6 featured sessions