dhaga.blog

dhaga. blog · Engineering

Engineering

Deep dives on the hardest problems we solved building Dhaga — rendering a 21k-node graph in the browser, keeping an AI product's unit economics alive, isolating tenants on serverless Postgres. Executive summary up top, full engineering detail below.

How we build Dhaga with Claude Code

A checked-in rulebook the AI must obey, hooks that gate every single edit, and a persistent memory that survives across sessions. Our AI-assisted engineering workflow — the practices that make an agent a reliable contributor instead of a fast intern who forgets everything.

engineeringaiclaude-codedeveloper-workflow

Isolating tenants on serverless Postgres

Row-level security is easy to turn on and easy to get catastrophically wrong. How a connection pooler almost leaked one customer's data into another's in Dhaga Cloud, and the boot guard that makes it impossible.

engineeringpostgressecuritymulti-tenancy

The bill is the model, not the servers

In an AI product, infrastructure is a rounding error and inference is the P&L. How we found the real cost driver in Dhaga, and the guardrails that keep a heavy user from costing us $7,200 a month.

engineeringaicostllm

The feature flag that didn't fire

Our documented escape hatch for a native dependency didn't work — the app crashed on deploy anyway. A short war story about how `import` runs before your code does, and why a feature flag can't gate a static import.

engineeringdebuggingdeploymentjavascript

A schema that heals itself on cold start

No migration tool, no migration files, and a 15-second sign-in. How a single content hash turned a full schema replay on every serverless cold start into a no-op — while keeping the zero-config, self-healing setup that makes Dhaga trivial to self-host.

engineeringpostgresmigrationsself-hosting

Rendering a 21,000-node graph in the browser

63,000 edges, 60fps pans, and a laptop with integrated graphics — without a graph database, a server-side render farm, or a spinner that never ends. How Dhaga renders a whole knowledge graph client-side.

engineeringperformancedata-visualizationgraph