Does Time Machine restore whole system? I've never used Time Machine before and I pretty much know how backups work but I'm wondering if my system will work out of the box once restored from Time Machine backup?

I mean I have tons of stuff on my Mac and configuring it all once something goes wrong will take me days. I'm talking about my whole programming environment including multiple Docker images, databases, hundreds of npm packages, custom system files (like "hosts"), hundreds of Applications with custom settings, some games etc.

If I decide to backup EVERYTHING and things go south can I just grab a brand new MacBook, connect my external hard drive with TM backup and it will import EVERYTHING meaning it will work just like my system before crash? 

BTW I'm using a standard external HDD.
Time Machine by default backs up nearly everything in your macOS partition. It excludes log files, Spotlight indexes, caches, temporary files and trash (have a look: On OS X, what files are excluded by rule from a Time Machine backup?). The backup includes docker files, npm packages, your personal files etc. When the backup is completed, the hard drive will NOT be bootable, meaning that you can't run macOS from your Time machine backup.

You can restore from a Time machine backup without or after installing an operating system. If you restore without installing an operating system:


All the backup will be restored to your disk, including the operating system (for example Yosemite). [NOTE: If the Mac you are restoring to does not support the version of macOS in your TM Backup, it will still not be able to boot from the restore].
It can be done from either Recovery or Installation USB. No internet access is required.
After the backup is restored, everything will be exactly how it was while you were doing the backup.


If you restore after installing an operating system:


Only personal files and the files you select can be restored and will not restore the operating system.
Might not restore packages, system tweaks and files that are stored in directories other than traditional ones (for example "/MyApp/mysourcecode.cs" will not be restored by default).


If you think this contains misinformation, please comment because I never actually restored after an operating system installation.