A local run that starts clean and leaves clean
The best local command is one you can run after a week away: it brings the services up, and another command takes them down without leftover containers.
A local setup that only I can start, and that leaves Docker containers running until my laptop fans remind me, is not a setup. It is a half-finished ritual. I want two commands I can remember after a week away: one that brings the local services up, and one that takes them down.
On my site's monorepo those are `db:local:up` and `db:local:down`, with a `db:local:status` when I want to see whether I already started it. Your names will differ. The habit should not.
Up should be enough
The "up" command should:
- Start the database and any other local services the app needs.
- Be safe to run if they are already running.
- Print a URL or a port, not a stack trace, on success.
- Fail clearly if Docker is not running, instead of hanging.
I should not have to remember a second manual migrate command just to get a blank database into a workable state, unless that migrate is itself a named script the README mentions in the same breath. Hidden steps are how a new clone dies on the first morning.
Down should really go down
The "down" command should stop the containers and, when I ask it to, remove the volumes I do not need to keep. I want a way to keep data between days, and a way to wipe it. Those should be different flags or different scripts, not a guess about whatever Docker left around.
Leftover networks, volume names that collide with a later project, and a Postgres that is still bound to a port will waste more time than the script took to write.
One README sentence
If the README cannot say "install Node and Docker, run this, open this URL," the local run is not finished. I do not need a novel. I need the command, the URL, and the command that cleans it up.
This is also a gift to future me. The day I come back to a repo after working on something else, I will not remember the compose project name. I will remember `pnpm db:local:up` if I made that the name of the ritual.
A lot of "developer experience" work is just this: fewer unique snowflakes, more commands that do what they say, and a laptop that is quiet when the work is over.