This repository contains deployable Firebase Functions that provide backend functionality for the Open App Builder ecosystem.
Deployable functions can be found in ./src
- Node.js (version 22 recommended to match Firebase deployment)
It is recommended to use a Node version manager such as:
- Setup Environment Variables
cp .env.example .env- Install Dependencies
npm installUse start command to start the Firebase emulator suite and serve functions (with live-reload on change)
npm run start- The emulator UI will be available at http://127.0.0.1:4000/
- Function endpoints will be available at http://127.0.0.1:5001/
Once running, a list of available function endpoints will appear in the console.
You can trigger functions by sending requests to the endpoints using any REST client.
Recommended free and open-source options:
- REST Client for VS Code – Send requests from .http files
- Insomnia – Cross-platform graphical client
- HTTPie – Command-line HTTP client
Example request (VS Code REST Client)
my-request.http
POST http://127.0.0.1:5001/test/us-central1/groupJoin
Content-Type: application/json
Authorization: Bearer <your_token>
{
"example": "data"
}
Open the file in VSCode and click the Send Request button that appears
Example request (using cURL)
curl -X POST http://127.0.0.1:5001/test/us-central1/groupJoin \
-H "Content-Type: application/json" \
-H "Authorization: Bearer <your_token>" \
-d '{"example": "data"}'Ensure all production environment variables are set as expected in ./env.
Register a Firebase project (should be created in advance using the Firebase Console):
npm i -g firebase-tools
firebase login
firebase use --addThis will prompt you to select a project and specify an alias (useful for deploying to multiple projects).
See all available projects in .firebaserc. The active project can be changed via:
firebase use {alias}Deploy all functions:
firebase deployDeploy specific functions:
firebase deploy --only functions:myFunction1,functions:myFunction2See the Firebase Functions documentation for guidance on creating and structuring new functions.
When running locally, firestore emulators will populate any data located in the test/seed-data directory on startup, but will not persist data across sessions (cleans up on exit)
If additional seed data should be included for all emulator runs, the current state of emulator data can be exported via
npm run emulators:exportNote that the data will be exported as a set of LevelDB files, which cannot be read as plain text (designed for internal use). As such changes to these files will have to be reviewed by viewing within the firestore emulators.
Contributions are welcome! Please open issues or submit pull requests for improvements or new features.