- This is a project template for housing and executing Firebase scripts via Typescript and the Firebase Admin SDK.
- Execute
npm installto install the dependencies.
- Create a
.envfile in the root of the project and place all your environment variables in that file. - Make sure to include a
FIREBASE_SERVICE_ACCOUNTvariable containing the base64 encoded service account json file. For reference, see.env.sample.
- Create a new file in the
src/scriptsdirectory. - Make sure to set the script function as the
default export. - See
src/scripts/hello_world.tsfor an example.
-
To run a single or multiple scripts, run:
npm run scripts <script-name-1> <script-name-2> ...
-
For example:
npm run scripts hello_world hello_world