Once you start your session, two things will happen:
You get connected to a pre-configured cloud environment
Foundry starts watching your code for any changes
The cloud environment you get connected to is as much as possible identical to the actual environment where your Firebase Cloud Functions run in the production. This is also an environment where we run your code, trigger the functions and sends you back the output. After you get connected to your cloud development environment, Foundry starts watching your code for changes. Every change notifies Foundry to upload your code into the cloud environment you are connected to. Foundry then loads and trigger all of your Firebase Cloud Functions based on the rules you provided in the foundry.yaml
config file. Both stdout
and stderr
of your functions are sent back to your terminal after each of such runs. The whole upload loop with the data transmission back to you usually takes up to 1 second. This loop creates a REPL-like experience for your functions and makes it easy to be sure that your functions' code behaves correctly with the production data once you deploy them.
Having an emulated Firestore database, RealtimeDb and Firebase Auth users in your development environment is especially useful to test the integration of your functions.
Below is an example of a development with Foundry running in the terminal alongside the code editor. You can see the real-time feedback you get from the REPL functionality.