tests · local dev · AI agents

A local baby of
your production stack.

Every test run and every AI-agent session gets its own fresh, seeded, disposable copy of your app's real backing services — spun up in Docker, thrown away after. Not mocks. Not an emulator. Real MySQL today; more engines next.

Describe your backend once in babystack.config.ts. Your tests just read DATABASE_URL — they never import babystack.

agent — baby

# the agent loop — wake · home · break · reset, on repeat

01 · the one move

Delete your test-database plumbing.

A real engine, isolated per worker, seeded from a baseline built once — instead of a shared dev DB you truncate by hand, or mocks that quietly drift from production.

before hand-rolled
  • A shared dev database every suite races to reset
  • beforeEach truncation that forgets a table
  • Mocks that pass while production would 500
  • Lifecycle glue copy-pasted across repos
after babystack
  • One babystack.config.ts — the migrate/seed you already run
  • Three lines in vitest.config.ts, zero test-code changes
  • A fresh, seeded, isolated real MySQL per worker
  • Gone after the run — nothing to clean up
// vitest.config.ts — the whole integration
test: {
  globalSetup: ['@babystack/vitest/global-setup'],
  setupFiles:  ['@babystack/vitest/setup'],
}
02 · built for agents

A real backend an agent can break — and undo.

The baby CLI hands an agent a persistent, seeded MySQL that survives across commands, plus a one-word reset back to pristine. The connection URL never changes — so it experiments, checks, and wipes as many times as it needs.

claude code — baby

# a coding agent breaks a real DB, then undoes it — same URL, no cleanup

01
baby wake

Provision + seed a real MySQL and leave it running. Rediscovered across commands by a per-project label — no daemon, no state file.

02
eval "$(baby home)"

Export a DATABASE_URL for the seeded database. Non-destructive — run it as often as you like.

03
baby reset

Reload the pristine baseline in place — same URL, no container re-provision. The agent's undo button.

03 · what's inside

One engine, small pieces.

A pure core with pluggable seams; adapters that orchestrate the real engine and never emulate it. MySQL + Vitest is the first delivery vehicle.

@babystack/core
Config, lifecycle, the EngineAdapter / Lease / Pool seams + injected Clock / CommandRunner ports. Pure — no I/O.
@babystack/docker
The generic Docker muscle: provision, authenticated wait-ready, idempotent dispose, label-scoped GC.
@babystack/mysql
Real mysql:8.4 — a seeded mysqldump baseline, then a fresh leased database per worker.
@babystack/vitest
globalSetup + setupFiles. Zero test-code changes; a private database per worker, in parallel.
@babystack/cli
The baby binary (operator + agent surface): doctor · wake · home · reset · sleep, all --json.

Orchestrate & delegate, never emulate. Your app talks to a real MySQL server over a normal connection string — it can't tell it's in a test. No in-memory fake, no reimplemented wire protocol.

04 · try it

Try it today.

Now on npm (v0.1.0). With Docker running, the runnable proof is a real Express + Drizzle + MySQL app whose tests hit fresh, seeded, isolated real MySQL — with zero babystack imports in the test code.

# clone + install (pnpm)
git clone https://github.com/babystack/babystack && cd babystack
pnpm install

# with Docker running — the example app's suite against real MySQL:
pnpm --filter users-api test