Zend certified PHP/Magento developer

How does a cloud NAS manage to be accessed from the outside of a LAN through an app?

I have a cloud NAS within my home network and I can’t figure out how it manages to be accessed from the outside through an app. How does the app always know at what address requests should be sent, when the public address of my router is always changing? And also, how does my router know that requests from the outside should be forwarded to the NAS? Was the NAS able to setup a static NAT configuration on its own?