I'm a solo developer and I currently have 110 projects on my development workstation. These are a combination of my own projects and freelance client's projects over the last 20 years.
Not all of them are still live on the internet but my general strategy to keep everything in order is to have an encrypted blob of text associated to each project using a CLI based password manager that I use. I've written about this tool on my blog at https://nickjanetakis.com/blog/managing-your-passwords-on-th....
It contains things like which domain registrar I used, where the hosting is, passwords for everything, random notes that are important, context about the client, etc..
Keeping the stacks separate in development is easy with Docker, and for my non-legacy clients I tend to just spin up a DO droplet and use Ansible to manage it (or use DO's 1 click installer for things like WP sites).
It wouldn't be a problem at all to hand over any of these projects to someone else but in the 20 years of doing this, I was never put in a position where a client told me to hand the reigns over to someone else.
I still have some really old clients from the mid 2000s that have 10,000+ line apps written in PHP with no frameworks. Having to patch that app haunts my dreams. Luckily I haven't had to touch it since 2007 and it miraculously still runs well.