You can find the firmware source code and documentation on
Github, as well as
nodemcu-flasher, a Windows only tools to flash the firmware to a module. There’s also a separate tool called
esptool that will let you flash nodemcu from Linux. If you find the documentation is all over the place, you might want to checkout NodeMCU video tutorial below.