How do I backup and restore a local site?

I lost a lot of work because I assumed that my Mac Time Machine backup would be sufficient to restore my local site. I was never able to make it would following the advise from this forum.

So now I am starting over by creating a local “test” site that I can experiment with to solve the backup problem before I start adding a lot of content. The site is local only (i.e., no live site).

What is the best way to back up and restore a local site with no live site?