Does this give me the code and all the stuff I need to run the app? Can I write an open source app with this?
As for running the software the platform has a proprietary license obviously but you can host your own Retool backend from which to serve the apps to your end users (check the docker repo). This is an alternative to the SaaS/cloud based app hosting at https://retool.com/.
There's a free tier to edit and run the apps but professional usage will have a license fee. This is not unlike making an app with VB which required buying VB and having end users buy and run Windows.