- Clone the repo
- Install Firebase CLI
npm install -g firebase-tools
- Login to Firebase
firebase login
- Login to Google Cloud
gcloud auth application-default login
- Navigate to the
functionsdirectory - Create a virtual environment
python -m venv venv
source venv/bin/activate # On Windows use: venv\Scripts\activate
- Install required dependencies
pip install -r requirements.txt
These integration tests use a real Neo4j instance.
Set these values in functions/.env:
NEO4J_TEST_URI=bolt://localhost:7687
NEO4J_TEST_PASSWORD=your_passwordThen run from the functions directory:
pytestIf pytest doesn't work try with
python -m pytestRun the emulator to test Cloud Functions locally:
firebase emulators:start --only functions
The functions will be available at:
"http://127.0.0.1:5001/pecha-backend/us-central1/api/{function-name}
Run the local hosting emulator:
firebase emulators:start --only hosting
The site will be available at:
http://localhost:5000
Once your functions are working locally, deploy them to Firebase:
firebase deploy --only functions
# Switch to test branch first
git checkout test
# Deploy to test project
firebase deploy --only functions --project test
firebase deploy --only functions --project prod
When you’re ready to publish changes:
firebase deploy --only hosting
The website will be available at:
https://pecha-backend-dev.web.app
firebase deploy --only hosting --project prod
The website will be available at:
https://pecha-backend.web.app
Then restart the emulator:
firebase emulators:start --only functionsEach environment runs code from its dedicated branch:
- Dev:
devbranch → pecha-backend-dev project - Test:
testbranch → pecha-backend-test-3a4d0 project - Prod:
mainbranch → pecha-backend project
git branch --show-currentDeploy to Dev Environment:
git checkout dev
firebase deploy --only functions --project devDeploy to Test Environment:
git checkout test
firebase deploy --only functions --project testDeploy to Production:
git checkout main
firebase deploy --only functions --project prodEach environment automatically uses:
- Different Neo4j databases (configured via Firebase secrets)
- Different storage buckets (auto-detected by project ID)
- Different code versions (from their respective git branches)
Available at: https://pecha-backend.web.app/api