In production web servers, a database like PostgreSQL is managed as its own service, maybe on its own dedicated hardware.
What do you do in local development, though? Some people use SQLite for development and PostgreSQL in production, but that means using two very different databases. Others run a system-wide database service on their laptop and share it between any projects which need one, which is easy to screw up.
Years ago I blogged about a way to run a separate instance of Postgres for each project under development, but I think my solution could be made easier to use.
I think what I want is a wrapper program: if you'd normally invoke ./foo-server --port=8080, instead you'd use pg-run ./foo-server --port=8080. This hypothetical pg-run would start Postgres, then run the given command with environment variables set for accessing the right database, and when the command finished it would stop Postgres again.
Does this exist already?