Does Time Machine restore whole system?
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.