The pet vs cattle story 🐾

One of the big shifts the DevOps movement brought is the idea of reproducibility for servers. The old way was to treat a server as a pet: somethign precious and long lived. This usually means that you makes changes manually to make sure nothing break, but over time all these changes pile ups and the server became sort of a snowflake, without anybody knowing exactly how to build/rebuild it from scratch.

The alternativey is to treat servers as cattle: short lived, automated and disposable. If something doesn’t work, you remove it and create a new one. The server is no longer precious, but the build pipeline that spawns the server became the real pet.

This is a well-accepted principle for production infrastructure nowadays, but I still see this kind of pattern make a resurgence in one place: the local development environment.

The local env as a pet 🐕

A common pattern on a lot of dev:

  • A developer sets up their local env once, painfully.
  • They manually load some data to test their current feature.
  • Over time, they accumulate test data for several features, some manual tweaks to the config, a database in a slightly custom state, and so on.
  • The env “works”, and the dev doesn’t want to spend again all the time to set up the application and load the data, so scratching the local env become a big deal

At that point the local env has become a pet. It’s unique, precious, and the developer really doesn’t want to break it. Onboarding a new teammate means a day of fighting with setup scripts, and “it works on my machine” comes back in full force because nobody’s env is quite the same.

This is exactly the mindset the DevOps movement pushed back against for production, but we’ve somehow kept it locally.

Making the local env reproducible 🧱

The alternative is to apply the same principles locally: instrumentalize everything. Instead of trying to keep your local env intact and carefully carry your data across features, invest in a proper process to build the app, initialize it, load the data and run it. Then wipe and recreate freely.

Concretely, I like to do this with some command in a justfile (see my post Just do it ✅ on why I like Just) containing something like:

  • build: build the app / container / image.
  • run: run the app.
  • init: initialize the app (create the database, run migrations, create buckets, etc.).
  • seed-data: load a realistic dataset. This is often the biggest investment, but absolutely worth it.

Once each service has its own justfile with these commands, you can use Just’s composability to write a top-level justfile that orchestrates them all. A single just bootstrap at the root then gives you a fresh, fully working local env across all services, with each service’s implementation details staying in its own repo/folder.

Why it’s worth the investment 💡

The first few times, it feels like overkill. Writing a proper data loading script takes significantly more effort than just clicking around the app to create a few test records. But the payoff is real:

  • Onboarding becomes trivial. A new developer clones the repo, runs one command, and has a working env.
  • Bugs are easier to reproduce. “It works on my machine” stops being an argument when everyone’s machine is built from the same script.
  • The setup stays alive. Because everyone uses those commands daily, they can’t silently rot the way a README does.
  • Ready for Agentic coding having this kind of setup allows agent to operate a larger scale and can enable automatic QA, etc

The bar to clear is simple: rebuilding your local env from scratch should be something you do without thinking about it. If the idea of wiping your database right now makes you uncomfortable, you’re probably still in pet territory.

Cattle, not pets. Even on your laptop.