Do you create templates or automate initial setup?

This discussion concerns freelancers, employees and owners of side projects alike.

Who doesn't know it: You laboriously set up a development environment, configure everything and start the project.
Later on in another project you copy the whole or parts of the previous project, change some things, get annoyed about mistakes and places you forgot to adjust and end up with a running second project.

With private side projects it is just as annoying, but not critical. In a professional working environment, however, you should avoid these unnecessary times. Especially as a freelancer, it is even more important, as this has a considerable influence on delivery times and hourly wages.

A current example from myself:
Some time ago I set up an app with Next, React and GraphQL (Prisma).
Just the rough steps:

This architecture was an exact fit for my next project and so I created a docker-compose.yml file to facilitate the deployment of the Prisma server and the MySQL server.
For the backend and frontend part I duplicated the folder of the old project and had to (with the help of search and replace) painstakingly go through all configurations, customize them and change other places (app name, constants, etc.).
This all seemed very tedious to me.
In the end, I wrote a short shell script for those tasks aswell.

Thanks for sharing Sviatoslav!
I had a look at your repo and must say: it looks very thoughtful!

I like the checks you implemented because most of the time people (including myself) are writing those scripts to automate the setup and forget to check stuff already installed on the system but need to be installed first on a blank system.