├── .github ├── ISSUE_TEMPLATE │ ├── bug_report.md │ ├── config.yml │ └── docs.md └── workflows │ ├── test_node.yml │ ├── test_node_1st_gen.yml │ └── test_python.yml ├── .gitignore ├── .opensource └── project.json ├── CONTRIBUTING.md ├── LICENSE ├── Node-1st-gen ├── README.md ├── assistant-say-number │ ├── README.md │ ├── action.json │ ├── firebase.json │ └── functions │ │ ├── .eslintrc.json │ │ ├── index.js │ │ ├── package.json │ │ └── pnpm-lock.yaml ├── authenticated-json-api │ ├── README.md │ ├── database.rules.json │ ├── firebase.json │ ├── functions │ │ ├── .eslintrc.json │ │ ├── index.js │ │ ├── package.json │ │ └── pnpm-lock.yaml │ └── public │ │ ├── index.html │ │ ├── main.css │ │ └── main.js ├── authorized-https-endpoint │ ├── README.md │ ├── firebase.json │ ├── functions │ │ ├── .eslintrc.json │ │ ├── index.js │ │ ├── package.json │ │ └── pnpm-lock.yaml │ └── public │ │ ├── firebase-logo.png │ │ ├── index.html │ │ ├── main.css │ │ └── main.js ├── bigquery-import │ ├── README.md │ ├── firebase.json │ └── functions │ │ ├── .eslintrc.json │ │ ├── index.js │ │ ├── package.json │ │ └── pnpm-lock.yaml ├── child-count │ ├── README.md │ ├── firebase.json │ └── functions │ │ ├── .eslintrc.json │ │ ├── index.js │ │ ├── package.json │ │ └── pnpm-lock.yaml ├── convert-images │ ├── README.md │ ├── firebase.json │ └── functions │ │ ├── .eslintrc.json │ │ ├── index.js │ │ ├── package.json │ │ └── pnpm-lock.yaml ├── coupon-on-purchase │ ├── README.md │ ├── firebase.json │ └── functions │ │ ├── .eslintrc.json │ │ ├── index.js │ │ ├── package.json │ │ └── pnpm-lock.yaml ├── delete-old-child-nodes │ ├── README.md │ ├── firebase.json │ └── functions │ │ ├── .eslintrc.json │ │ ├── index.js │ │ ├── package.json │ │ └── pnpm-lock.yaml ├── delete-unused-accounts-cron │ ├── README.md │ ├── firebase.json │ └── functions │ │ ├── .eslintrc.json │ │ ├── index.js │ │ ├── package.json │ │ └── pnpm-lock.yaml ├── developer-motivator │ ├── README.md │ ├── firebase.json │ └── functions │ │ ├── .eslintrc.json │ │ ├── index.js │ │ ├── package.json │ │ └── pnpm-lock.yaml ├── email-confirmation │ ├── README.md │ ├── database.rules.json │ ├── firebase.json │ ├── functions │ │ ├── .eslintrc.json │ │ ├── index.js │ │ ├── package.json │ │ └── pnpm-lock.yaml │ └── public │ │ ├── firebase-logo.png │ │ ├── index.html │ │ ├── main.css │ │ └── main.js ├── exif-images │ ├── README.md │ ├── database.rules.json │ ├── firebase.json │ ├── functions │ │ ├── .eslintrc.json │ │ ├── index.js │ │ ├── package.json │ │ └── pnpm-lock.yaml │ └── public │ │ ├── firebase-logo.png │ │ ├── index.html │ │ ├── main.css │ │ └── main.js ├── fcm-notifications │ ├── README.md │ ├── database.rules.json │ ├── firebase.json │ ├── functions │ │ ├── .eslintrc.json │ │ ├── index.js │ │ ├── package.json │ │ └── pnpm-lock.yaml │ └── public │ │ ├── firebase-logo.png │ │ ├── firebase-messaging-sw.js │ │ ├── index.html │ │ ├── main.css │ │ └── main.js ├── ffmpeg-convert-audio │ ├── README.md │ ├── firebase.json │ └── functions │ │ ├── .eslintrc.json │ │ ├── index.js │ │ ├── package.json │ │ └── pnpm-lock.yaml ├── fulltext-search-firestore │ ├── README.md │ ├── firebase.json │ ├── functions │ │ ├── .eslintrc.json │ │ ├── .gitignore │ │ ├── elastic.js │ │ ├── index.js │ │ ├── package.json │ │ ├── pnpm-lock.yaml │ │ └── typesense.js │ └── public │ │ ├── index.html │ │ └── index.js ├── fulltext-search │ ├── README.md │ ├── firebase.json │ └── functions │ │ ├── .eslintrc.json │ │ ├── index.js │ │ ├── package.json │ │ └── pnpm-lock.yaml ├── github-to-slack │ ├── README.md │ ├── firebase.json │ └── functions │ │ ├── .eslintrc.json │ │ ├── index.js │ │ ├── package.json │ │ └── pnpm-lock.yaml ├── google-sheet-sync │ ├── README.md │ ├── firebase.json │ └── functions │ │ ├── .eslintrc.json │ │ ├── index.js │ │ ├── package.json │ │ └── pnpm-lock.yaml ├── image-maker │ ├── .gitignore │ ├── README.md │ ├── firebase.json │ ├── functions │ │ ├── .eslintrc.json │ │ ├── clock.js │ │ ├── index.js │ │ ├── package.json │ │ ├── pnpm-lock.yaml │ │ ├── ray.js │ │ └── sparkline.js │ └── public │ │ └── index.html ├── instagram-auth │ ├── .gitignore │ ├── README.md │ ├── database.rules.json │ ├── firebase.json │ ├── functions │ │ ├── .eslintrc.json │ │ ├── index.js │ │ ├── package.json │ │ └── pnpm-lock.yaml │ ├── main.css │ └── public │ │ ├── firebase-logo.png │ │ ├── index.html │ │ ├── main.css │ │ ├── main.js │ │ └── popup.html ├── lastmodified-tracking │ ├── README.md │ ├── database.rules.json │ ├── firebase.json │ └── functions │ │ ├── .eslintrc.json │ │ ├── index.js │ │ ├── package.json │ │ └── pnpm-lock.yaml ├── limit-children │ ├── README.md │ ├── firebase.json │ └── functions │ │ ├── .eslintrc.json │ │ ├── index.js │ │ ├── package.json │ │ └── pnpm-lock.yaml ├── linkedin-auth │ ├── .gitignore │ ├── README.md │ ├── database.rules.json │ ├── firebase.json │ ├── functions │ │ ├── .eslintrc.json │ │ ├── index.js │ │ ├── package.json │ │ └── pnpm-lock.yaml │ ├── main.css │ └── public │ │ ├── firebase-logo.png │ │ ├── index.html │ │ ├── linkedIn-button.png │ │ ├── main.css │ │ ├── main.js │ │ └── popup.html ├── message-translation │ ├── README.md │ ├── firebase.json │ └── functions │ │ ├── .eslintrc.json │ │ ├── index.js │ │ ├── package.json │ │ └── pnpm-lock.yaml ├── minimal-webhook │ ├── README.md │ ├── firebase.json │ └── functions │ │ ├── .eslintrc.json │ │ ├── index.js │ │ ├── package.json │ │ └── pnpm-lock.yaml ├── moderate-images │ ├── README.md │ ├── firebase.json │ └── functions │ │ ├── .eslintrc.json │ │ ├── index.js │ │ ├── package.json │ │ └── pnpm-lock.yaml ├── okta-auth │ ├── .gitignore │ ├── README.md │ ├── firebase.json │ ├── functions │ │ ├── .eslintrc.json │ │ ├── index.js │ │ ├── package.json │ │ └── pnpm-lock.yaml │ ├── public │ │ └── index.html │ └── setup.js ├── paypal │ ├── .gitignore │ ├── README.md │ ├── firebase.json │ ├── functions │ │ ├── .eslintrc.json │ │ ├── index.js │ │ ├── package.json │ │ └── pnpm-lock.yaml │ └── public │ │ ├── Demo.gif │ │ ├── cancel.html │ │ ├── error.html │ │ ├── index.html │ │ ├── main.css │ │ └── success.html ├── presence-firestore │ ├── README.md │ ├── firebase.json │ ├── functions │ │ ├── .eslintrc.json │ │ ├── index.js │ │ ├── package.json │ │ └── pnpm-lock.yaml │ └── public │ │ ├── index.html │ │ └── index.js ├── publish-model │ ├── README.md │ ├── firebase.json │ └── functions │ │ ├── .eslintrc.json │ │ ├── index.js │ │ ├── package.json │ │ └── pnpm-lock.yaml ├── quickstarts │ ├── auth-blocking-functions │ │ ├── .gitignore │ │ ├── README.md │ │ ├── firebase.json │ │ └── functions │ │ │ ├── .eslintrc.js │ │ │ ├── .gitignore │ │ │ ├── index.js │ │ │ ├── package.json │ │ │ └── pnpm-lock.yaml │ ├── big-ben │ │ ├── README.md │ │ ├── firebase.json │ │ ├── functions │ │ │ ├── .eslintrc.json │ │ │ ├── index.js │ │ │ ├── package.json │ │ │ └── pnpm-lock.yaml │ │ └── public │ │ │ ├── script.js │ │ │ └── style.css │ ├── email-users │ │ ├── README.md │ │ ├── firebase.json │ │ ├── functions │ │ │ ├── .eslintrc.json │ │ │ ├── index.js │ │ │ ├── package.json │ │ │ └── pnpm-lock.yaml │ │ └── public │ │ │ ├── firebase-logo.png │ │ │ ├── index.html │ │ │ ├── main.css │ │ │ └── main.js │ ├── https-time-server │ │ ├── README.md │ │ ├── firebase.json │ │ └── functions │ │ │ ├── .eslintrc.json │ │ │ ├── index.js │ │ │ ├── package.json │ │ │ └── pnpm-lock.yaml │ ├── multicodebase-hellos │ │ ├── .gitignore │ │ ├── README.md │ │ ├── firebase.json │ │ ├── js │ │ │ ├── .eslintrc.js │ │ │ ├── .gitignore │ │ │ ├── index.js │ │ │ ├── package.json │ │ │ └── pnpm-lock.yaml │ │ └── ts │ │ │ ├── .eslintrc.js │ │ │ ├── .gitignore │ │ │ ├── package.json │ │ │ ├── pnpm-lock.yaml │ │ │ ├── src │ │ │ └── index.ts │ │ │ ├── tsconfig.dev.json │ │ │ └── tsconfig.json │ ├── pubsub-helloworld │ │ ├── README.md │ │ ├── firebase.json │ │ └── functions │ │ │ ├── .eslintrc.json │ │ │ ├── index.js │ │ │ ├── package.json │ │ │ └── pnpm-lock.yaml │ ├── runtime-options │ │ ├── .gitignore │ │ ├── firebase.json │ │ └── functions │ │ │ ├── .eslintrc.js │ │ │ ├── .gitignore │ │ │ ├── index.js │ │ │ ├── package.json │ │ │ └── pnpm-lock.yaml │ ├── taskqueues-backup-images │ │ ├── README.md │ │ ├── firebase.json │ │ └── functions │ │ │ ├── .eslintrc.json │ │ │ ├── index.js │ │ │ ├── package.json │ │ │ └── pnpm-lock.yaml │ ├── testlab-matrix-completed │ │ ├── .gitignore │ │ ├── README.md │ │ ├── firebase.json │ │ └── functions │ │ │ ├── .gitignore │ │ │ ├── index.js │ │ │ ├── package.json │ │ │ └── pnpm-lock.yaml │ ├── thumbnails │ │ ├── README.md │ │ ├── firebase.json │ │ └── functions │ │ │ ├── .eslintrc.json │ │ │ ├── index.js │ │ │ ├── package.json │ │ │ └── pnpm-lock.yaml │ ├── uppercase-firestore │ │ ├── .gitignore │ │ ├── README.md │ │ ├── firebase.json │ │ ├── firestore.indexes.json │ │ ├── firestore.rules │ │ └── functions │ │ │ ├── .eslintrc.json │ │ │ ├── .gitignore │ │ │ ├── index.js │ │ │ ├── package.json │ │ │ └── pnpm-lock.yaml │ └── uppercase-rtdb │ │ ├── README.md │ │ ├── database.rules.json │ │ ├── firebase.json │ │ └── functions │ │ ├── .eslintrc.json │ │ ├── index.js │ │ ├── package.json │ │ ├── pnpm-lock.yaml │ │ └── test │ │ ├── test.offline.js │ │ └── test.online.js ├── remote-config-diff │ ├── README.md │ ├── firebase.json │ └── functions │ │ ├── .eslintrc.json │ │ ├── index.js │ │ ├── package.json │ │ └── pnpm-lock.yaml ├── spotify-auth │ ├── README.md │ ├── database.rules.json │ ├── firebase.json │ ├── functions │ │ ├── .eslintrc.json │ │ ├── index.js │ │ ├── package.json │ │ └── pnpm-lock.yaml │ ├── main.css │ └── public │ │ ├── firebase-logo.png │ │ ├── index.html │ │ ├── main.css │ │ ├── main.js │ │ ├── popup.html │ │ └── spotify-button.png ├── stripe │ ├── README.md │ ├── demo.gif │ ├── firebase.json │ ├── firestore.rules │ ├── functions │ │ ├── .eslintrc.json │ │ ├── index.js │ │ ├── package.json │ │ └── pnpm-lock.yaml │ └── public │ │ ├── index.html │ │ └── javascript │ │ └── app.js ├── survey-app-update │ ├── README.md │ ├── firebase.json │ └── functions │ │ ├── .eslintrc.json │ │ ├── index.js │ │ ├── package.json │ │ └── pnpm-lock.yaml ├── template-handlebars │ ├── README.md │ ├── firebase.json │ ├── functions │ │ ├── .eslintrc.json │ │ ├── firebaseUser.js │ │ ├── index.js │ │ ├── package.json │ │ ├── pnpm-lock.yaml │ │ └── views │ │ │ ├── layouts │ │ │ └── main.handlebars │ │ │ └── user.handlebars │ └── public │ │ ├── firebase-logo.png │ │ └── main.css ├── testlab-to-slack │ ├── .gitignore │ ├── README.md │ ├── firebase.json │ └── functions │ │ ├── .gitignore │ │ ├── index.js │ │ ├── package.json │ │ └── pnpm-lock.yaml ├── text-moderation │ ├── README.md │ ├── firebase.json │ ├── functions │ │ ├── .eslintrc.json │ │ ├── index.js │ │ ├── package.json │ │ └── pnpm-lock.yaml │ ├── public │ │ ├── index.html │ │ ├── main.css │ │ └── main.js │ └── security.rules.json ├── url-shortener │ ├── README.md │ ├── firebase.json │ └── functions │ │ ├── .eslintrc.json │ │ ├── index.js │ │ ├── package.json │ │ └── pnpm-lock.yaml ├── user-data-cleanup │ ├── README.md │ └── doc │ │ ├── auto_rules_extraction.md │ │ └── design.md ├── username-password-auth │ ├── README.md │ ├── database.rules.json │ ├── firebase.json │ ├── functions │ │ ├── .eslintrc.json │ │ ├── index.js │ │ ├── package.json │ │ └── pnpm-lock.yaml │ └── public │ │ ├── firebase-logo.png │ │ ├── index.html │ │ ├── main.css │ │ └── main.js ├── vision-annotate-images │ ├── README.md │ ├── firebase.json │ └── functions │ │ ├── .gitignore │ │ ├── eslint.config.js │ │ ├── package.json │ │ ├── pnpm-lock.yaml │ │ ├── src │ │ └── index.ts │ │ └── tsconfig.json └── youtube │ ├── README.md │ ├── firebase.json │ └── functions │ ├── .eslintrc.json │ ├── index.js │ ├── package.json │ └── pnpm-lock.yaml ├── Node ├── README.md ├── alerts-to-discord │ ├── .gitignore │ ├── README.md │ ├── firebase.json │ └── functions │ │ ├── .eslintrc.js │ │ ├── index.js │ │ ├── package.json │ │ └── pnpm-lock.yaml ├── app-distribution-feedback-to-jira │ ├── .eslintrc │ ├── .gitignore │ ├── README.md │ ├── firebase.json │ └── functions │ │ ├── .eslintrc.cjs │ │ ├── .gitignore │ │ ├── index.js │ │ ├── package.json │ │ └── pnpm-lock.yaml ├── call-vertex-remote-config-server │ ├── README.md │ ├── client │ │ ├── README.md │ │ ├── config.ts │ │ ├── index.html │ │ ├── main.ts │ │ ├── package.json │ │ ├── pnpm-lock.yaml │ │ ├── vite-env.d.ts │ │ └── vite.config.js │ ├── firebase.json │ └── functions │ │ ├── index.js │ │ ├── package.json │ │ └── pnpm-lock.yaml ├── delete-unused-accounts-cron │ ├── README.md │ ├── firebase.json │ └── functions │ │ ├── .eslintrc.js │ │ ├── index.js │ │ ├── package.json │ │ └── pnpm-lock.yaml ├── fcm-notifications │ ├── .gitignore │ ├── README.md │ ├── database.rules.json │ ├── firebase.json │ ├── functions │ │ ├── .eslintrc.cjs │ │ ├── .gitignore │ │ ├── index.js │ │ ├── package.json │ │ └── pnpm-lock.yaml │ └── public │ │ ├── firebase-logo.png │ │ ├── firebase-messaging-sw.js │ │ ├── index.html │ │ ├── main.css │ │ └── main.js ├── instrument-with-opentelemetry │ ├── README.md │ ├── firebase.json │ └── functions │ │ ├── .env │ │ ├── .eslintrc.js │ │ ├── index.js │ │ ├── package.json │ │ ├── pnpm-lock.yaml │ │ ├── timer.js │ │ └── tracing.js ├── pnpm-lock.yaml ├── pnpm-workspace.yaml ├── quickstarts │ ├── auth-blocking-functions │ │ ├── .gitignore │ │ ├── README.md │ │ ├── firebase.json │ │ └── functions │ │ │ ├── .eslintrc.js │ │ │ ├── .gitignore │ │ │ ├── index.js │ │ │ ├── package.json │ │ │ └── pnpm-lock.yaml │ ├── callable-functions-streaming │ │ ├── .gitignore │ │ ├── README.md │ │ ├── firebase.json │ │ ├── functions │ │ │ ├── .eslintrc.js │ │ │ ├── .gitignore │ │ │ ├── index.js │ │ │ ├── package.json │ │ │ └── pnpm-lock.yaml │ │ └── website │ │ │ └── index.html │ ├── callable-functions │ │ ├── .gitignore │ │ ├── README.md │ │ ├── firebase.json │ │ └── functions │ │ │ ├── .eslintrc.js │ │ │ ├── .gitignore │ │ │ ├── index.js │ │ │ ├── package.json │ │ │ ├── pnpm-lock.yaml │ │ │ └── sanitizer.js │ ├── custom-events │ │ ├── README.md │ │ ├── firebase.json │ │ └── functions │ │ │ ├── .eslintrc.js │ │ │ ├── index.js │ │ │ ├── package.json │ │ │ └── pnpm-lock.yaml │ ├── firestore-sync-auth │ │ ├── .gitignore │ │ ├── README.md │ │ ├── firebase.json │ │ ├── firestore.indexes.json │ │ ├── firestore.rules │ │ └── functions │ │ │ ├── .eslintrc.js │ │ │ ├── .gitignore │ │ │ ├── index.js │ │ │ ├── package.json │ │ │ └── pnpm-lock.yaml │ ├── genkit-helloworld │ │ ├── .gitignore │ │ ├── README.md │ │ ├── firebase.json │ │ └── functions │ │ │ ├── .eslintrc.js │ │ │ ├── .gitignore │ │ │ ├── index.js │ │ │ └── package.json │ ├── https-time-server │ │ ├── README.md │ │ ├── firebase.json │ │ └── functions │ │ │ ├── .eslintrc.js │ │ │ ├── index.js │ │ │ ├── package.json │ │ │ └── pnpm-lock.yaml │ ├── monitor-cloud-logging │ │ ├── README.md │ │ ├── firebase.json │ │ └── functions │ │ │ ├── .eslintrc.js │ │ │ ├── index.js │ │ │ ├── package.json │ │ │ └── pnpm-lock.yaml │ ├── pubsub-helloworld │ │ ├── .gitignore │ │ ├── README.md │ │ ├── firebase.json │ │ └── functions │ │ │ ├── .eslintrc.js │ │ │ ├── .gitignore │ │ │ ├── index.js │ │ │ ├── package.json │ │ │ └── pnpm-lock.yaml │ ├── testlab-matrix-completed │ │ ├── README.md │ │ ├── firebase.json │ │ └── functions │ │ │ ├── .eslintrc.js │ │ │ ├── index.js │ │ │ ├── package.json │ │ │ └── pnpm-lock.yaml │ ├── thumbnails │ │ ├── README.md │ │ ├── firebase.json │ │ └── functions │ │ │ ├── .eslintrc.js │ │ │ ├── index.js │ │ │ ├── package.json │ │ │ └── pnpm-lock.yaml │ ├── uppercase-firestore │ │ ├── .gitignore │ │ ├── README.md │ │ ├── firebase.json │ │ ├── firestore.indexes.json │ │ ├── firestore.rules │ │ └── functions │ │ │ ├── .eslintrc.js │ │ │ ├── .gitignore │ │ │ ├── index.js │ │ │ ├── package.json │ │ │ └── pnpm-lock.yaml │ └── uppercase-rtdb │ │ ├── README.md │ │ ├── database.rules.json │ │ ├── firebase.json │ │ └── functions │ │ ├── .eslintrc.js │ │ ├── index.js │ │ ├── package.json │ │ └── pnpm-lock.yaml ├── remote-config-diff │ ├── README.md │ ├── firebase.json │ └── functions │ │ ├── .eslintrc.js │ │ ├── index.js │ │ ├── package.json │ │ └── pnpm-lock.yaml ├── remote-config-server-with-vertex │ ├── README.md │ ├── firebase.json │ └── functions │ │ ├── index.js │ │ ├── package.json │ │ └── pnpm-lock.yaml ├── taskqueues-backup-images │ ├── README.md │ ├── firebase.json │ └── functions │ │ ├── .eslintrc.js │ │ ├── index.js │ │ ├── package.json │ │ └── pnpm-lock.yaml ├── test-functions-jest-ts │ ├── .gitignore │ ├── README.md │ ├── firebase.json │ └── functions │ │ ├── .eslintrc.js │ │ ├── .gitignore │ │ ├── jest.config.js │ │ ├── package.json │ │ ├── pnpm-lock.yaml │ │ ├── src │ │ ├── __test__ │ │ │ └── index.test.ts │ │ └── index.ts │ │ ├── tsconfig.dev.json │ │ └── tsconfig.json ├── test-functions-jest │ ├── .gitignore │ ├── README.md │ ├── firebase.json │ └── functions │ │ ├── .eslintrc.js │ │ ├── .gitignore │ │ ├── index.js │ │ ├── index.test.js │ │ ├── package.json │ │ └── pnpm-lock.yaml ├── test-functions-mocha │ ├── .gitignore │ ├── README.md │ ├── firebase.json │ └── functions │ │ ├── .eslintrc.js │ │ ├── .gitignore │ │ ├── index.js │ │ ├── index.test.js │ │ ├── package.json │ │ └── pnpm-lock.yaml └── testlab-to-slack │ ├── README.md │ ├── firebase.json │ └── functions │ ├── .eslintrc.js │ ├── index.js │ ├── package.json │ └── pnpm-lock.yaml ├── Python ├── .gitignore ├── README.md ├── alerts-to-discord │ ├── README.md │ ├── firebase.json │ └── functions │ │ ├── main.py │ │ └── requirements.txt ├── delete-unused-accounts-cron │ ├── README.md │ ├── firebase.json │ └── functions │ │ ├── main.py │ │ └── requirements.txt ├── fcm-notifications │ ├── .gitignore │ ├── README.md │ ├── database.rules.json │ ├── firebase.json │ ├── functions │ │ ├── .gitignore │ │ ├── main.py │ │ └── requirements.txt │ └── public │ │ ├── firebase-logo.png │ │ ├── firebase-messaging-sw.js │ │ ├── index.html │ │ ├── main.css │ │ └── main.js ├── http-flask │ ├── README.md │ ├── firebase.json │ └── functions │ │ ├── main.py │ │ └── requirements.txt ├── post-signup-event │ ├── README.md │ ├── firebase.json │ └── functions │ │ ├── main.py │ │ └── requirements.txt ├── pyfmt.py ├── pyproject.toml ├── quickstarts │ ├── auth-blocking-functions │ │ ├── README.md │ │ ├── firebase.json │ │ └── functions │ │ │ ├── main.py │ │ │ └── requirements.txt │ ├── callable-functions │ │ ├── README.md │ │ ├── firebase.json │ │ └── functions │ │ │ ├── main.py │ │ │ └── requirements.txt │ ├── custom-events │ │ ├── README.md │ │ ├── firebase.json │ │ └── functions │ │ │ ├── main.py │ │ │ └── requirements.txt │ ├── firestore-sync-auth │ │ ├── README.md │ │ ├── firebase.json │ │ └── functions │ │ │ ├── main.py │ │ │ └── requirements.txt │ ├── https-time-server │ │ ├── README.md │ │ ├── firebase.json │ │ └── functions │ │ │ ├── main.py │ │ │ └── requirements.txt │ ├── monitor-cloud-logging │ │ ├── firebase.json │ │ └── functions │ │ │ ├── main.py │ │ │ └── requirements.txt │ ├── pubsub-helloworld │ │ ├── README.md │ │ ├── firebase.json │ │ └── functions │ │ │ ├── main.py │ │ │ └── requirements.txt │ ├── uppercase-firestore │ │ ├── README.md │ │ ├── firebase.json │ │ └── functions │ │ │ ├── main.py │ │ │ └── requirements.txt │ └── uppercase-rtdb │ │ ├── README.md │ │ ├── firebase.json │ │ └── functions │ │ ├── main.py │ │ └── requirements.txt ├── remote-config-diff │ ├── README.md │ ├── firebase.json │ └── functions │ │ ├── main.py │ │ └── requirements.txt ├── requirements.txt ├── taskqueues-backup-images │ ├── README.md │ ├── firebase.json │ └── functions │ │ ├── main.py │ │ └── requirements.txt ├── testlab-to-slack │ ├── README.md │ ├── firebase.json │ └── functions │ │ ├── main.py │ │ └── requirements.txt └── thumbnails │ ├── README.md │ ├── firebase.json │ └── functions │ ├── main.py │ └── requirements.txt ├── README.md ├── community.md ├── package-lock.json ├── package.json ├── pnpm-lock.yaml └── tsconfig.template.json /.github/ISSUE_TEMPLATE/bug_report.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Bug report 3 | about: Report an issue with a specific sample 4 | title: '[BUG] in sample: ' 5 | labels: 'type: bug' 6 | assignees: '' 7 | --- 8 | 9 | ### Which sample has a bug? 10 | 11 | **Sample name or URL where you found the bug** 12 | 13 | ### How to reproduce the issue 14 | 15 | **Failing Function code used (if you modified the sample)** 16 | 17 | **Steps to set up and reproduce** 18 | 19 | 20 | 21 | ### Debug output 22 | 23 | 24 | 25 | **Errors in the 26 | [console logs](https://console.firebase.google.com/project/_/functions/logs?search=&severity=DEBUG)** 27 | 28 | **Screenshots** 29 | 30 | ### Expected behavior 31 | 32 | 33 | 34 | ### Actual behavior 35 | 36 | 37 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/docs.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Documentation issue 3 | about: Are a sample's docs incorrect or unclear? 4 | title: '[DOCS] for sample: ' 5 | labels: '' 6 | assignees: '' 7 | --- 8 | 9 | 10 | 11 | ### Which sample? 12 | 13 | **Sample name or URL** **Link to closest heading** 14 | 15 | ### What is the issue with this sample's docs? 16 | 17 | 18 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .idea 2 | **/node_modules/* 3 | **/.firebase 4 | **/.firebaserc 5 | **/.runtimeconfig.json 6 | */npm-debug.log 7 | lerna-debug.log 8 | *~ 9 | service-account-credentials.json 10 | **/package-lock.json 11 | # keep the root package-lock so that tools are consistent 12 | !/package-lock.json 13 | **/ui-debug.log 14 | **/database-debug.log 15 | **/firebase-debug.log 16 | **/pubsub-debug.log 17 | **/tsconfig-compile.json 18 | yarn.lock 19 | **/.DS_Store 20 | -------------------------------------------------------------------------------- /.opensource/project.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Cloud Functions Samples", 3 | "type": "sample", 4 | "platforms": [ 5 | "Admin", 6 | "Node" 7 | ], 8 | "content": "README.md", 9 | "pages": { 10 | "quickstarts/big-ben/README.md": "Quickstart: HTTP Trigger + Hosting", 11 | "quickstarts/email-users/README.md": "Quickstart: Auth Trigger", 12 | "quickstarts/pubsub-helloworld/README.md": "Quickstart: PubSub Trigger", 13 | "quickstarts/thumbnails/README.md": "Quickstart: Cloud Storage Trigger", 14 | "quickstarts/time-server/README.md": "Quickstart: HTTP Trigger", 15 | "quickstarts/uppercase/README.md": "Quickstart: RTDB Trigger", 16 | "quickstarts/uppercase-firestore/README.md": "Quickstart: Firestore Trigger" 17 | }, 18 | "related": [ 19 | "firebase/firebase-functions" 20 | ] 21 | } 22 | -------------------------------------------------------------------------------- /Node-1st-gen/README.md: -------------------------------------------------------------------------------- 1 | # Node.js (1st gen) samples 2 | 3 | This folder contains examples for 1st gen functions. Note that 2nd gen functions are available and the recommended platform for Cloud Functions for Firebase. 4 | 5 | See a description of all samples in this folder in the [root README](../README.md). -------------------------------------------------------------------------------- /Node-1st-gen/assistant-say-number/action.json: -------------------------------------------------------------------------------- 1 | { 2 | "versionLabel": "1.0.0", 3 | "agentInfo": { 4 | "languageCode": "en-US", 5 | "projectId": "", 6 | "voiceName": "male_1" 7 | }, 8 | "actions": [ 9 | { 10 | "initialTrigger": { 11 | "intent": "assistant.intent.action.MAIN" 12 | }, 13 | "httpExecution": { 14 | "url": "https://us-central1-.cloudfunctions.net/sayNumber" 15 | } 16 | } 17 | ] 18 | } 19 | -------------------------------------------------------------------------------- /Node-1st-gen/assistant-say-number/firebase.json: -------------------------------------------------------------------------------- 1 | { 2 | "functions": { 3 | "codebase": "assistant-say-number" 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /Node-1st-gen/assistant-say-number/functions/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "assistant-say-numer-functions", 3 | "description": "Firebase Functions", 4 | "dependencies": { 5 | "actions-on-google": "^2.14.0", 6 | "firebase-admin": "^13.0.2", 7 | "firebase-functions": "^6.3.0" 8 | }, 9 | "devDependencies": { 10 | "eslint": "^8.57.1", 11 | "eslint-plugin-promise": "^7.2.1" 12 | }, 13 | "scripts": { 14 | "lint": "./node_modules/.bin/eslint --max-warnings=0 .", 15 | "serve": "firebase emulators:start --only functions", 16 | "shell": "firebase functions:shell", 17 | "start": "npm run shell", 18 | "deploy": "firebase deploy --only functions", 19 | "logs": "firebase functions:log", 20 | "compile": "cp ../../../tsconfig.template.json ./tsconfig-compile.json && tsc --project tsconfig-compile.json" 21 | }, 22 | "engines": { 23 | "node": "20" 24 | }, 25 | "private": true 26 | } 27 | -------------------------------------------------------------------------------- /Node-1st-gen/authenticated-json-api/database.rules.json: -------------------------------------------------------------------------------- 1 | { 2 | "rules": { 3 | "users": { 4 | "$uid": { 5 | ".read": "auth.uid === $uid", 6 | ".write": "auth.uid === $uid", 7 | "messages": { 8 | ".indexOn": ["category"] 9 | } 10 | } 11 | } 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /Node-1st-gen/authenticated-json-api/firebase.json: -------------------------------------------------------------------------------- 1 | { 2 | "functions": { 3 | "codebase": "authenticated-json-api" 4 | }, 5 | "hosting": { 6 | "public": "public", 7 | "rewrites": [ 8 | { "source": "/api/**", "function": "api" } 9 | ] 10 | }, 11 | "database": { 12 | "rules": "database.rules.json" 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /Node-1st-gen/authenticated-json-api/functions/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "authenticated-json-api-functions", 3 | "description": "Cloud Functions for Firebase", 4 | "dependencies": { 5 | "@google-cloud/language": "^3.8.0", 6 | "express": "^4.18.2", 7 | "firebase-admin": "^13.0.2", 8 | "firebase-functions": "^6.3.0" 9 | }, 10 | "devDependencies": { 11 | "eslint": "^8.57.1", 12 | "eslint-plugin-promise": "^7.2.1" 13 | }, 14 | "scripts": { 15 | "lint": "./node_modules/.bin/eslint --max-warnings=0 .", 16 | "serve": "firebase emulators:start --only functions", 17 | "shell": "firebase functions:shell", 18 | "start": "npm run shell", 19 | "deploy": "firebase deploy --only functions", 20 | "logs": "firebase functions:log", 21 | "compile": "cp ../../../tsconfig.template.json ./tsconfig-compile.json && tsc --project tsconfig-compile.json" 22 | }, 23 | "engines": { 24 | "node": "20" 25 | }, 26 | "private": true 27 | } -------------------------------------------------------------------------------- /Node-1st-gen/authorized-https-endpoint/firebase.json: -------------------------------------------------------------------------------- 1 | { 2 | "functions": { 3 | "codebase": "authorized-https-endpoint" 4 | }, 5 | "hosting": { 6 | "public": "public", 7 | "rewrites": [ 8 | { 9 | "source":"**", 10 | "function":"app" 11 | } 12 | ] 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /Node-1st-gen/authorized-https-endpoint/functions/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "authorized-https-endpoint-functions", 3 | "description": "restrict HTTPS functions to Firebase users", 4 | "dependencies": { 5 | "cookie-parser": "^1.4.6", 6 | "cors": "^2.8.5", 7 | "express": "^4.18.2", 8 | "firebase-admin": "^13.0.2", 9 | "firebase-functions": "^6.3.0" 10 | }, 11 | "devDependencies": { 12 | "eslint": "^8.57.1", 13 | "eslint-plugin-promise": "^7.2.1" 14 | }, 15 | "scripts": { 16 | "lint": "./node_modules/.bin/eslint --max-warnings=0 .", 17 | "serve": "firebase emulators:start --only functions", 18 | "shell": "firebase functions:shell", 19 | "start": "npm run shell", 20 | "deploy": "firebase deploy --only functions", 21 | "logs": "firebase functions:log", 22 | "compile": "cp ../../../tsconfig.template.json ./tsconfig-compile.json && tsc --project tsconfig-compile.json" 23 | }, 24 | "engines": { 25 | "node": "20" 26 | }, 27 | "private": true 28 | } -------------------------------------------------------------------------------- /Node-1st-gen/authorized-https-endpoint/public/firebase-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/firebase/functions-samples/c4fde45b65fab584715e786ce3264a6932d996ec/Node-1st-gen/authorized-https-endpoint/public/firebase-logo.png -------------------------------------------------------------------------------- /Node-1st-gen/bigquery-import/README.md: -------------------------------------------------------------------------------- 1 | # Import Data to Big Query 2 | 3 | This template shows how to copy data from the Realtime Database (such as logs being written there) to Google Cloud's BigQuery. 4 | 5 | ## Function Code 6 | 7 | See file [functions/index.js](functions/index.js) for the code. 8 | 9 | The dependencies are listed in [functions/package.json](functions/package.json). 10 | 11 | ## Sample Database Structure 12 | 13 | As an example we'll be using a simple logs database structure: 14 | 15 | ``` 16 | /functions-project-12345 17 | /logs 18 | /key-123456 19 | text: "User signed in." 20 | /key-123457 21 | text: "Error: Could not connect to Database" 22 | ``` 23 | 24 | ## Setting up the sample 25 | 26 | Set the `bigquery.datasetName` and `bigquery.tableName` Google Cloud environment variables to match the Dataset name and the Table name where you want the logs written to. For this use: 27 | 28 | ```bash 29 | firebase functions:config:set bigquery.datasetName="bar" bigquery.tableName="baz" 30 | ``` 31 | -------------------------------------------------------------------------------- /Node-1st-gen/bigquery-import/firebase.json: -------------------------------------------------------------------------------- 1 | { 2 | "functions": { 3 | "codebase": "bigquery-import" 4 | } 5 | } -------------------------------------------------------------------------------- /Node-1st-gen/bigquery-import/functions/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "bigquery-import-functions", 3 | "description": "Import data to BigQuery Firebase Functions sample", 4 | "dependencies": { 5 | "@google-cloud/bigquery": "^4.7.0", 6 | "eslint-plugin-promise": "^7.2.1", 7 | "firebase-admin": "^13.0.2", 8 | "firebase-functions": "^6.3.0" 9 | }, 10 | "devDependencies": { 11 | "eslint": "^8.57.1" 12 | }, 13 | "scripts": { 14 | "lint": "./node_modules/.bin/eslint --max-warnings=0 .", 15 | "serve": "firebase emulators:start --only functions", 16 | "shell": "firebase functions:shell", 17 | "start": "npm run shell", 18 | "deploy": "firebase deploy --only functions", 19 | "logs": "firebase functions:log", 20 | "compile": "cp ../../../tsconfig.template.json ./tsconfig-compile.json && tsc --project tsconfig-compile.json" 21 | }, 22 | "engines": { 23 | "node": "20" 24 | }, 25 | "private": true 26 | } 27 | -------------------------------------------------------------------------------- /Node-1st-gen/child-count/firebase.json: -------------------------------------------------------------------------------- 1 | { 2 | "functions": { 3 | "codebase": "child-count" 4 | } 5 | } -------------------------------------------------------------------------------- /Node-1st-gen/child-count/functions/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "child-count-functions", 3 | "description": "Count Child nodes Firebase Functions sample", 4 | "dependencies": { 5 | "eslint-plugin-promise": "^7.2.1", 6 | "firebase-admin": "^13.0.2", 7 | "firebase-functions": "^6.3.0" 8 | }, 9 | "devDependencies": { 10 | "eslint": "^8.57.1" 11 | }, 12 | "scripts": { 13 | "lint": "./node_modules/.bin/eslint --max-warnings=0 .", 14 | "serve": "firebase emulators:start --only functions", 15 | "shell": "firebase functions:shell", 16 | "start": "npm run shell", 17 | "deploy": "firebase deploy --only functions", 18 | "logs": "firebase functions:log", 19 | "compile": "cp ../../../tsconfig.template.json ./tsconfig-compile.json && tsc --project tsconfig-compile.json" 20 | }, 21 | "engines": { 22 | "node": "20" 23 | }, 24 | "private": true 25 | } 26 | -------------------------------------------------------------------------------- /Node-1st-gen/convert-images/firebase.json: -------------------------------------------------------------------------------- 1 | { 2 | "functions": { 3 | "codebase": "convert-images" 4 | } 5 | } -------------------------------------------------------------------------------- /Node-1st-gen/convert-images/functions/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "convert-images-functions", 3 | "description": "Convert images to JPEG Firebase Functions sample", 4 | "dependencies": { 5 | "child-process-promise": "^2.2.1", 6 | "eslint-plugin-promise": "^7.2.1", 7 | "firebase-admin": "^13.0.2", 8 | "firebase-functions": "^6.3.0", 9 | "mkdirp": "^1.0.4" 10 | }, 11 | "devDependencies": { 12 | "eslint": "^8.57.1" 13 | }, 14 | "scripts": { 15 | "lint": "./node_modules/.bin/eslint --max-warnings=0 .", 16 | "serve": "firebase emulators:start --only functions", 17 | "shell": "firebase functions:shell", 18 | "start": "npm run shell", 19 | "deploy": "firebase deploy --only functions", 20 | "logs": "firebase functions:log", 21 | "compile": "cp ../../../tsconfig.template.json ./tsconfig-compile.json && tsc --project tsconfig-compile.json" 22 | }, 23 | "engines": { 24 | "node": "20" 25 | }, 26 | "private": true 27 | } 28 | -------------------------------------------------------------------------------- /Node-1st-gen/coupon-on-purchase/firebase.json: -------------------------------------------------------------------------------- 1 | { 2 | "functions": { 3 | "codebase": "coupon-on-purchase" 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /Node-1st-gen/coupon-on-purchase/functions/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "coupon-on-crash-functions", 3 | "description": "Send a coupon via FCM to your users who have experienced a crash.", 4 | "dependencies": { 5 | "eslint-plugin-promise": "^7.2.1", 6 | "firebase-admin": "^13.0.2", 7 | "firebase-functions": "^6.3.0" 8 | }, 9 | "devDependencies": { 10 | "eslint": "^8.57.1" 11 | }, 12 | "scripts": { 13 | "lint": "./node_modules/.bin/eslint --max-warnings=0 .", 14 | "serve": "firebase emulators:start --only functions", 15 | "shell": "firebase functions:shell", 16 | "start": "npm run shell", 17 | "deploy": "firebase deploy --only functions", 18 | "logs": "firebase functions:log", 19 | "compile": "cp ../../../tsconfig.template.json ./tsconfig-compile.json && tsc --project tsconfig-compile.json" 20 | }, 21 | "engines": { 22 | "node": "20" 23 | }, 24 | "private": true 25 | } 26 | -------------------------------------------------------------------------------- /Node-1st-gen/delete-old-child-nodes/firebase.json: -------------------------------------------------------------------------------- 1 | { 2 | "functions": { 3 | "codebase": "delete-old-child-nodes" 4 | } 5 | } -------------------------------------------------------------------------------- /Node-1st-gen/delete-old-child-nodes/functions/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "delete-old-child-nodes", 3 | "description": "Delete nodes of a Realtime Database collection that are older than a given threshold.", 4 | "dependencies": { 5 | "eslint": "8", 6 | "eslint-plugin-promise": "^7.2.1", 7 | "firebase-admin": "^13.0.2", 8 | "firebase-functions": "^6.3.0" 9 | }, 10 | "engines": { 11 | "node": "20" 12 | }, 13 | "scripts": { 14 | "compile": "cp ../../../tsconfig.template.json ./tsconfig-compile.json && tsc --project tsconfig-compile.json" 15 | }, 16 | "private": true 17 | } 18 | -------------------------------------------------------------------------------- /Node-1st-gen/delete-unused-accounts-cron/firebase.json: -------------------------------------------------------------------------------- 1 | { 2 | "functions": { 3 | "codebase": "delete-unused-accounts" 4 | } 5 | } -------------------------------------------------------------------------------- /Node-1st-gen/delete-unused-accounts-cron/functions/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "delete-unused-accounts-cron-functions", 3 | "description": "Periodically delete unused Firebase accounts", 4 | "dependencies": { 5 | "es6-promise-pool": "^2.5.0", 6 | "eslint-plugin-promise": "^7.2.1", 7 | "firebase-admin": "^13.0.2", 8 | "firebase-functions": "^6.3.0" 9 | }, 10 | "devDependencies": { 11 | "eslint": "^8.57.1" 12 | }, 13 | "scripts": { 14 | "lint": "./node_modules/.bin/eslint --max-warnings=0 .", 15 | "serve": "firebase emulators:start --only functions", 16 | "shell": "firebase functions:shell", 17 | "start": "npm run shell", 18 | "deploy": "firebase deploy --only functions", 19 | "logs": "firebase functions:log", 20 | "compile": "cp ../../../tsconfig.template.json ./tsconfig-compile.json && tsc --project tsconfig-compile.json" 21 | }, 22 | "engines": { 23 | "node": "20" 24 | }, 25 | "private": true 26 | } 27 | -------------------------------------------------------------------------------- /Node-1st-gen/developer-motivator/firebase.json: -------------------------------------------------------------------------------- 1 | { 2 | "functions": { 3 | "codebase": "developer-motivator" 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /Node-1st-gen/developer-motivator/functions/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "developer-motivator-functions", 3 | "description": "A simple developer motivator using Cloud Function and firebase analytics", 4 | "dependencies": { 5 | "eslint-plugin-promise": "^7.2.1", 6 | "firebase-admin": "^13.0.2", 7 | "firebase-functions": "^6.3.0" 8 | }, 9 | "devDependencies": { 10 | "eslint": "^8.57.1" 11 | }, 12 | "scripts": { 13 | "lint": "./node_modules/.bin/eslint --max-warnings=0 .", 14 | "serve": "firebase emulators:start --only functions", 15 | "shell": "firebase functions:shell", 16 | "start": "npm run shell", 17 | "deploy": "firebase deploy --only functions", 18 | "logs": "firebase functions:log", 19 | "compile": "cp ../../../tsconfig.template.json ./tsconfig-compile.json && tsc --project tsconfig-compile.json" 20 | }, 21 | "engines": { 22 | "node": "20" 23 | }, 24 | "private": true 25 | } 26 | -------------------------------------------------------------------------------- /Node-1st-gen/email-confirmation/database.rules.json: -------------------------------------------------------------------------------- 1 | { 2 | "rules": { 3 | "users": { 4 | "$uid": { 5 | ".read": "auth.uid === $uid", 6 | ".write": "auth.uid === $uid" 7 | } 8 | } 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /Node-1st-gen/email-confirmation/firebase.json: -------------------------------------------------------------------------------- 1 | { 2 | "functions": { 3 | "codebase": "email-confirmation" 4 | }, 5 | "database": { 6 | "rules": "database.rules.json" 7 | }, 8 | "hosting": { 9 | "public": "public" 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /Node-1st-gen/email-confirmation/functions/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "email-confirmation-functions", 3 | "description": "Send Email confirmation upon sign up to a Mailing list Firebase Functions sample", 4 | "dependencies": { 5 | "eslint-plugin-promise": "^7.2.1", 6 | "firebase-admin": "^13.0.2", 7 | "firebase-functions": "^6.3.0", 8 | "nodemailer": "^6.8.0" 9 | }, 10 | "devDependencies": { 11 | "eslint": "^8.57.1" 12 | }, 13 | "scripts": { 14 | "lint": "./node_modules/.bin/eslint --max-warnings=0 .", 15 | "serve": "firebase emulators:start --only functions", 16 | "shell": "firebase functions:shell", 17 | "start": "npm run shell", 18 | "deploy": "firebase deploy --only functions", 19 | "logs": "firebase functions:log", 20 | "compile": "cp ../../../tsconfig.template.json ./tsconfig-compile.json && tsc --project tsconfig-compile.json" 21 | }, 22 | "engines": { 23 | "node": "20" 24 | }, 25 | "private": true 26 | } 27 | -------------------------------------------------------------------------------- /Node-1st-gen/email-confirmation/public/firebase-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/firebase/functions-samples/c4fde45b65fab584715e786ce3264a6932d996ec/Node-1st-gen/email-confirmation/public/firebase-logo.png -------------------------------------------------------------------------------- /Node-1st-gen/exif-images/database.rules.json: -------------------------------------------------------------------------------- 1 | { 2 | "rules": { 3 | ".read": true, 4 | ".write": false 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /Node-1st-gen/exif-images/firebase.json: -------------------------------------------------------------------------------- 1 | { 2 | "functions": { 3 | "codebase": "exif-images" 4 | }, 5 | "database": { 6 | "rules": "database.rules.json" 7 | }, 8 | "hosting": { 9 | "public": "public" 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /Node-1st-gen/exif-images/functions/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "exif-images-functions", 3 | "description": "Extract EXIF metadata from images Firebase Functions sample", 4 | "dependencies": { 5 | "@google-cloud/storage": "^4.7.2", 6 | "child-process-promise": "^2.2.1", 7 | "eslint-plugin-promise": "^7.2.1", 8 | "firebase-admin": "^13.0.2", 9 | "firebase-functions": "^6.3.0" 10 | }, 11 | "devDependencies": { 12 | "eslint": "^8.57.1" 13 | }, 14 | "scripts": { 15 | "lint": "./node_modules/.bin/eslint --max-warnings=0 .", 16 | "serve": "firebase emulators:start --only functions", 17 | "shell": "firebase functions:shell", 18 | "start": "npm run shell", 19 | "deploy": "firebase deploy --only functions", 20 | "logs": "firebase functions:log", 21 | "compile": "cp ../../../tsconfig.template.json ./tsconfig-compile.json && tsc --project tsconfig-compile.json" 22 | }, 23 | "engines": { 24 | "node": "20" 25 | }, 26 | "private": true 27 | } 28 | -------------------------------------------------------------------------------- /Node-1st-gen/exif-images/public/firebase-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/firebase/functions-samples/c4fde45b65fab584715e786ce3264a6932d996ec/Node-1st-gen/exif-images/public/firebase-logo.png -------------------------------------------------------------------------------- /Node-1st-gen/exif-images/public/main.css: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2015 Google Inc. All Rights Reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | html, body { 18 | font-family: 'Roboto', 'Helvetica', sans-serif; 19 | } 20 | .mdl-grid { 21 | max-width: 1024px; 22 | margin: auto; 23 | } 24 | .mdl-layout__header-row { 25 | padding: 0; 26 | } 27 | h3 { 28 | background: url('firebase-logo.png') no-repeat; 29 | background-size: 40px; 30 | padding-left: 50px; 31 | } 32 | pre { 33 | overflow-x: scroll; 34 | line-height: 18px; 35 | } 36 | code { 37 | white-space: pre-wrap; 38 | word-break: break-all; 39 | } 40 | -------------------------------------------------------------------------------- /Node-1st-gen/fcm-notifications/database.rules.json: -------------------------------------------------------------------------------- 1 | { 2 | "rules": { 3 | "users": { 4 | ".read": true, 5 | "$uid": { 6 | ".write": "auth.uid === $uid" 7 | } 8 | }, 9 | "followers": { 10 | "$followedUid": { 11 | "$followerUid": { 12 | ".read": "auth.uid === $followerUid", 13 | ".write": "auth.uid === $followerUid" 14 | } 15 | } 16 | } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /Node-1st-gen/fcm-notifications/firebase.json: -------------------------------------------------------------------------------- 1 | { 2 | "functions": { 3 | "codebase": "fcm-notifications" 4 | }, 5 | "database": { 6 | "rules": "database.rules.json" 7 | }, 8 | "hosting": { 9 | "public": "public" 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /Node-1st-gen/fcm-notifications/functions/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "fcm-notifications-functions", 3 | "description": "Send FCM notifications Firebase Functions sample", 4 | "dependencies": { 5 | "eslint-plugin-promise": "^7.2.1", 6 | "firebase-admin": "^13.0.2", 7 | "firebase-functions": "^6.3.0" 8 | }, 9 | "devDependencies": { 10 | "eslint": "^8.57.1" 11 | }, 12 | "scripts": { 13 | "lint": "./node_modules/.bin/eslint --max-warnings=0 .", 14 | "serve": "firebase emulators:start --only functions", 15 | "shell": "firebase functions:shell", 16 | "start": "npm run shell", 17 | "deploy": "firebase deploy --only functions", 18 | "logs": "firebase functions:log", 19 | "compile": "cp ../../../tsconfig.template.json ./tsconfig-compile.json && tsc --project tsconfig-compile.json" 20 | }, 21 | "engines": { 22 | "node": "20" 23 | }, 24 | "private": true 25 | } 26 | -------------------------------------------------------------------------------- /Node-1st-gen/fcm-notifications/public/firebase-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/firebase/functions-samples/c4fde45b65fab584715e786ce3264a6932d996ec/Node-1st-gen/fcm-notifications/public/firebase-logo.png -------------------------------------------------------------------------------- /Node-1st-gen/fcm-notifications/public/firebase-messaging-sw.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2023 Google LLC 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | // Import and configure the Firebase SDK 18 | // These scripts are made available when the app is served or deployed on Firebase Hosting 19 | // If you do not serve/host your project using Firebase Hosting see https://firebase.google.com/docs/web/setup 20 | importScripts('/__/firebase/9.2.0/firebase-app-compat.js'); 21 | importScripts('/__/firebase/9.2.0/firebase-messaging-compat.js'); 22 | importScripts('/__/firebase/init.js'); 23 | 24 | firebase.messaging(); 25 | -------------------------------------------------------------------------------- /Node-1st-gen/ffmpeg-convert-audio/firebase.json: -------------------------------------------------------------------------------- 1 | { 2 | "functions": { 3 | "codebase": "ffmpeg-convert-audio" 4 | } 5 | } -------------------------------------------------------------------------------- /Node-1st-gen/ffmpeg-convert-audio/functions/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "ffmpeg-convert-audio", 3 | "description": "FFMPEG Convert Audio Firebase Functions sample", 4 | "dependencies": { 5 | "@google-cloud/storage": "^4.7.2", 6 | "eslint-plugin-promise": "^7.2.1", 7 | "ffmpeg-static": "^4.4.1", 8 | "firebase-admin": "^13.0.2", 9 | "firebase-functions": "^6.3.0", 10 | "fluent-ffmpeg": "^2.1.2" 11 | }, 12 | "devDependencies": { 13 | "eslint": "^8.57.1" 14 | }, 15 | "scripts": { 16 | "lint": "./node_modules/.bin/eslint --max-warnings=0 .", 17 | "serve": "firebase emulators:start --only functions", 18 | "shell": "firebase functions:shell", 19 | "start": "npm run shell", 20 | "deploy": "firebase deploy --only functions", 21 | "logs": "firebase functions:log", 22 | "compile": "cp ../../../tsconfig.template.json ./tsconfig-compile.json && tsc --project tsconfig-compile.json" 23 | }, 24 | "engines": { 25 | "node": "20" 26 | }, 27 | "private": true 28 | } 29 | -------------------------------------------------------------------------------- /Node-1st-gen/fulltext-search-firestore/README.md: -------------------------------------------------------------------------------- 1 | # Full Text search 2 | 3 | This template shows how to enable full text search on Firestore documents by using one of the followning hosted search services: 4 | 5 | * [Algolia](https://algolia.com) 6 | * [Elastic](https://elastic.co) 7 | * [Typesense](https://typesense.org) 8 | 9 | ## Functions Code 10 | 11 | See file [functions/index.js](functions/index.js) for the code. 12 | 13 | The dependencies are listed in [functions/package.json](functions/package.json). 14 | 15 | ## Sample Firestore Structure 16 | 17 | As an example we'll be using a secure note structure: 18 | 19 | ``` 20 | /notes 21 | /note-123456 22 | text: "This is my first note...", 23 | owner: "FIREBASE_USER_ID" 24 | /note-123457 25 | text: "This is my second note entry...", 26 | owner: "FIREBASE_USER_ID" 27 | tags: ["some_category"] 28 | ``` 29 | 30 | Whenever a new note is created or modified a Function sends the content to be indexed. 31 | 32 | ## Setting up the sample 33 | 34 | For setup and overview, please see the [Full Text Search Solution](https://firebase.google.com/docs/firestore/solutions/search) in the 35 | Firestore documentation. 36 | -------------------------------------------------------------------------------- /Node-1st-gen/fulltext-search-firestore/firebase.json: -------------------------------------------------------------------------------- 1 | { 2 | "functions": { 3 | "codebase": "fulltext-search-firestore" 4 | }, 5 | "hosting": { 6 | "public": "public" 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /Node-1st-gen/fulltext-search-firestore/functions/.gitignore: -------------------------------------------------------------------------------- 1 | test.js 2 | -------------------------------------------------------------------------------- /Node-1st-gen/fulltext-search-firestore/functions/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "full-text-search", 3 | "description": "Full text search for Firestore", 4 | "dependencies": { 5 | "@babel/runtime": "^7.20.1", 6 | "@elastic/elasticsearch": "^7.17.0", 7 | "algoliasearch": "^4.14.2", 8 | "cors": "^2.8.5", 9 | "eslint-plugin-promise": "^7.2.1", 10 | "express": "^4.18.2", 11 | "firebase-admin": "^13.0.2", 12 | "firebase-functions": "^6.3.0", 13 | "typesense": "^0.13.0" 14 | }, 15 | "devDependencies": { 16 | "eslint": "^8.57.1" 17 | }, 18 | "scripts": { 19 | "lint": "./node_modules/.bin/eslint --max-warnings=0 .", 20 | "serve": "firebase emulators:start --only functions", 21 | "shell": "firebase functions:shell", 22 | "start": "npm run shell", 23 | "deploy": "firebase deploy --only functions", 24 | "logs": "firebase functions:log", 25 | "compile": "cp ../../../tsconfig.template.json ./tsconfig-compile.json && tsc --project tsconfig-compile.json" 26 | }, 27 | "engines": { 28 | "node": "20" 29 | }, 30 | "private": true 31 | } 32 | -------------------------------------------------------------------------------- /Node-1st-gen/fulltext-search/firebase.json: -------------------------------------------------------------------------------- 1 | { 2 | "functions": { 3 | "codebase": "fulltext-search" 4 | } 5 | } -------------------------------------------------------------------------------- /Node-1st-gen/fulltext-search/functions/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "fulltext-search-functions", 3 | "description": "Full Text Search with Algolia Firebase Functions sample", 4 | "dependencies": { 5 | "algoliasearch": "^4.14.2", 6 | "eslint-plugin-promise": "^7.2.1", 7 | "firebase-admin": "^13.0.2", 8 | "firebase-functions": "^6.3.0" 9 | }, 10 | "devDependencies": { 11 | "eslint": "^8.57.1" 12 | }, 13 | "scripts": { 14 | "lint": "./node_modules/.bin/eslint --max-warnings=0 .", 15 | "serve": "firebase emulators:start --only functions", 16 | "shell": "firebase functions:shell", 17 | "start": "npm run shell", 18 | "deploy": "firebase deploy --only functions", 19 | "logs": "firebase functions:log", 20 | "compile": "cp ../../../tsconfig.template.json ./tsconfig-compile.json && tsc --project tsconfig-compile.json" 21 | }, 22 | "engines": { 23 | "node": "20" 24 | }, 25 | "private": true 26 | } 27 | -------------------------------------------------------------------------------- /Node-1st-gen/github-to-slack/firebase.json: -------------------------------------------------------------------------------- 1 | { 2 | "functions": { 3 | "codebase": "github-to-slack" 4 | } 5 | } -------------------------------------------------------------------------------- /Node-1st-gen/github-to-slack/functions/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "github-to-slack-functions", 3 | "description": "Firebase Functions that posts new GitHub commits to a Slack channel.", 4 | "dependencies": { 5 | "eslint-plugin-promise": "^7.2.1", 6 | "firebase-admin": "^13.0.2", 7 | "firebase-functions": "^6.3.0", 8 | "node-fetch": "^2.6.7", 9 | "secure-compare": "^3.0.1" 10 | }, 11 | "devDependencies": { 12 | "eslint": "^8.57.1" 13 | }, 14 | "scripts": { 15 | "lint": "./node_modules/.bin/eslint --max-warnings=0 .", 16 | "serve": "firebase emulators:start --only functions", 17 | "shell": "firebase functions:shell", 18 | "start": "npm run shell", 19 | "deploy": "firebase deploy --only functions", 20 | "logs": "firebase functions:log", 21 | "compile": "cp ../../../tsconfig.template.json ./tsconfig-compile.json && tsc --project tsconfig-compile.json" 22 | }, 23 | "engines": { 24 | "node": "20" 25 | }, 26 | "private": true 27 | } 28 | -------------------------------------------------------------------------------- /Node-1st-gen/google-sheet-sync/firebase.json: -------------------------------------------------------------------------------- 1 | { 2 | "functions": { 3 | "source": "functions", 4 | "codebase": "google-sheet-sync" 5 | }, 6 | "hosting": { 7 | "rewrites": [ 8 | { 9 | "source": "/oauthcallback", 10 | "function": "oauthcallback" 11 | }, 12 | { 13 | "source": "/authgoogleapi", 14 | "function": "authgoogleapi" 15 | }, 16 | { 17 | "source": "/testsheetwrite", 18 | "function": "testsheetwrite" 19 | } 20 | ] 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /Node-1st-gen/google-sheet-sync/functions/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "google-sheet-sync", 3 | "description": "Syncs new Firebase data to a Google Sheet", 4 | "dependencies": { 5 | "eslint-plugin-promise": "^7.2.1", 6 | "firebase-admin": "^13.0.2", 7 | "firebase-functions": "^6.3.0", 8 | "google-auth-library": "^5.10.1", 9 | "googleapis": "^47.0.0" 10 | }, 11 | "devDependencies": { 12 | "eslint": "^8.57.1" 13 | }, 14 | "scripts": { 15 | "lint": "./node_modules/.bin/eslint --max-warnings=0 .", 16 | "serve": "firebase emulators:start --only functions", 17 | "shell": "firebase functions:shell", 18 | "start": "npm run shell", 19 | "deploy": "firebase deploy --only functions", 20 | "logs": "firebase functions:log", 21 | "compile": "cp ../../../tsconfig.template.json ./tsconfig-compile.json && tsc --project tsconfig-compile.json" 22 | }, 23 | "engines": { 24 | "node": "20" 25 | }, 26 | "private": true 27 | } 28 | -------------------------------------------------------------------------------- /Node-1st-gen/image-maker/.gitignore: -------------------------------------------------------------------------------- 1 | .firebaserc 2 | node_modules 3 | -------------------------------------------------------------------------------- /Node-1st-gen/image-maker/firebase.json: -------------------------------------------------------------------------------- 1 | { 2 | "functions": { 3 | "codebase": "image-maker" 4 | }, 5 | "hosting": { 6 | "public": "public", 7 | "rewrites": [ 8 | {"source":"/api/**", "function":"app" } 9 | ] 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /Node-1st-gen/image-maker/functions/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "functions-image-maker", 3 | "description": "Sample functions that generate images on the backend", 4 | "dependencies": { 5 | "canvas": "^3.0.1", 6 | "eslint-plugin-promise": "^7.2.1", 7 | "express": "^4.18.2", 8 | "firebase-admin": "^13.0.2", 9 | "firebase-functions": "^6.3.0", 10 | "lodash": "^4.17.21" 11 | }, 12 | "devDependencies": { 13 | "eslint": "^8.57.1" 14 | }, 15 | "scripts": { 16 | "lint": "./node_modules/.bin/eslint --max-warnings=0 .", 17 | "serve": "firebase emulators:start --only functions", 18 | "shell": "firebase functions:shell", 19 | "start": "npm run shell", 20 | "deploy": "firebase deploy --only functions", 21 | "logs": "firebase functions:log", 22 | "compile": "cp ../../../tsconfig.template.json ./tsconfig-compile.json && tsc --project tsconfig-compile.json" 23 | }, 24 | "engines": { 25 | "node": "20" 26 | }, 27 | "private": true 28 | } 29 | -------------------------------------------------------------------------------- /Node-1st-gen/instagram-auth/.gitignore: -------------------------------------------------------------------------------- 1 | service-account.json 2 | -------------------------------------------------------------------------------- /Node-1st-gen/instagram-auth/database.rules.json: -------------------------------------------------------------------------------- 1 | { 2 | "rules": { 3 | "instagramAccessToken": { 4 | "$uid": { 5 | ".read": "auth.uid === $uid", 6 | ".write": "auth.uid === $uid" 7 | } 8 | } 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /Node-1st-gen/instagram-auth/firebase.json: -------------------------------------------------------------------------------- 1 | { 2 | "functions": { 3 | "codebase": "instagram-auth" 4 | }, 5 | "database": { 6 | "rules": "database.rules.json" 7 | }, 8 | "hosting": { 9 | "public": "public", 10 | "rewrites": [ 11 | { 12 | "source": "/redirect", 13 | "function": "redirect" 14 | }, 15 | { 16 | "source": "/token", 17 | "function": "token" 18 | } 19 | ] 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /Node-1st-gen/instagram-auth/functions/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "instagram-auth-functions", 3 | "description": "Authenticate with Instagram Firebase Functions sample", 4 | "dependencies": { 5 | "cookie-parser": "^1.4.6", 6 | "eslint-plugin-promise": "^7.2.1", 7 | "firebase-admin": "^13.0.2", 8 | "firebase-functions": "^6.3.0", 9 | "simple-oauth2": "^3.4.0" 10 | }, 11 | "devDependencies": { 12 | "eslint": "^8.57.1" 13 | }, 14 | "scripts": { 15 | "lint": "./node_modules/.bin/eslint --max-warnings=0 .", 16 | "serve": "firebase emulators:start --only functions", 17 | "shell": "firebase functions:shell", 18 | "start": "npm run shell", 19 | "deploy": "firebase deploy --only functions", 20 | "logs": "firebase functions:log", 21 | "compile": "cp ../../../tsconfig.template.json ./tsconfig-compile.json && tsc --project tsconfig-compile.json" 22 | }, 23 | "engines": { 24 | "node": "20" 25 | }, 26 | "private": true 27 | } 28 | -------------------------------------------------------------------------------- /Node-1st-gen/instagram-auth/public/firebase-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/firebase/functions-samples/c4fde45b65fab584715e786ce3264a6932d996ec/Node-1st-gen/instagram-auth/public/firebase-logo.png -------------------------------------------------------------------------------- /Node-1st-gen/lastmodified-tracking/database.rules.json: -------------------------------------------------------------------------------- 1 | { 2 | "rules": { 3 | "lastmodified": { 4 | ".write": "false", 5 | ".read": "true" 6 | } 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /Node-1st-gen/lastmodified-tracking/firebase.json: -------------------------------------------------------------------------------- 1 | { 2 | "functions": { 3 | "codebase": "lastmodified-tracking" 4 | }, 5 | "database": { 6 | "rules": "database.rules.json" 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /Node-1st-gen/lastmodified-tracking/functions/index.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2015 Google Inc. All Rights Reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 'use strict'; 17 | 18 | const functions = require('firebase-functions/v1'); 19 | const admin = require('firebase-admin'); 20 | admin.initializeApp(); 21 | 22 | /** 23 | * This Function updates the `/lastmodified` with the timestamp of the last write to `/chat/$message`. 24 | */ 25 | exports.touch = functions.database.ref('/chat/{message}').onWrite( 26 | (change, context) => admin.database().ref('/lastmodified').set(context.timestamp)); 27 | -------------------------------------------------------------------------------- /Node-1st-gen/lastmodified-tracking/functions/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "lastmodified-tracking-functions", 3 | "description": "Track Lastmodified date of nodes Firebase Functions sample", 4 | "dependencies": { 5 | "eslint-plugin-promise": "^7.2.1", 6 | "firebase-admin": "^13.0.2", 7 | "firebase-functions": "^6.3.0" 8 | }, 9 | "devDependencies": { 10 | "eslint": "^8.57.1" 11 | }, 12 | "scripts": { 13 | "lint": "./node_modules/.bin/eslint --max-warnings=0 .", 14 | "serve": "firebase emulators:start --only functions", 15 | "shell": "firebase functions:shell", 16 | "start": "npm run shell", 17 | "deploy": "firebase deploy --only functions", 18 | "logs": "firebase functions:log", 19 | "compile": "cp ../../../tsconfig.template.json ./tsconfig-compile.json && tsc --project tsconfig-compile.json" 20 | }, 21 | "engines": { 22 | "node": "20" 23 | }, 24 | "private": true 25 | } 26 | -------------------------------------------------------------------------------- /Node-1st-gen/limit-children/README.md: -------------------------------------------------------------------------------- 1 | # Limit number of child nodes 2 | 3 | This template shows how to keep the number of child nodes in a Firebase database below a given number. This can be used to limit the number of lines of a chat history or logs. 4 | 5 | ## Functions Code 6 | 7 | See file [functions/index.js](functions/index.js) for the code. 8 | 9 | The dependencies are listed in [functions/package.json](functions/package.json). 10 | 11 | ## Sample Database Structure 12 | 13 | As an example we'll be using a simple chat database structure: 14 | 15 | ``` 16 | /functions-project-12345 17 | /chat 18 | /key-123456 19 | user: "Mat", 20 | text: "Hey Bob!" 21 | /key-123457 22 | user: "Bob", 23 | text: "Hey Mat! What's Up?" 24 | ``` 25 | 26 | Every time a new chat message is added the Function runs. It counts the number of chat messages and removes the old ones if there are too many. 27 | -------------------------------------------------------------------------------- /Node-1st-gen/limit-children/firebase.json: -------------------------------------------------------------------------------- 1 | { 2 | "functions": { 3 | "codebase": "limit-children" 4 | } 5 | } -------------------------------------------------------------------------------- /Node-1st-gen/limit-children/functions/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "limit-children-functions", 3 | "description": "Limit number of child nodes Firebase Functions sample", 4 | "dependencies": { 5 | "eslint-plugin-promise": "^7.2.1", 6 | "firebase-admin": "^13.0.2", 7 | "firebase-functions": "^6.3.0" 8 | }, 9 | "devDependencies": { 10 | "eslint": "^8.57.1" 11 | }, 12 | "scripts": { 13 | "lint": "./node_modules/.bin/eslint --max-warnings=0 .", 14 | "serve": "firebase emulators:start --only functions", 15 | "shell": "firebase functions:shell", 16 | "start": "npm run shell", 17 | "deploy": "firebase deploy --only functions", 18 | "logs": "firebase functions:log", 19 | "compile": "cp ../../../tsconfig.template.json ./tsconfig-compile.json && tsc --project tsconfig-compile.json" 20 | }, 21 | "engines": { 22 | "node": "20" 23 | }, 24 | "private": true 25 | } 26 | -------------------------------------------------------------------------------- /Node-1st-gen/linkedin-auth/.gitignore: -------------------------------------------------------------------------------- 1 | service-account.json 2 | -------------------------------------------------------------------------------- /Node-1st-gen/linkedin-auth/database.rules.json: -------------------------------------------------------------------------------- 1 | { 2 | "rules": { 3 | "linkedInAccessToken": { 4 | "$uid": { 5 | ".read": "auth.uid === $uid", 6 | ".write": "auth.uid === $uid" 7 | } 8 | } 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /Node-1st-gen/linkedin-auth/firebase.json: -------------------------------------------------------------------------------- 1 | { 2 | "functions": { 3 | "codebase": "linkedin-auth" 4 | }, 5 | "database": { 6 | "rules": "database.rules.json" 7 | }, 8 | "hosting": { 9 | "public": "public", 10 | "rewrites": [ 11 | { 12 | "source": "/redirect", 13 | "function": "redirect" 14 | }, 15 | { 16 | "source": "/token", 17 | "function": "token" 18 | } 19 | ] 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /Node-1st-gen/linkedin-auth/functions/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "linkedin-auth-functions", 3 | "description": "Authenticate with LinkedIn Firebase Functions sample", 4 | "dependencies": { 5 | "cookie-parser": "^1.4.6", 6 | "eslint-plugin-promise": "^7.2.1", 7 | "firebase-admin": "^13.0.2", 8 | "firebase-functions": "^6.3.0", 9 | "node-linkedin": "^0.5.6" 10 | }, 11 | "devDependencies": { 12 | "eslint": "^8.57.1" 13 | }, 14 | "scripts": { 15 | "lint": "./node_modules/.bin/eslint --max-warnings=0 .", 16 | "serve": "firebase emulators:start --only functions", 17 | "shell": "firebase functions:shell", 18 | "start": "npm run shell", 19 | "deploy": "firebase deploy --only functions", 20 | "logs": "firebase functions:log", 21 | "compile": "cp ../../../tsconfig.template.json ./tsconfig-compile.json && tsc --project tsconfig-compile.json" 22 | }, 23 | "engines": { 24 | "node": "20" 25 | }, 26 | "private": true 27 | } 28 | -------------------------------------------------------------------------------- /Node-1st-gen/linkedin-auth/public/firebase-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/firebase/functions-samples/c4fde45b65fab584715e786ce3264a6932d996ec/Node-1st-gen/linkedin-auth/public/firebase-logo.png -------------------------------------------------------------------------------- /Node-1st-gen/linkedin-auth/public/linkedIn-button.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/firebase/functions-samples/c4fde45b65fab584715e786ce3264a6932d996ec/Node-1st-gen/linkedin-auth/public/linkedIn-button.png -------------------------------------------------------------------------------- /Node-1st-gen/message-translation/firebase.json: -------------------------------------------------------------------------------- 1 | { 2 | "functions": { 3 | "codebase": "message-translation" 4 | } 5 | } -------------------------------------------------------------------------------- /Node-1st-gen/message-translation/functions/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "message-translation-functions", 3 | "description": "Transalte Messages Firebase Functions sample", 4 | "dependencies": { 5 | "@google-cloud/translate": "^5.3.0", 6 | "eslint-plugin-promise": "^7.2.1", 7 | "firebase-admin": "^13.0.2", 8 | "firebase-functions": "^6.3.0" 9 | }, 10 | "devDependencies": { 11 | "eslint": "^8.57.1" 12 | }, 13 | "scripts": { 14 | "lint": "./node_modules/.bin/eslint --max-warnings=0 .", 15 | "serve": "firebase emulators:start --only functions", 16 | "shell": "firebase functions:shell", 17 | "start": "npm run shell", 18 | "deploy": "firebase deploy --only functions", 19 | "logs": "firebase functions:log", 20 | "compile": "cp ../../../tsconfig.template.json ./tsconfig-compile.json && tsc --project tsconfig-compile.json" 21 | }, 22 | "engines": { 23 | "node": "20" 24 | }, 25 | "private": true 26 | } 27 | -------------------------------------------------------------------------------- /Node-1st-gen/minimal-webhook/README.md: -------------------------------------------------------------------------------- 1 | # Webhook upon Database writes 2 | 3 | This Function shows how a Database write can trigger a request to a hardcoded callback URL (a Webhook). The content of the modified Data is sent to the Webhook. 4 | 5 | ## Functions Code 6 | 7 | See file [functions/index.js](functions/index.js) for the code. 8 | 9 | We're sending a request to an external webhook. As a sample we're using a Request Bin from [requestb.in](http://requestb.in) that will receive the Data so you can visualize it easily. make sure you create your own Request Bin and update the sample with it. 10 | 11 | Note: You will need to enable billing on your Firebase the project by switching to the **Blaze** plan, this is currently needed to be able to perform HTTP requests to external services from a Cloud Function. 12 | 13 | ## Sample Database Structure 14 | 15 | As an example we'll be using a database structure where adding or updating an element under `/hooks` will trigger the Webhook: 16 | 17 | ``` 18 | /functions-project-12345 19 | /hooks 20 | /key-123456 21 | stuff: "Whatever" 22 | more_stuff: "Cool" 23 | /key-123457 24 | things: "A car" 25 | more_things: "A truck" 26 | ``` 27 | -------------------------------------------------------------------------------- /Node-1st-gen/minimal-webhook/firebase.json: -------------------------------------------------------------------------------- 1 | { 2 | "functions": { 3 | "codebase": "minimal-webhook" 4 | } 5 | } -------------------------------------------------------------------------------- /Node-1st-gen/minimal-webhook/functions/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "minimal-webhook-functions", 3 | "description": "Queries a Webhook Firebase Functions sample", 4 | "dependencies": { 5 | "eslint-plugin-promise": "^7.2.1", 6 | "firebase-admin": "^13.0.2", 7 | "firebase-functions": "^6.3.0", 8 | "node-fetch": "^2.6.7" 9 | }, 10 | "devDependencies": { 11 | "eslint": "^8.57.1" 12 | }, 13 | "scripts": { 14 | "lint": "./node_modules/.bin/eslint --max-warnings=0 .", 15 | "serve": "firebase emulators:start --only functions", 16 | "shell": "firebase functions:shell", 17 | "start": "npm run shell", 18 | "deploy": "firebase deploy --only functions", 19 | "logs": "firebase functions:log", 20 | "compile": "cp ../../../tsconfig.template.json ./tsconfig-compile.json && tsc --project tsconfig-compile.json" 21 | }, 22 | "engines": { 23 | "node": "20" 24 | }, 25 | "private": true 26 | } 27 | -------------------------------------------------------------------------------- /Node-1st-gen/moderate-images/firebase.json: -------------------------------------------------------------------------------- 1 | { 2 | "functions": { 3 | "codebase": "moderate-images" 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /Node-1st-gen/moderate-images/functions/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "moderate-image-function", 3 | "description": "Offensive Image blurring using Firebase Function", 4 | "dependencies": { 5 | "@google-cloud/vision": "^2.4.2", 6 | "eslint-plugin-promise": "^7.2.1", 7 | "firebase-admin": "^13.0.2", 8 | "firebase-functions": "^6.3.0" 9 | }, 10 | "devDependencies": { 11 | "eslint": "^8.57.1" 12 | }, 13 | "scripts": { 14 | "lint": "./node_modules/.bin/eslint --max-warnings=0 .", 15 | "serve": "firebase emulators:start --only functions", 16 | "shell": "firebase functions:shell", 17 | "start": "npm run shell", 18 | "deploy": "firebase deploy --only functions", 19 | "logs": "firebase functions:log", 20 | "compile": "cp ../../../tsconfig.template.json ./tsconfig-compile.json && tsc --project tsconfig-compile.json" 21 | }, 22 | "engines": { 23 | "node": "20" 24 | }, 25 | "private": true 26 | } 27 | -------------------------------------------------------------------------------- /Node-1st-gen/okta-auth/.gitignore: -------------------------------------------------------------------------------- 1 | service_account_private_key.json 2 | .runtimeconfig.json 3 | ui-debug.log 4 | public/okta-config.js 5 | functions/.env 6 | -------------------------------------------------------------------------------- /Node-1st-gen/okta-auth/firebase.json: -------------------------------------------------------------------------------- 1 | { 2 | "functions": { 3 | "codebase": "okta-auth", 4 | "predeploy": [ 5 | "npm --prefix \"$RESOURCE_DIR\" run lint", 6 | "node setup.js -d" 7 | ] 8 | }, 9 | "hosting": { 10 | "public": "public", 11 | "ignore": [ 12 | "firebase.json", 13 | "**/.*", 14 | "**/node_modules/**" 15 | ], 16 | "predeploy": [ 17 | "node setup.js -d" 18 | ] 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /Node-1st-gen/okta-auth/functions/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "firebase-okta-auth", 3 | "description": "Example of authenticating with Firebase using Okta", 4 | "scripts": { 5 | "lint": "eslint .", 6 | "serve": "firebase emulators:start --only functions", 7 | "shell": "firebase functions:shell", 8 | "start": "npm run shell", 9 | "deploy": "firebase deploy --only functions", 10 | "logs": "firebase functions:log", 11 | "compile": "cp ../../../tsconfig.template.json ./tsconfig-compile.json && tsc --project tsconfig-compile.json" 12 | }, 13 | "engines": { 14 | "node": "20" 15 | }, 16 | "dependencies": { 17 | "@okta/jwt-verifier": "^1.0.0", 18 | "@okta/oidc-middleware": "^4.0.1", 19 | "cors": "^2.8.5", 20 | "dotenv": "^8.2.0", 21 | "eslint-plugin-promise": "^7.2.1", 22 | "express": "^4.17.1", 23 | "firebase-admin": "^13.0.2", 24 | "firebase-functions": "^6.3.0" 25 | }, 26 | "devDependencies": { 27 | "eslint": "^8.57.1", 28 | "firebase-functions-test": "^3.4.0" 29 | }, 30 | "private": true 31 | } 32 | -------------------------------------------------------------------------------- /Node-1st-gen/paypal/.gitignore: -------------------------------------------------------------------------------- 1 | firebase-debug.log 2 | functions/eslintrc.js 3 | -------------------------------------------------------------------------------- /Node-1st-gen/paypal/firebase.json: -------------------------------------------------------------------------------- 1 | { 2 | "functions": { 3 | "codebase": "paypal", 4 | "source": "functions" 5 | }, 6 | "hosting": { 7 | "public": "public", 8 | "rewrites": [ 9 | { 10 | "source": "/process", 11 | "function": "process" 12 | }, 13 | { 14 | "source": "/pay", 15 | "function": "pay" 16 | }, 17 | { 18 | "source":"/error", 19 | "destination":"/error.html", 20 | "type":301 21 | }, 22 | { 23 | "source":"/cancel", 24 | "destination":"/cancel.html", 25 | "type":301 26 | }, 27 | { 28 | "source":"/success", 29 | "destination":"/success.html", 30 | "type":301 31 | } 32 | ] 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /Node-1st-gen/paypal/functions/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "paypal-functions", 3 | "description": "Paypal Firebase Functions", 4 | "dependencies": { 5 | "cors": "^2.8.5", 6 | "eslint-plugin-promise": "^7.2.1", 7 | "firebase-admin": "^13.0.2", 8 | "firebase-functions": "^6.3.0", 9 | "paypal-rest-sdk": "^1.8.1" 10 | }, 11 | "devDependencies": { 12 | "eslint": "^8.57.1", 13 | "eslint-config-google": "^0.14.0", 14 | "jshint": "^2.13.5" 15 | }, 16 | "scripts": { 17 | "lint": "./node_modules/.bin/eslint --max-warnings=0 .", 18 | "serve": "firebase emulators:start --only functions", 19 | "shell": "firebase functions:shell", 20 | "start": "npm run shell", 21 | "deploy": "firebase deploy --only functions", 22 | "logs": "firebase functions:log", 23 | "compile": "cp ../../../tsconfig.template.json ./tsconfig-compile.json && tsc --project tsconfig-compile.json" 24 | }, 25 | "engines": { 26 | "node": "20" 27 | }, 28 | "private": true 29 | } 30 | -------------------------------------------------------------------------------- /Node-1st-gen/paypal/public/Demo.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/firebase/functions-samples/c4fde45b65fab584715e786ce3264a6932d996ec/Node-1st-gen/paypal/public/Demo.gif -------------------------------------------------------------------------------- /Node-1st-gen/paypal/public/cancel.html: -------------------------------------------------------------------------------- 1 | 2 | 17 | 18 | 19 | 20 | 21 | Cancel page 22 | 23 | 24 | 25 |

Cancel Page

26 | Home 27 | 28 | 29 | -------------------------------------------------------------------------------- /Node-1st-gen/paypal/public/error.html: -------------------------------------------------------------------------------- 1 | 2 | 17 | 18 | 19 | 20 | 21 | Error Page 22 | 23 | 24 | 25 |

Error Page

26 | Home 27 | 28 | 29 | -------------------------------------------------------------------------------- /Node-1st-gen/paypal/public/success.html: -------------------------------------------------------------------------------- 1 | 2 | 17 | 18 | 19 | 20 | 21 | Successs Page 22 | 23 | 24 |

Success Page

25 | Home 26 | 27 | 28 | -------------------------------------------------------------------------------- /Node-1st-gen/presence-firestore/firebase.json: -------------------------------------------------------------------------------- 1 | { 2 | "functions": { 3 | "codebase": "presence-firestore" 4 | }, 5 | "hosting": {"public": "public"} 6 | } 7 | -------------------------------------------------------------------------------- /Node-1st-gen/presence-firestore/functions/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "presence-firestore", 3 | "description": "Presence for Firestore", 4 | "dependencies": { 5 | "eslint-plugin-promise": "^7.2.1", 6 | "firebase-admin": "^13.0.2", 7 | "firebase-functions": "^6.3.0" 8 | }, 9 | "devDependencies": { 10 | "eslint": "^8.57.1" 11 | }, 12 | "scripts": { 13 | "lint": "./node_modules/.bin/eslint --max-warnings=0 .", 14 | "serve": "firebase emulators:start --only functions", 15 | "shell": "firebase functions:shell", 16 | "start": "npm run shell", 17 | "deploy": "firebase deploy --only functions", 18 | "logs": "firebase functions:log", 19 | "compile": "cp ../../../tsconfig.template.json ./tsconfig-compile.json && tsc --project tsconfig-compile.json" 20 | }, 21 | "engines": { 22 | "node": "20" 23 | }, 24 | "private": true 25 | } 26 | -------------------------------------------------------------------------------- /Node-1st-gen/publish-model/firebase.json: -------------------------------------------------------------------------------- 1 | { 2 | "functions": { 3 | "codebase": "publish-model", 4 | "predeploy": [ 5 | "npm --prefix \"$RESOURCE_DIR\" run lint" 6 | ] 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /Node-1st-gen/publish-model/functions/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "functions", 3 | "description": "Cloud Functions for Firebase", 4 | "scripts": { 5 | "lint": "eslint .", 6 | "serve": "firebase emulators:start --only functions", 7 | "shell": "firebase functions:shell", 8 | "start": "npm run shell", 9 | "deploy": "firebase deploy --only functions", 10 | "logs": "firebase functions:log", 11 | "compile": "cp ../../../tsconfig.template.json ./tsconfig-compile.json && tsc --project tsconfig-compile.json" 12 | }, 13 | "engines": { 14 | "node": "20" 15 | }, 16 | "dependencies": { 17 | "eslint-plugin-promise": "^7.2.1", 18 | "firebase-admin": "^13.0.2", 19 | "firebase-functions": "^6.3.0" 20 | }, 21 | "devDependencies": { 22 | "eslint": "^8.57.1", 23 | "firebase-functions-test": "^3.4.0" 24 | }, 25 | "private": true 26 | } 27 | -------------------------------------------------------------------------------- /Node-1st-gen/quickstarts/auth-blocking-functions/README.md: -------------------------------------------------------------------------------- 1 | # Firebase SDK for Cloud Functions Quickstart - Auth Blocking Functions 2 | ================================================ 3 | 4 | The Auth Blocking functions Quickstart demonstrates how to block account sign in and creation when using Firebase Auth or Google Cloud Identity Platform in a Firebase App. 5 | 6 | 7 | - [Read more about auth blocking functions](https://firebase.google.com/docs/auth/extend-with-blocking-functions) 8 | - [Read more about Cloud Functions for Firebase](https://firebase.google.com/docs/functions/) 9 | 10 | 11 | Getting Started 12 | --------------- 13 | 14 | To try this sample, you need a test app with Firebase Auth and Cloud Firestore enabled. Don't use a live app with real users! 15 | 16 | 1. Install dependencies with `npm install` 17 | 2. Deploy the functions with `firebase deploy --only functions` 18 | 3. Try to create an account using an email address with a domain _other than_ `@acme.com`. It should fail. 19 | 4. Add an existing user's email address to the `banned` collection in Cloud Firestore. Then, try to sign in as that user. It should fail. 20 | 21 | 22 | License 23 | ------- 24 | 25 | © Google, 2022. Licensed under an [Apache-2](../../../LICENSE) license. 26 | -------------------------------------------------------------------------------- /Node-1st-gen/quickstarts/auth-blocking-functions/firebase.json: -------------------------------------------------------------------------------- 1 | { 2 | "functions": { 3 | "codebase": "auth-blocking-functions", 4 | "predeploy": [ 5 | "npm --prefix \"$RESOURCE_DIR\" run lint" 6 | ] 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /Node-1st-gen/quickstarts/auth-blocking-functions/functions/.eslintrc.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2023 Google LLC 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | module.exports = { 18 | root: true, 19 | env: { 20 | es2020: true, 21 | node: true, 22 | }, 23 | extends: [ 24 | "eslint:recommended", 25 | "google", 26 | ], 27 | rules: { 28 | quotes: ["error", "double"], 29 | }, 30 | }; 31 | -------------------------------------------------------------------------------- /Node-1st-gen/quickstarts/auth-blocking-functions/functions/.gitignore: -------------------------------------------------------------------------------- 1 | node_modules/ -------------------------------------------------------------------------------- /Node-1st-gen/quickstarts/auth-blocking-functions/functions/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "functions", 3 | "description": "Cloud Functions for Firebase", 4 | "scripts": { 5 | "lint": "eslint .", 6 | "serve": "firebase emulators:start --only functions", 7 | "shell": "firebase functions:shell", 8 | "start": "npm run shell", 9 | "deploy": "firebase deploy --only functions", 10 | "logs": "firebase functions:log" 11 | }, 12 | "engines": { 13 | "node": "20" 14 | }, 15 | "main": "index.js", 16 | "dependencies": { 17 | "eslint-plugin-promise": "^7.2.1", 18 | "firebase-admin": "^13.0.2", 19 | "firebase-functions": "^6.3.0" 20 | }, 21 | "devDependencies": { 22 | "eslint": "^8.57.1", 23 | "eslint-config-google": "^0.14.0", 24 | "firebase-functions-test": "^3.4.0" 25 | }, 26 | "private": true 27 | } 28 | -------------------------------------------------------------------------------- /Node-1st-gen/quickstarts/big-ben/firebase.json: -------------------------------------------------------------------------------- 1 | // [START rewriterules] 2 | { 3 | "hosting": { 4 | "public": "public", 5 | 6 | // Add the following rewrites section *within* "hosting". 7 | "rewrites": [ { 8 | "source": "**", "function": "app" 9 | } ] 10 | } 11 | } 12 | // [END rewriterules] 13 | -------------------------------------------------------------------------------- /Node-1st-gen/quickstarts/big-ben/functions/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "big-ben-functions", 3 | "description": "A simple endpoint that returns a number of 'BONG' based on the time of day", 4 | "dependencies": { 5 | "cors": "^2.8.5", 6 | "eslint-plugin-promise": "^7.2.1", 7 | "express": "^4.18.2", 8 | "firebase-admin": "^13.0.2", 9 | "firebase-functions": "^6.3.0" 10 | }, 11 | "devDependencies": { 12 | "eslint": "^8.57.1" 13 | }, 14 | "scripts": { 15 | "lint": "./node_modules/.bin/eslint --max-warnings=0 .", 16 | "serve": "firebase emulators:start --only functions", 17 | "shell": "firebase functions:shell", 18 | "start": "npm run shell", 19 | "deploy": "firebase deploy --only functions", 20 | "logs": "firebase functions:log", 21 | "compile": "cp ../../../../tsconfig.template.json ./tsconfig-compile.json && tsc --project tsconfig-compile.json" 22 | }, 23 | "engines": { 24 | "node": "20" 25 | }, 26 | "private": true 27 | } 28 | -------------------------------------------------------------------------------- /Node-1st-gen/quickstarts/big-ben/public/style.css: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2018 Google Inc. All Rights Reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | body { 18 | font-family: sans-serif; 19 | text-align: center; 20 | } 21 | 22 | #bongs { 23 | display: block; 24 | margin-top: 10px; 25 | font-weight: bold; 26 | } 27 | 28 | button { 29 | cursor: pointer; 30 | } -------------------------------------------------------------------------------- /Node-1st-gen/quickstarts/email-users/firebase.json: -------------------------------------------------------------------------------- 1 | { 2 | "functions": { 3 | "codebase": "email-users" 4 | }, 5 | "hosting": { 6 | "public": "./public" 7 | }, 8 | "emulators": { 9 | "auth": { 10 | "port": 9099 11 | }, 12 | "functions": { 13 | "port": 5001 14 | }, 15 | "hosting": { 16 | "port": 5000 17 | }, 18 | "ui": { 19 | "enabled": true 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /Node-1st-gen/quickstarts/email-users/functions/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "new-user-email-functions", 3 | "description": "Send an email to new users and users who delete their account", 4 | "dependencies": { 5 | "eslint-plugin-promise": "^7.2.1", 6 | "firebase-admin": "^13.0.2", 7 | "firebase-functions": "^6.3.0", 8 | "nodemailer": "^6.8.0" 9 | }, 10 | "devDependencies": { 11 | "eslint": "^8.57.1" 12 | }, 13 | "scripts": { 14 | "lint": "./node_modules/.bin/eslint --max-warnings=0 .", 15 | "serve": "firebase emulators:start --only functions", 16 | "shell": "firebase functions:shell", 17 | "start": "npm run shell", 18 | "deploy": "firebase deploy --only functions", 19 | "logs": "firebase functions:log", 20 | "compile": "cp ../../../../tsconfig.template.json ./tsconfig-compile.json && tsc --project tsconfig-compile.json" 21 | }, 22 | "engines": { 23 | "node": "20" 24 | }, 25 | "private": true 26 | } 27 | -------------------------------------------------------------------------------- /Node-1st-gen/quickstarts/email-users/public/firebase-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/firebase/functions-samples/c4fde45b65fab584715e786ce3264a6932d996ec/Node-1st-gen/quickstarts/email-users/public/firebase-logo.png -------------------------------------------------------------------------------- /Node-1st-gen/quickstarts/https-time-server/firebase.json: -------------------------------------------------------------------------------- 1 | { 2 | "functions": { 3 | "codebase": "https-time-server" 4 | } 5 | } -------------------------------------------------------------------------------- /Node-1st-gen/quickstarts/https-time-server/functions/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "time-server-functions", 3 | "description": "A simple time server using HTTPS Cloud Function", 4 | "dependencies": { 5 | "cors": "^2.8.5", 6 | "eslint-plugin-promise": "^7.2.1", 7 | "firebase-admin": "^13.0.2", 8 | "firebase-functions": "^6.3.0", 9 | "moment": "^2.29.4" 10 | }, 11 | "devDependencies": { 12 | "eslint": "^8.57.1" 13 | }, 14 | "scripts": { 15 | "lint": "./node_modules/.bin/eslint --max-warnings=0 .", 16 | "serve": "firebase emulators:start --only functions", 17 | "shell": "firebase functions:shell", 18 | "start": "npm run shell", 19 | "deploy": "firebase deploy --only functions", 20 | "logs": "firebase functions:log", 21 | "compile": "cp ../../../../tsconfig.template.json ./tsconfig-compile.json && tsc --project tsconfig-compile.json" 22 | }, 23 | "engines": { 24 | "node": "20" 25 | }, 26 | "private": true 27 | } 28 | -------------------------------------------------------------------------------- /Node-1st-gen/quickstarts/multicodebase-hellos/firebase.json: -------------------------------------------------------------------------------- 1 | { 2 | "functions": [ 3 | { 4 | "source": "ts", 5 | "codebase": "multicodebase-hellos", 6 | "predeploy": [ 7 | "npm --prefix \"$RESOURCE_DIR\" run lint", 8 | "npm --prefix \"$RESOURCE_DIR\" run build" 9 | ] 10 | }, 11 | { 12 | "source": "js", 13 | "codebase": "javascript" 14 | } 15 | ], 16 | "emulators": { 17 | "functions": { 18 | "port": 5001 19 | }, 20 | "ui": { 21 | "enabled": true 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /Node-1st-gen/quickstarts/multicodebase-hellos/js/.eslintrc.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2023 Google LLC 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | module.exports = { 18 | root: true, 19 | env: { 20 | es2020: true, 21 | node: true, 22 | }, 23 | extends: [ 24 | "eslint:recommended", 25 | "google", 26 | ], 27 | rules: { 28 | quotes: ["error", "double"], 29 | }, 30 | }; 31 | -------------------------------------------------------------------------------- /Node-1st-gen/quickstarts/multicodebase-hellos/js/.gitignore: -------------------------------------------------------------------------------- 1 | node_modules/ -------------------------------------------------------------------------------- /Node-1st-gen/quickstarts/multicodebase-hellos/js/index.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2023 Google LLC 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | const functions = require("firebase-functions/v1"); 18 | 19 | exports.helloJS = functions.https.onRequest((request, response) => { 20 | functions.logger.info("Hello logs!", {structuredData: true}); 21 | response.send("Hello from JS codebase!"); 22 | }); 23 | -------------------------------------------------------------------------------- /Node-1st-gen/quickstarts/multicodebase-hellos/js/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "functions", 3 | "description": "Cloud Functions for Firebase", 4 | "scripts": { 5 | "lint": "eslint .", 6 | "serve": "firebase emulators:start --only functions", 7 | "shell": "firebase functions:shell", 8 | "start": "npm run shell", 9 | "deploy": "firebase deploy --only functions", 10 | "logs": "firebase functions:log" 11 | }, 12 | "engines": { 13 | "node": "20" 14 | }, 15 | "main": "index.js", 16 | "dependencies": { 17 | "eslint-plugin-promise": "^7.2.1", 18 | "firebase-admin": "^13.0.2", 19 | "firebase-functions": "^6.3.0" 20 | }, 21 | "devDependencies": { 22 | "eslint": "^8.57.1", 23 | "eslint-config-google": "^0.14.0", 24 | "firebase-functions-test": "^3.4.0" 25 | }, 26 | "private": true 27 | } 28 | -------------------------------------------------------------------------------- /Node-1st-gen/quickstarts/multicodebase-hellos/ts/.gitignore: -------------------------------------------------------------------------------- 1 | # Compiled JavaScript files 2 | lib/**/*.js 3 | lib/**/*.js.map 4 | 5 | # TypeScript v1 declaration files 6 | typings/ 7 | 8 | # Node.js dependency directory 9 | node_modules/ 10 | -------------------------------------------------------------------------------- /Node-1st-gen/quickstarts/multicodebase-hellos/ts/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "functions", 3 | "scripts": { 4 | "lint": "eslint --ext .js,.ts .", 5 | "build": "tsc", 6 | "serve": "npm run build && firebase emulators:start --only functions", 7 | "shell": "npm run build && firebase functions:shell", 8 | "start": "npm run shell", 9 | "deploy": "firebase deploy --only functions", 10 | "logs": "firebase functions:log" 11 | }, 12 | "engines": { 13 | "node": "20" 14 | }, 15 | "main": "lib/index.js", 16 | "dependencies": { 17 | "eslint-plugin-promise": "^7.2.1", 18 | "firebase-admin": "^13.0.2", 19 | "firebase-functions": "^6.3.0" 20 | }, 21 | "devDependencies": { 22 | "@typescript-eslint/eslint-plugin": "^5.58.0", 23 | "@typescript-eslint/parser": "^5.58.0", 24 | "eslint": "^8.57.1", 25 | "eslint-config-google": "^0.14.0", 26 | "eslint-plugin-import": "^2.25.4", 27 | "firebase-functions-test": "^3.4.0", 28 | "typescript": "^5.0.4" 29 | }, 30 | "private": true 31 | } 32 | -------------------------------------------------------------------------------- /Node-1st-gen/quickstarts/multicodebase-hellos/ts/src/index.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2023 Google LLC 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | import * as functions from "firebase-functions"; 18 | 19 | export const helloTS = functions.https.onRequest((request, response) => { 20 | functions.logger.info("Hello logs!", {structuredData: true}); 21 | response.send("Hello from TS codebase!"); 22 | }); 23 | -------------------------------------------------------------------------------- /Node-1st-gen/quickstarts/multicodebase-hellos/ts/tsconfig.dev.json: -------------------------------------------------------------------------------- 1 | { 2 | "include": [ 3 | ".eslintrc.js" 4 | ] 5 | } 6 | -------------------------------------------------------------------------------- /Node-1st-gen/quickstarts/multicodebase-hellos/ts/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "module": "commonjs", 4 | "noImplicitReturns": true, 5 | "noUnusedLocals": true, 6 | "outDir": "lib", 7 | "sourceMap": true, 8 | "strict": true, 9 | "target": "es2017" 10 | }, 11 | "compileOnSave": true, 12 | "include": [ 13 | "src" 14 | ] 15 | } 16 | -------------------------------------------------------------------------------- /Node-1st-gen/quickstarts/pubsub-helloworld/firebase.json: -------------------------------------------------------------------------------- 1 | { 2 | "functions": { 3 | "codebase": "pubsub-helloworld" 4 | }, 5 | "emulators": { 6 | "functions": { 7 | "port": 5001 8 | }, 9 | "pubsub": { 10 | "port": 8085 11 | }, 12 | "ui": { 13 | "enabled": true 14 | } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /Node-1st-gen/quickstarts/pubsub-helloworld/functions/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "pubsub-hello-functions", 3 | "description": "Logs the data published to PubSub topics", 4 | "dependencies": { 5 | "eslint-plugin-promise": "^7.2.1", 6 | "firebase-admin": "^13.0.2", 7 | "firebase-functions": "^6.3.0" 8 | }, 9 | "devDependencies": { 10 | "eslint": "^8.57.1" 11 | }, 12 | "scripts": { 13 | "lint": "./node_modules/.bin/eslint --max-warnings=0 .", 14 | "serve": "firebase emulators:start --only functions", 15 | "shell": "firebase functions:shell", 16 | "start": "npm run shell", 17 | "deploy": "firebase deploy --only functions", 18 | "logs": "firebase functions:log", 19 | "compile": "cp ../../../../tsconfig.template.json ./tsconfig-compile.json && tsc --project tsconfig-compile.json" 20 | }, 21 | "engines": { 22 | "node": "20" 23 | }, 24 | "private": true 25 | } 26 | -------------------------------------------------------------------------------- /Node-1st-gen/quickstarts/runtime-options/firebase.json: -------------------------------------------------------------------------------- 1 | { 2 | "functions": { 3 | "source": "functions", 4 | "codebase": "runtime-options", 5 | "predeploy": [ 6 | "npm --prefix \"$RESOURCE_DIR\" run lint" 7 | ] 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /Node-1st-gen/quickstarts/runtime-options/functions/.eslintrc.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2023 Google LLC 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | module.exports = { 18 | root: true, 19 | env: { 20 | es2020: true, 21 | node: true, 22 | }, 23 | extends: [ 24 | "eslint:recommended", 25 | "google", 26 | ], 27 | rules: { 28 | quotes: ["error", "double"], 29 | }, 30 | }; 31 | -------------------------------------------------------------------------------- /Node-1st-gen/quickstarts/runtime-options/functions/.gitignore: -------------------------------------------------------------------------------- 1 | node_modules/ -------------------------------------------------------------------------------- /Node-1st-gen/quickstarts/runtime-options/functions/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "functions-runtime-options", 3 | "description": "Cloud Functions for Firebase", 4 | "scripts": { 5 | "lint": "eslint .", 6 | "serve": "firebase emulators:start --only functions", 7 | "shell": "firebase functions:shell", 8 | "start": "npm run shell", 9 | "deploy": "firebase deploy --only functions", 10 | "logs": "firebase functions:log" 11 | }, 12 | "engines": { 13 | "node": "20" 14 | }, 15 | "main": "index.js", 16 | "dependencies": { 17 | "eslint-plugin-promise": "^7.2.1", 18 | "firebase-admin": "^13.0.2", 19 | "firebase-functions": "^6.3.0" 20 | }, 21 | "devDependencies": { 22 | "eslint": "^8.57.1", 23 | "eslint-config-google": "^0.14.0", 24 | "firebase-functions-test": "^3.4.0" 25 | }, 26 | "private": true 27 | } 28 | -------------------------------------------------------------------------------- /Node-1st-gen/quickstarts/taskqueues-backup-images/firebase.json: -------------------------------------------------------------------------------- 1 | { 2 | "functions": { 3 | "codebase": "taskqueues-backup-images" 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /Node-1st-gen/quickstarts/taskqueues-backup-images/functions/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "functions-taskqueues-backup-images", 3 | "description": "Back up images from NASA's Astronomy Picture of the Day using Cloud Tasks.", 4 | "scripts": { 5 | "lint": "eslint .", 6 | "lint:fix": "eslint . --fix", 7 | "serve": "firebase emulators:start --only functions", 8 | "shell": "firebase functions:shell", 9 | "start": "npm run shell", 10 | "deploy": "firebase deploy --only functions", 11 | "logs": "firebase functions:log", 12 | "compile": "cp ../../../../tsconfig.template.json ./tsconfig-compile.json && tsc --project tsconfig-compile.json" 13 | }, 14 | "engines": { 15 | "node": "20" 16 | }, 17 | "main": "index.js", 18 | "dependencies": { 19 | "eslint-plugin-promise": "^7.2.1", 20 | "firebase-admin": "^13.0.2", 21 | "firebase-functions": "^6.3.0", 22 | "node-fetch": "^2.6.7" 23 | }, 24 | "devDependencies": { 25 | "eslint": "^8.57.1", 26 | "eslint-config-google": "^0.14.0" 27 | }, 28 | "private": true 29 | } 30 | -------------------------------------------------------------------------------- /Node-1st-gen/quickstarts/testlab-matrix-completed/firebase.json: -------------------------------------------------------------------------------- 1 | { 2 | "functions": { 3 | "codebase": "testlab-matrix-completed" 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /Node-1st-gen/quickstarts/testlab-matrix-completed/functions/.gitignore: -------------------------------------------------------------------------------- 1 | node_modules/ -------------------------------------------------------------------------------- /Node-1st-gen/quickstarts/testlab-matrix-completed/functions/index.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2023 Google LLC 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | const functions = require('firebase-functions/v1'); 18 | 19 | exports.logTestComplete = functions.testLab 20 | .testMatrix() 21 | .onComplete(testMatrix => { 22 | const { testMatrixId, createTime, state, outcomeSummary } = testMatrix; 23 | 24 | functions.logger.log( 25 | `TEST ${testMatrixId} (created at ${createTime}): ${state}. ${ 26 | outcomeSummary || '' 27 | }` 28 | ); 29 | }); 30 | -------------------------------------------------------------------------------- /Node-1st-gen/quickstarts/testlab-matrix-completed/functions/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "functions", 3 | "description": "Cloud Functions for Firebase", 4 | "scripts": { 5 | "serve": "firebase emulators:start --only functions", 6 | "shell": "firebase functions:shell", 7 | "start": "npm run shell", 8 | "deploy": "firebase deploy --only functions", 9 | "logs": "firebase functions:log", 10 | "compile": "cp ../../../../tsconfig.template.json ./tsconfig-compile.json && tsc --project tsconfig-compile.json" 11 | }, 12 | "engines": { 13 | "node": "20" 14 | }, 15 | "dependencies": { 16 | "eslint": "8", 17 | "eslint-plugin-promise": "^7.2.1", 18 | "firebase-admin": "^13.0.2", 19 | "firebase-functions": "^6.3.0" 20 | }, 21 | "devDependencies": { 22 | "firebase-functions-test": "^3.4.0" 23 | }, 24 | "private": true 25 | } 26 | -------------------------------------------------------------------------------- /Node-1st-gen/quickstarts/thumbnails/firebase.json: -------------------------------------------------------------------------------- 1 | { 2 | "functions": { 3 | "codebase": "thumbnails" 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /Node-1st-gen/quickstarts/thumbnails/functions/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "generate-thumbnail-functions-quickstart", 3 | "description": "Generate Thumbnail Firebase Functions sample", 4 | "dependencies": { 5 | "eslint-plugin-promise": "^7.2.1", 6 | "firebase-admin": "^13.0.2", 7 | "firebase-functions": "^6.3.0", 8 | "sharp": "^0.32.1" 9 | }, 10 | "devDependencies": { 11 | "eslint": "^8.57.1" 12 | }, 13 | "scripts": { 14 | "lint": "./node_modules/.bin/eslint --max-warnings=0 .", 15 | "serve": "firebase emulators:start --only functions", 16 | "shell": "firebase functions:shell", 17 | "start": "npm run shell", 18 | "deploy": "firebase deploy --only functions", 19 | "logs": "firebase functions:log", 20 | "compile": "cp ../../../../tsconfig.template.json ./tsconfig-compile.json && tsc --project tsconfig-compile.json" 21 | }, 22 | "engines": { 23 | "node": "20" 24 | }, 25 | "private": true 26 | } 27 | -------------------------------------------------------------------------------- /Node-1st-gen/quickstarts/uppercase-firestore/firebase.json: -------------------------------------------------------------------------------- 1 | { 2 | "functions": { 3 | "codebase": "uppercase-firestore" 4 | }, 5 | "firestore": { 6 | "rules": "firestore.rules", 7 | "indexes": "firestore.indexes.json" 8 | }, 9 | "emulators": { 10 | "functions": { 11 | "port": 5001 12 | }, 13 | "firestore": { 14 | "port": 8080 15 | }, 16 | "ui": { 17 | "enabled": true 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /Node-1st-gen/quickstarts/uppercase-firestore/firestore.indexes.json: -------------------------------------------------------------------------------- 1 | { 2 | "indexes": [], 3 | "fieldOverrides": [] 4 | } 5 | -------------------------------------------------------------------------------- /Node-1st-gen/quickstarts/uppercase-firestore/firestore.rules: -------------------------------------------------------------------------------- 1 | service cloud.firestore { 2 | match /databases/{database}/documents { 3 | match /messages/{message} { 4 | // Allow authenticated users to read/write the messages collection 5 | allow read, write: if request.auth != null; 6 | } 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /Node-1st-gen/quickstarts/uppercase-firestore/functions/.gitignore: -------------------------------------------------------------------------------- 1 | node_modules/ -------------------------------------------------------------------------------- /Node-1st-gen/quickstarts/uppercase-firestore/functions/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "uppercase-firestore-quickstart-functions", 3 | "description": "Uppercaser Firebase Functions Quickstart sample for Firestore", 4 | "dependencies": { 5 | "eslint-plugin-promise": "^7.2.1", 6 | "firebase-admin": "^13.0.2", 7 | "firebase-functions": "^6.3.0" 8 | }, 9 | "devDependencies": { 10 | "chai": "^4.3.6", 11 | "chai-as-promised": "^7.1.1", 12 | "eslint": "^8.57.1", 13 | "mocha": "^7.2.0", 14 | "sinon": "^9.2.4" 15 | }, 16 | "scripts": { 17 | "lint": "./node_modules/.bin/eslint --max-warnings=0 .", 18 | "serve": "firebase emulators:start --only functions", 19 | "shell": "firebase functions:shell", 20 | "start": "npm run shell", 21 | "deploy": "firebase deploy --only functions", 22 | "logs": "firebase functions:log", 23 | "compile": "cp ../../../../tsconfig.template.json ./tsconfig-compile.json && tsc --project tsconfig-compile.json" 24 | }, 25 | "engines": { 26 | "node": "20" 27 | }, 28 | "private": true 29 | } 30 | -------------------------------------------------------------------------------- /Node-1st-gen/quickstarts/uppercase-rtdb/database.rules.json: -------------------------------------------------------------------------------- 1 | { 2 | "rules": { 3 | ".read": false, 4 | ".write": false 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /Node-1st-gen/quickstarts/uppercase-rtdb/firebase.json: -------------------------------------------------------------------------------- 1 | { 2 | "functions": { 3 | "codebase": "uppercase-rtdb" 4 | }, 5 | "rulesFile": "database.rules.json", 6 | "emulators": { 7 | "functions": { 8 | "port": 5001 9 | }, 10 | "database": { 11 | "port": 9000 12 | }, 13 | "ui": { 14 | "enabled": true 15 | } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /Node-1st-gen/remote-config-diff/README.md: -------------------------------------------------------------------------------- 1 | ## Get the diff between the previous and current Remote Config templates. 2 | 3 | With the Firebase Remote Config Cloud Function trigger you can take action when your template has been updated. 4 | 5 | In this sample the diff between the previous and current templates is logged. 6 | 7 | See [eBay's](https://github.com/eBay/firebase-remote-config-monitor) real world implementation. 8 | 9 | See the [docs](https://firebase.google.com/docs/functions/rc-events) for more on Remote Config Triggers. 10 | -------------------------------------------------------------------------------- /Node-1st-gen/remote-config-diff/firebase.json: -------------------------------------------------------------------------------- 1 | { 2 | "functions": { 3 | "codebase": "remote-config-diff", 4 | "predeploy": [ 5 | "npm --prefix \"$RESOURCE_DIR\" run lint" 6 | ] 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /Node-1st-gen/remote-config-diff/functions/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "functions", 3 | "description": "Cloud Functions for Firebase", 4 | "scripts": { 5 | "lint": "eslint .", 6 | "serve": "firebase emulators:start --only functions", 7 | "shell": "firebase functions:shell", 8 | "start": "npm run shell", 9 | "deploy": "firebase deploy --only functions", 10 | "logs": "firebase functions:log", 11 | "compile": "cp ../../../tsconfig.template.json ./tsconfig-compile.json && tsc --project tsconfig-compile.json" 12 | }, 13 | "dependencies": { 14 | "eslint-plugin-promise": "^7.2.1", 15 | "firebase-admin": "^13.0.2", 16 | "firebase-functions": "^6.3.0", 17 | "json-diff": "^1.0.3", 18 | "node-fetch": "^2.6.9", 19 | "request": "^2.88.2", 20 | "request-promise": "^4.2.5" 21 | }, 22 | "devDependencies": { 23 | "eslint": "^8.57.1" 24 | }, 25 | "private": true 26 | } 27 | -------------------------------------------------------------------------------- /Node-1st-gen/spotify-auth/database.rules.json: -------------------------------------------------------------------------------- 1 | { 2 | "rules": { 3 | "spotifyAccessToken": { 4 | "$uid": { 5 | ".read": "auth.uid === $uid", 6 | ".write": "auth.uid === $uid" 7 | } 8 | } 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /Node-1st-gen/spotify-auth/firebase.json: -------------------------------------------------------------------------------- 1 | { 2 | "functions": { 3 | "codebase": "spotify-auth" 4 | }, 5 | "database": { 6 | "rules": "database.rules.json" 7 | }, 8 | "hosting": { 9 | "public": "public" 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /Node-1st-gen/spotify-auth/functions/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "spotify-auth-functions", 3 | "description": "Authenticate with Spotify Firebase Functions sample", 4 | "dependencies": { 5 | "cookie-parser": "^1.4.6", 6 | "eslint-plugin-promise": "^7.2.1", 7 | "firebase-admin": "^13.0.2", 8 | "firebase-functions": "^6.3.0", 9 | "spotify-web-api-node": "^4.0.0" 10 | }, 11 | "devDependencies": { 12 | "eslint": "^8.57.1" 13 | }, 14 | "scripts": { 15 | "lint": "./node_modules/.bin/eslint --max-warnings=0 .", 16 | "serve": "firebase emulators:start --only functions", 17 | "shell": "firebase functions:shell", 18 | "start": "npm run shell", 19 | "deploy": "firebase deploy --only functions", 20 | "logs": "firebase functions:log", 21 | "compile": "cp ../../../tsconfig.template.json ./tsconfig-compile.json && tsc --project tsconfig-compile.json" 22 | }, 23 | "engines": { 24 | "node": "20" 25 | }, 26 | "private": true 27 | } 28 | -------------------------------------------------------------------------------- /Node-1st-gen/spotify-auth/main.css: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2023 Google LLC 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | 18 | -------------------------------------------------------------------------------- /Node-1st-gen/spotify-auth/public/firebase-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/firebase/functions-samples/c4fde45b65fab584715e786ce3264a6932d996ec/Node-1st-gen/spotify-auth/public/firebase-logo.png -------------------------------------------------------------------------------- /Node-1st-gen/spotify-auth/public/spotify-button.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/firebase/functions-samples/c4fde45b65fab584715e786ce3264a6932d996ec/Node-1st-gen/spotify-auth/public/spotify-button.png -------------------------------------------------------------------------------- /Node-1st-gen/stripe/demo.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/firebase/functions-samples/c4fde45b65fab584715e786ce3264a6932d996ec/Node-1st-gen/stripe/demo.gif -------------------------------------------------------------------------------- /Node-1st-gen/stripe/firebase.json: -------------------------------------------------------------------------------- 1 | { 2 | "functions": { 3 | "codebase": "stripe" 4 | }, 5 | "firestore": { 6 | "rules": "firestore.rules" 7 | }, 8 | "hosting": { 9 | "public": "public", 10 | "ignore": ["firebase.json", "**/.*", "**/node_modules/**"] 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /Node-1st-gen/stripe/firestore.rules: -------------------------------------------------------------------------------- 1 | rules_version = '2'; 2 | service cloud.firestore { 3 | match /databases/{database}/documents { 4 | match /stripe_customers/{uid} { 5 | allow read, write: if request.auth.uid == uid; 6 | 7 | match /payment_methods/{id} { 8 | allow read,write: if request.auth.uid == uid; 9 | } 10 | match /payments/{id} { 11 | allow read, write: if request.auth.uid == uid; 12 | } 13 | 14 | } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /Node-1st-gen/stripe/functions/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "stripe-functions", 3 | "description": "Stripe Firebase Functions", 4 | "dependencies": { 5 | "@google-cloud/logging": "^7.3.0", 6 | "eslint-plugin-promise": "^7.2.1", 7 | "firebase-admin": "^13.0.2", 8 | "firebase-functions": "^6.3.0", 9 | "stripe": "^8.222.0" 10 | }, 11 | "devDependencies": { 12 | "eslint": "^8.57.1" 13 | }, 14 | "scripts": { 15 | "lint": "./node_modules/.bin/eslint --max-warnings=0 .", 16 | "serve": "firebase emulators:start --only functions", 17 | "shell": "firebase functions:shell", 18 | "start": "npm run shell", 19 | "deploy": "firebase deploy --only functions", 20 | "logs": "firebase functions:log", 21 | "compile": "cp ../../../tsconfig.template.json ./tsconfig-compile.json && tsc --project tsconfig-compile.json" 22 | }, 23 | "engines": { 24 | "node": "20" 25 | }, 26 | "private": true 27 | } 28 | -------------------------------------------------------------------------------- /Node-1st-gen/survey-app-update/firebase.json: -------------------------------------------------------------------------------- 1 | { 2 | "functions": { 3 | "codebase": "survey-app-update" 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /Node-1st-gen/survey-app-update/functions/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "survey-app-update-function", 3 | "description": "Sends a survey via email to users who upgrade your app", 4 | "dependencies": { 5 | "eslint-plugin-promise": "^7.2.1", 6 | "firebase-admin": "^13.0.2", 7 | "firebase-functions": "^6.3.0", 8 | "nodemailer": "^6.8.0" 9 | }, 10 | "devDependencies": { 11 | "eslint": "^8.57.1" 12 | }, 13 | "scripts": { 14 | "lint": "./node_modules/.bin/eslint --max-warnings=0 .", 15 | "serve": "firebase emulators:start --only functions", 16 | "shell": "firebase functions:shell", 17 | "start": "npm run shell", 18 | "deploy": "firebase deploy --only functions", 19 | "logs": "firebase functions:log", 20 | "compile": "cp ../../../tsconfig.template.json ./tsconfig-compile.json && tsc --project tsconfig-compile.json" 21 | }, 22 | "engines": { 23 | "node": "20" 24 | }, 25 | "private": true 26 | } 27 | -------------------------------------------------------------------------------- /Node-1st-gen/template-handlebars/firebase.json: -------------------------------------------------------------------------------- 1 | { 2 | "functions": { 3 | "codebase": "template-handlebars" 4 | }, 5 | "hosting": { 6 | "public": "public", 7 | "rewrites": [ 8 | { 9 | "source":"**", 10 | "function":"app" 11 | } 12 | ] 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /Node-1st-gen/template-handlebars/functions/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "template-handlebars-functions", 3 | "description": "Use handlebars templating engine on Firebase hosting with Cloud functions", 4 | "dependencies": { 5 | "cookie-parser": "^1.4.6", 6 | "cors": "^2.8.5", 7 | "eslint-plugin-promise": "^7.2.1", 8 | "express": "^4.18.2", 9 | "express-handlebars": "^3.1.0", 10 | "firebase-admin": "^13.0.2", 11 | "firebase-functions": "^6.3.0", 12 | "handlebars": "^4.7.7" 13 | }, 14 | "devDependencies": { 15 | "eslint": "^8.57.1" 16 | }, 17 | "scripts": { 18 | "lint": "./node_modules/.bin/eslint --max-warnings=0 .", 19 | "serve": "firebase emulators:start --only functions", 20 | "shell": "firebase functions:shell", 21 | "start": "npm run shell", 22 | "deploy": "firebase deploy --only functions", 23 | "logs": "firebase functions:log", 24 | "compile": "cp ../../../tsconfig.template.json ./tsconfig-compile.json && tsc --project tsconfig-compile.json" 25 | }, 26 | "engines": { 27 | "node": "20" 28 | }, 29 | "private": true 30 | } 31 | -------------------------------------------------------------------------------- /Node-1st-gen/template-handlebars/functions/views/user.handlebars: -------------------------------------------------------------------------------- 1 | {{#if user}} 2 |

Hello {{user.name}}!

3 | Here is your UID: {{user.uid}} 4 |

5 | 6 | {{^}} 7 |

Hey there!

8 | Please sign-in! 9 |

10 | 11 | {{/if}} 12 | -------------------------------------------------------------------------------- /Node-1st-gen/template-handlebars/public/firebase-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/firebase/functions-samples/c4fde45b65fab584715e786ce3264a6932d996ec/Node-1st-gen/template-handlebars/public/firebase-logo.png -------------------------------------------------------------------------------- /Node-1st-gen/template-handlebars/public/main.css: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2017 Google Inc. All Rights Reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | html, body { 18 | font-family: 'Roboto', 'Helvetica', sans-serif; 19 | } 20 | -------------------------------------------------------------------------------- /Node-1st-gen/testlab-to-slack/firebase.json: -------------------------------------------------------------------------------- 1 | { 2 | "functions": { 3 | "codebase": "testlab-to-slack" 4 | } 5 | } -------------------------------------------------------------------------------- /Node-1st-gen/testlab-to-slack/functions/.gitignore: -------------------------------------------------------------------------------- 1 | node_modules/ -------------------------------------------------------------------------------- /Node-1st-gen/testlab-to-slack/functions/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "functions", 3 | "description": "Cloud Functions for Firebase", 4 | "scripts": { 5 | "serve": "firebase emulators:start --only functions", 6 | "shell": "firebase functions:shell", 7 | "start": "npm run shell", 8 | "deploy": "firebase deploy --only functions", 9 | "logs": "firebase functions:log", 10 | "compile": "cp ../../../tsconfig.template.json ./tsconfig-compile.json && tsc --project tsconfig-compile.json" 11 | }, 12 | "engines": { 13 | "node": "20" 14 | }, 15 | "dependencies": { 16 | "eslint": "8", 17 | "eslint-plugin-promise": "^7.2.1", 18 | "firebase-admin": "^13.0.2", 19 | "firebase-functions": "^6.3.0", 20 | "node-fetch": "^2.0.0" 21 | }, 22 | "devDependencies": { 23 | "firebase-functions-test": "^3.4.0" 24 | }, 25 | "private": true 26 | } 27 | -------------------------------------------------------------------------------- /Node-1st-gen/text-moderation/firebase.json: -------------------------------------------------------------------------------- 1 | { 2 | "functions": { 3 | "codebase": "text-moderation" 4 | }, 5 | "database": { 6 | "rules": "security.rules.json" 7 | }, 8 | "hosting": { 9 | "public": "public" 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /Node-1st-gen/text-moderation/functions/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "text-moderation-functions", 3 | "description": "Moderate text using Firebase Functions", 4 | "dependencies": { 5 | "bad-words": "^3.0.4", 6 | "capitalize-sentence": "^0.1.5", 7 | "eslint-plugin-promise": "^7.2.1", 8 | "firebase-admin": "^13.0.2", 9 | "firebase-functions": "^6.3.0" 10 | }, 11 | "devDependencies": { 12 | "eslint": "^8.57.1" 13 | }, 14 | "scripts": { 15 | "lint": "./node_modules/.bin/eslint --max-warnings=0 .", 16 | "serve": "firebase emulators:start --only functions", 17 | "shell": "firebase functions:shell", 18 | "start": "npm run shell", 19 | "deploy": "firebase deploy --only functions", 20 | "logs": "firebase functions:log", 21 | "compile": "cp ../../../tsconfig.template.json ./tsconfig-compile.json && tsc --project tsconfig-compile.json" 22 | }, 23 | "engines": { 24 | "node": "20" 25 | }, 26 | "private": true 27 | } 28 | -------------------------------------------------------------------------------- /Node-1st-gen/text-moderation/security.rules.json: -------------------------------------------------------------------------------- 1 | { 2 | "rules": { 3 | "messages": { 4 | ".read": true, 5 | "$message": { 6 | // Users can only add new messages to the review queue. 7 | ".write": "!data.exists()", 8 | // Users can't set the sanitized boolean themselves. 9 | ".validate": "!newData.hasChildren(['sanitized'])" 10 | } 11 | } 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /Node-1st-gen/url-shortener/firebase.json: -------------------------------------------------------------------------------- 1 | { 2 | "functions": { 3 | "codebase": "url-shortener" 4 | } 5 | } -------------------------------------------------------------------------------- /Node-1st-gen/url-shortener/functions/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "url-shortener-functions", 3 | "description": "URL Shortener Firebase Functions sample", 4 | "dependencies": { 5 | "bitly": "^6.1.0", 6 | "eslint-plugin-promise": "^7.2.1", 7 | "firebase-admin": "^13.0.2", 8 | "firebase-functions": "^6.3.0" 9 | }, 10 | "devDependencies": { 11 | "eslint": "^8.57.1" 12 | }, 13 | "scripts": { 14 | "lint": "./node_modules/.bin/eslint --max-warnings=0 .", 15 | "serve": "firebase emulators:start --only functions", 16 | "shell": "firebase functions:shell", 17 | "start": "npm run shell", 18 | "deploy": "firebase deploy --only functions", 19 | "logs": "firebase functions:log", 20 | "compile": "cp ../../../tsconfig.template.json ./tsconfig-compile.json && tsc --project tsconfig-compile.json" 21 | }, 22 | "engines": { 23 | "node": "20" 24 | }, 25 | "private": true 26 | } 27 | -------------------------------------------------------------------------------- /Node-1st-gen/user-data-cleanup/README.md: -------------------------------------------------------------------------------- 1 | # Wipeout user data when account deleted 2 | 3 | **This code has moved to its own repo at 4 | https://github.com/firebase/user-data-protection** 5 | 6 | (For archeologists, Git history prior to mid October 2017 is here, while 7 | subsequent history is in the new repo.) 8 | -------------------------------------------------------------------------------- /Node-1st-gen/user-data-cleanup/doc/auto_rules_extraction.md: -------------------------------------------------------------------------------- 1 | **Moved to https://github.com/firebase/user-data-protection/blob/main/doc/auto_rules_extraction.md** 2 | 3 | -------------------------------------------------------------------------------- /Node-1st-gen/user-data-cleanup/doc/design.md: -------------------------------------------------------------------------------- 1 | **Moved to https://github.com/firebase/user-data-protection/blob/main/doc/design.md** -------------------------------------------------------------------------------- /Node-1st-gen/username-password-auth/database.rules.json: -------------------------------------------------------------------------------- 1 | { 2 | "rules": { 3 | "$uid": { 4 | ".read": "auth.uid === $uid", 5 | ".write": "auth.uid === $uid" 6 | } 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /Node-1st-gen/username-password-auth/firebase.json: -------------------------------------------------------------------------------- 1 | { 2 | "functions": { 3 | "codebase": "username-password-auth" 4 | }, 5 | "database": { 6 | "rules": "database.rules.json" 7 | }, 8 | "hosting": { 9 | "public": "public" 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /Node-1st-gen/username-password-auth/functions/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "username-password-auth-function", 3 | "description": "Authenticate with username/password Firebase Function sample", 4 | "dependencies": { 5 | "cors": "^2.8.5", 6 | "eslint-plugin-promise": "^7.2.1", 7 | "firebase-admin": "^13.0.2", 8 | "firebase-functions": "^6.3.0", 9 | "node-fetch": "^2.6.7" 10 | }, 11 | "devDependencies": { 12 | "eslint": "^8.57.1" 13 | }, 14 | "scripts": { 15 | "lint": "./node_modules/.bin/eslint --max-warnings=0 .", 16 | "serve": "firebase emulators:start --only functions", 17 | "shell": "firebase functions:shell", 18 | "start": "npm run shell", 19 | "deploy": "firebase deploy --only functions", 20 | "logs": "firebase functions:log", 21 | "compile": "cp ../../../tsconfig.template.json ./tsconfig-compile.json && tsc --project tsconfig-compile.json" 22 | }, 23 | "engines": { 24 | "node": "20" 25 | }, 26 | "private": true 27 | } 28 | -------------------------------------------------------------------------------- /Node-1st-gen/username-password-auth/public/firebase-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/firebase/functions-samples/c4fde45b65fab584715e786ce3264a6932d996ec/Node-1st-gen/username-password-auth/public/firebase-logo.png -------------------------------------------------------------------------------- /Node-1st-gen/vision-annotate-images/README.md: -------------------------------------------------------------------------------- 1 | # Vision Annotate Images 2 | 3 | This function acts as a pass through to the [Cloud Vision JSON API](https://cloud.google.com/vision/docs/request). 4 | 5 | To call this from an app, you must first sign-in using [Firebase Auth](https://firebase.google.com/docs/auth). 6 | Only users who pass a valid Firebase ID token as a Bearer token in the `Authorization` header of the HTTP request are authorized to use the function. 7 | 8 | Explore the ready-to-use APIs: [text recognition](https://firebase.google.com/docs/ml/recognize-text), [image labeling](https://firebase.google.com/docs/ml/label-images), and [landmark recognition](https://firebase.google.com/docs/ml/recognize-landmarks) 9 | 10 | 11 | ## Contributing 12 | 13 | We'd love that you contribute to the project. Before doing so please read our [Contributor guide](../CONTRIBUTING.md). 14 | 15 | 16 | ## License 17 | 18 | © Google, 2017. Licensed under an [Apache-2](../LICENSE) license. 19 | -------------------------------------------------------------------------------- /Node-1st-gen/vision-annotate-images/firebase.json: -------------------------------------------------------------------------------- 1 | { 2 | "functions": { 3 | "codebase": "vision-annotate-images", 4 | "predeploy": [ 5 | "npm --prefix \"$RESOURCE_DIR\" run lint", 6 | "npm --prefix \"$RESOURCE_DIR\" run build" 7 | ] 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /Node-1st-gen/vision-annotate-images/functions/.gitignore: -------------------------------------------------------------------------------- 1 | lib/*.js 2 | lib/*.js.map -------------------------------------------------------------------------------- /Node-1st-gen/vision-annotate-images/functions/eslint.config.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2023 Google LLC 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | const eslint = require('@eslint/js'); 18 | const tseslint = require('typescript-eslint'); 19 | 20 | module.exports = tseslint.config( 21 | eslint.configs.recommended, 22 | tseslint.configs.recommended, 23 | ); 24 | -------------------------------------------------------------------------------- /Node-1st-gen/vision-annotate-images/functions/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "functions", 3 | "scripts": { 4 | "lint": "eslint \"src/**/*\"", 5 | "build": "tsc --project ./tsconfig.json", 6 | "serve": "npm run build && firebase emulators:start --only functions", 7 | "shell": "npm run build && firebase functions:shell", 8 | "start": "npm run shell", 9 | "deploy": "firebase deploy --only functions", 10 | "logs": "firebase functions:log", 11 | "compile": "npm run build" 12 | }, 13 | "engines": { 14 | "node": "20" 15 | }, 16 | "main": "lib/index.js", 17 | "dependencies": { 18 | "@google-cloud/vision": "^2.1.2", 19 | "firebase-admin": "^13.0.2", 20 | "firebase-functions": "^6.3.0" 21 | }, 22 | "devDependencies": { 23 | "@eslint/js": "^9.19.0", 24 | "eslint": "^9.19.0", 25 | "firebase-functions-test": "^3.4.0", 26 | "typescript": "^5.7.3", 27 | "typescript-eslint": "^8.22.0" 28 | }, 29 | "private": true 30 | } 31 | -------------------------------------------------------------------------------- /Node-1st-gen/vision-annotate-images/functions/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "module": "commonjs", 4 | "noImplicitReturns": true, 5 | "noUnusedLocals": true, 6 | "outDir": "lib", 7 | "sourceMap": true, 8 | "strict": true, 9 | "target": "es2017", 10 | "lib" : [ 11 | "esnext" 12 | ], 13 | "skipLibCheck": true, 14 | }, 15 | "compileOnSave": true, 16 | "include": [ 17 | "src" 18 | ] 19 | } 20 | -------------------------------------------------------------------------------- /Node-1st-gen/youtube/firebase.json: -------------------------------------------------------------------------------- 1 | { 2 | "functions": { 3 | "codebase": "youtube", 4 | "predeploy": [ 5 | "npm --prefix \"$RESOURCE_DIR\" run lint" 6 | ], 7 | "source": "functions" 8 | }, 9 | "emulators": { 10 | "functions": { 11 | "port": 5001 12 | }, 13 | "ui": { 14 | "enabled": true 15 | } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /Node-1st-gen/youtube/functions/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "functions", 3 | "description": "Cloud Functions for Firebase", 4 | "scripts": { 5 | "lint": "eslint .", 6 | "serve": "firebase emulators:start --only functions", 7 | "shell": "firebase functions:shell", 8 | "start": "npm run shell", 9 | "deploy": "firebase deploy --only functions", 10 | "logs": "firebase functions:log" 11 | }, 12 | "engines": { 13 | "node": "20" 14 | }, 15 | "main": "index.js", 16 | "dependencies": { 17 | "eslint-plugin-promise": "^7.2.1", 18 | "firebase-admin": "^13.0.2", 19 | "firebase-functions": "^6.3.0", 20 | "googleapis": "^66.0.0" 21 | }, 22 | "devDependencies": { 23 | "eslint": "^8.57.1", 24 | "firebase-functions-test": "^3.4.0" 25 | }, 26 | "private": true 27 | } 28 | -------------------------------------------------------------------------------- /Node/README.md: -------------------------------------------------------------------------------- 1 | # Node.js (2nd gen) samples 2 | 3 | This folder contains examples for 2nd gen Node.js functions. See a description of all samples in this folder in the [root README](../README.md). -------------------------------------------------------------------------------- /Node/alerts-to-discord/.gitignore: -------------------------------------------------------------------------------- 1 | # Don't accidentally push Discord Webhook URL to prod 2 | functions/.env -------------------------------------------------------------------------------- /Node/alerts-to-discord/firebase.json: -------------------------------------------------------------------------------- 1 | { 2 | "functions": { 3 | "codebase": "alerts-to-discord", 4 | "predeploy": [ 5 | "npm --prefix \"$RESOURCE_DIR\" run lint" 6 | ] 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /Node/alerts-to-discord/functions/.eslintrc.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2023 Google LLC 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | module.exports = { 18 | root: true, 19 | env: { 20 | es2017: true, 21 | node: true, 22 | }, 23 | extends: [ 24 | "eslint:recommended", 25 | "google", 26 | ], 27 | rules: { 28 | quotes: ["error", "double"], 29 | }, 30 | }; 31 | -------------------------------------------------------------------------------- /Node/alerts-to-discord/functions/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "alerts-to-discord", 3 | "description": "Send a message to Discord when an alert is received from Firebase", 4 | "scripts": { 5 | "lint": "eslint .", 6 | "serve": "firebase emulators:start --only functions", 7 | "shell": "firebase functions:shell", 8 | "start": "npm run shell", 9 | "deploy": "firebase deploy --only functions", 10 | "logs": "firebase functions:log", 11 | "compile": "cp ../../../tsconfig.template.json ./tsconfig-compile.json && tsc --project tsconfig-compile.json" 12 | }, 13 | "engines": { 14 | "node": "22" 15 | }, 16 | "main": "index.js", 17 | "dependencies": { 18 | "firebase-admin": "^13.0.2", 19 | "firebase-functions": "^6.3.0", 20 | "node-fetch": "^2.6.7" 21 | }, 22 | "devDependencies": { 23 | "@types/node": "^17.0.45", 24 | "eslint": "^8.57.1", 25 | "eslint-config-google": "^0.14.0", 26 | "firebase-functions-test": "^3.4.0" 27 | }, 28 | "private": true 29 | } 30 | -------------------------------------------------------------------------------- /Node/app-distribution-feedback-to-jira/.eslintrc: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | root: true, 3 | env: { 4 | es2017: true, 5 | node: true, 6 | }, 7 | extends: [ 8 | "eslint:recommended", 9 | "google", 10 | ], 11 | rules: { 12 | quotes: ["error", "double"], 13 | }, 14 | }; 15 | -------------------------------------------------------------------------------- /Node/app-distribution-feedback-to-jira/firebase.json: -------------------------------------------------------------------------------- 1 | { 2 | "functions": [ 3 | { 4 | "source": "functions", 5 | "codebase": "app-distribution-feedback-to-jira", 6 | "ignore": [ 7 | "node_modules", 8 | ".git", 9 | "firebase-debug.log", 10 | "firebase-debug.*.log" 11 | ], 12 | "predeploy": [ 13 | "npm --prefix \"$RESOURCE_DIR\" run lint" 14 | ] 15 | } 16 | ] 17 | } 18 | -------------------------------------------------------------------------------- /Node/app-distribution-feedback-to-jira/functions/.eslintrc.cjs: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2023 Google LLC 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | module.exports = { 18 | root: true, 19 | env: { 20 | es6: true, 21 | node: true, 22 | }, 23 | extends: [ 24 | "eslint:recommended", 25 | "google", 26 | ], 27 | rules: { 28 | quotes: ["error", "double"], 29 | }, 30 | "parserOptions": { 31 | "sourceType": "module", 32 | "ecmaVersion": 2022 33 | } 34 | }; 35 | -------------------------------------------------------------------------------- /Node/app-distribution-feedback-to-jira/functions/.gitignore: -------------------------------------------------------------------------------- 1 | node_modules/ -------------------------------------------------------------------------------- /Node/app-distribution-feedback-to-jira/functions/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "functions", 3 | "description": "File new issue in Jira when receiving in-app feedback facilitated by Firebase App Distribution", 4 | "scripts": { 5 | "lint": "eslint .", 6 | "serve": "firebase emulators:start --only functions", 7 | "shell": "firebase functions:shell", 8 | "start": "npm run shell", 9 | "deploy": "firebase deploy --only functions", 10 | "logs": "firebase functions:log" 11 | }, 12 | "engines": { 13 | "node": "22" 14 | }, 15 | "main": "index.js", 16 | "type": "module", 17 | "dependencies": { 18 | "firebase-functions": "^6.3.0", 19 | "formdata-polyfill": "^4.0.10", 20 | "node-fetch": "^3.3.0" 21 | }, 22 | "devDependencies": { 23 | "eslint": "^8.57.1", 24 | "eslint-config-google": "^0.14.0" 25 | }, 26 | "private": true 27 | } 28 | -------------------------------------------------------------------------------- /Node/call-vertex-remote-config-server/client/config.ts: -------------------------------------------------------------------------------- 1 | export const firebaseConfig = { 2 | YOUR_FIREBASE_CONFIG 3 | }; 4 | 5 | // Your ReCAPTCHA Enterprise site key (must be from the same project 6 | // as the Firebase config above). 7 | export const RECAPTCHA_ENTERPRISE_SITE_KEY = 8 | "YOUR_RECAPTCHA_KEY"; 9 | -------------------------------------------------------------------------------- /Node/call-vertex-remote-config-server/client/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "call-vertex-remote-config-server-client", 3 | "version": "1.0.0", 4 | "description": "JavaScript quickstart for Vertex AI, Firebase Remote Config server, and App Check.", 5 | "repository": { 6 | "type": "git", 7 | "url": "git+https://github.com/firebase/functions-samples.git" 8 | }, 9 | "author": "", 10 | "license": "Apache-2.0", 11 | "bugs": { 12 | "url": "https://github.com/firebase/functions-samples/issues" 13 | }, 14 | "engines": { 15 | "npm": ">=9.0.0 <10.0.0", 16 | "node": ">=18.0.0 <=20.0.0" 17 | }, 18 | "homepage": "https://github.com/firebase/functions-samples#readme", 19 | "devDependencies": { 20 | "eslint-config-google": "^0.14.0", 21 | "typescript": "^5.1.6", 22 | "vite": "^4.4.9" 23 | }, 24 | "scripts": { 25 | "dev": "vite", 26 | "build": "vite build", 27 | "format": "prettier --write ." 28 | }, 29 | "dependencies": { 30 | "@firebase/functions": "^0.11.5", 31 | "eslint": "8", 32 | "firebase": "^10.12.1", 33 | "showdown": "^2.1.0" 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /Node/call-vertex-remote-config-server/client/vite-env.d.ts: -------------------------------------------------------------------------------- 1 | /// 2 | -------------------------------------------------------------------------------- /Node/call-vertex-remote-config-server/client/vite.config.js: -------------------------------------------------------------------------------- 1 | import { defineConfig } from 'vite'; 2 | 3 | export default defineConfig({ 4 | base: '', 5 | build: { 6 | rollupOptions: { 7 | input: ['index.html','main.ts'], 8 | }, 9 | }, 10 | logLevel: 'info', 11 | }); 12 | -------------------------------------------------------------------------------- /Node/call-vertex-remote-config-server/firebase.json: -------------------------------------------------------------------------------- 1 | { 2 | "functions": [ 3 | { 4 | "source": "functions", 5 | "codebase": "call-vertex-remote-config-server", 6 | "ignore": [ 7 | "node_modules", 8 | ".git", 9 | "firebase-debug.log", 10 | "firebase-debug.*.log", 11 | "*.local", 12 | "*.bak" 13 | ] 14 | } 15 | ], 16 | "emulators": { 17 | "functions": { 18 | "port": 5001 19 | }, 20 | "ui": { 21 | "enabled": true 22 | }, 23 | "singleProjectMode": true 24 | }, 25 | "hosting": { 26 | "public": "client/dist", 27 | "ignore": [ 28 | "firebase.json", 29 | "**/node_modules/**" 30 | ] 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /Node/call-vertex-remote-config-server/functions/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "call-vertex-remote-config-server", 3 | "description": "An example of a callable function that uses the Admin SDK with server-side Remote Config, App Check, and Vertex AI", 4 | "scripts": { 5 | "serve": "firebase emulators:start --only functions", 6 | "shell": "firebase functions:shell", 7 | "start": "npm run shell", 8 | "deploy": "firebase deploy --only functions", 9 | "logs": "firebase functions:log" 10 | }, 11 | "engines": { 12 | "node": "22" 13 | }, 14 | "main": "index.js", 15 | "dependencies": { 16 | "@google-cloud/vertexai": "^1.2.0", 17 | "cors": "^2.8.5", 18 | "eslint": "8", 19 | "firebase-admin": "^13.0.2", 20 | "firebase-functions": "^6.3.0" 21 | }, 22 | "devDependencies": { 23 | "eslint-config-google": "^0.14.0", 24 | "firebase-functions-test": "^3.4.0" 25 | }, 26 | "private": true 27 | } 28 | -------------------------------------------------------------------------------- /Node/delete-unused-accounts-cron/firebase.json: -------------------------------------------------------------------------------- 1 | { 2 | "functions": { 3 | "codebase": "delete-unused-accounts-cron" 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /Node/delete-unused-accounts-cron/functions/.eslintrc.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2023 Google LLC 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | module.exports = { 18 | root: true, 19 | env: { 20 | es2020: true, 21 | node: true, 22 | }, 23 | extends: [ 24 | "eslint:recommended", 25 | "google", 26 | ], 27 | rules: { 28 | quotes: ["error", "double"], 29 | }, 30 | }; 31 | -------------------------------------------------------------------------------- /Node/delete-unused-accounts-cron/functions/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "delete-unused-accounts-cron-functions", 3 | "description": "Periodically delete unused Firebase accounts", 4 | "dependencies": { 5 | "es6-promise-pool": "^2.5.0", 6 | "firebase-admin": "^13.0.2", 7 | "firebase-functions": "^6.3.0" 8 | }, 9 | "devDependencies": { 10 | "eslint": "^8.57.1", 11 | "eslint-config-google": "^0.14.0" 12 | }, 13 | "scripts": { 14 | "lint": "./node_modules/.bin/eslint --max-warnings=0 .", 15 | "serve": "firebase emulators:start --only functions", 16 | "shell": "firebase functions:shell", 17 | "start": "npm run shell", 18 | "deploy": "firebase deploy --only functions", 19 | "logs": "firebase functions:log", 20 | "compile": "cp ../../../tsconfig.template.json ./tsconfig-compile.json && tsc --project tsconfig-compile.json" 21 | }, 22 | "engines": { 23 | "node": "22" 24 | }, 25 | "private": true 26 | } 27 | -------------------------------------------------------------------------------- /Node/fcm-notifications/database.rules.json: -------------------------------------------------------------------------------- 1 | { 2 | "rules": { 3 | "users": { 4 | ".read": true, 5 | "$uid": { 6 | ".write": "auth.uid === $uid" 7 | } 8 | }, 9 | "followers": { 10 | "$followedUid": { 11 | "$followerUid": { 12 | ".read": "auth.uid === $followerUid", 13 | ".write": "auth.uid === $followerUid" 14 | } 15 | } 16 | } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /Node/fcm-notifications/firebase.json: -------------------------------------------------------------------------------- 1 | { 2 | "database": { 3 | "rules": "database.rules.json" 4 | }, 5 | "hosting": { 6 | "public": "public" 7 | }, 8 | "functions": [ 9 | { 10 | "source": "functions", 11 | "codebase": "fcm-notifications", 12 | "ignore": [ 13 | "node_modules", 14 | ".git", 15 | "firebase-debug.log", 16 | "firebase-debug.*.log" 17 | ], 18 | "predeploy": [ 19 | "npm --prefix \"$RESOURCE_DIR\" run lint" 20 | ] 21 | } 22 | ] 23 | } 24 | -------------------------------------------------------------------------------- /Node/fcm-notifications/functions/.eslintrc.cjs: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | env: { 3 | es2022: true, 4 | node: true, 5 | }, 6 | parserOptions: { 7 | "ecmaVersion": 2022, 8 | "sourceType": "module", 9 | }, 10 | extends: [ 11 | "eslint:recommended", 12 | "google", 13 | ], 14 | rules: { 15 | "no-restricted-globals": ["error", "name", "length"], 16 | "prefer-arrow-callback": "error", 17 | "quotes": ["error", "double", {"allowTemplateLiterals": true}], 18 | }, 19 | overrides: [ 20 | { 21 | files: ["**/*.spec.*"], 22 | env: { 23 | mocha: true, 24 | }, 25 | rules: {}, 26 | }, 27 | ], 28 | globals: {}, 29 | }; 30 | -------------------------------------------------------------------------------- /Node/fcm-notifications/functions/.gitignore: -------------------------------------------------------------------------------- 1 | node_modules/ -------------------------------------------------------------------------------- /Node/fcm-notifications/functions/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "functions", 3 | "description": "Cloud Functions for Firebase", 4 | "scripts": { 5 | "lint": "eslint .", 6 | "serve": "firebase emulators:start --only functions", 7 | "shell": "firebase functions:shell", 8 | "start": "npm run shell", 9 | "deploy": "firebase deploy --only functions", 10 | "logs": "firebase functions:log" 11 | }, 12 | "engines": { 13 | "node": "22" 14 | }, 15 | "main": "index.js", 16 | "type": "module", 17 | "dependencies": { 18 | "firebase-admin": "^13.0.2", 19 | "firebase-functions": "^6.3.0" 20 | }, 21 | "devDependencies": { 22 | "eslint": "^8.57.1", 23 | "eslint-config-google": "^0.14.0", 24 | "firebase-functions-test": "^3.4.0" 25 | }, 26 | "private": true 27 | } 28 | -------------------------------------------------------------------------------- /Node/fcm-notifications/public/firebase-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/firebase/functions-samples/c4fde45b65fab584715e786ce3264a6932d996ec/Node/fcm-notifications/public/firebase-logo.png -------------------------------------------------------------------------------- /Node/fcm-notifications/public/firebase-messaging-sw.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2023 Google LLC 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | // Import and configure the Firebase SDK 18 | // These scripts are made available when the app is served or deployed on Firebase Hosting 19 | // If you do not serve/host your project using Firebase Hosting see https://firebase.google.com/docs/web/setup 20 | importScripts('/__/firebase/10.0.0/firebase-app-compat.js'); 21 | importScripts('/__/firebase/10.0.0/firebase-messaging-compat.js'); 22 | importScripts('/__/firebase/init.js'); 23 | 24 | firebase.messaging(); 25 | -------------------------------------------------------------------------------- /Node/instrument-with-opentelemetry/firebase.json: -------------------------------------------------------------------------------- 1 | { 2 | "functions": { 3 | "source": "functions", 4 | "codebase": "instrument-with-opentelemetry" 5 | }, 6 | "emulators": { 7 | "functions": { 8 | "port": 5001 9 | }, 10 | "firestore": { 11 | "port": 8080 12 | }, 13 | "ui": { 14 | "enabled": true 15 | }, 16 | "singleProjectMode": true 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /Node/instrument-with-opentelemetry/functions/.env: -------------------------------------------------------------------------------- 1 | # This loads the telemetry library before functions framework because 2 | # The Open Telemetry SDK must be the first thing that runs 3 | NODE_OPTIONS=--require=./tracing.js -------------------------------------------------------------------------------- /Node/instrument-with-opentelemetry/functions/.eslintrc.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2023 Google LLC 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | module.exports = { 18 | root: true, 19 | env: { 20 | es2020: true, 21 | node: true, 22 | }, 23 | extends: [ 24 | "eslint:recommended", 25 | "google", 26 | ], 27 | rules: { 28 | quotes: ["error", "double"], 29 | }, 30 | }; 31 | -------------------------------------------------------------------------------- /Node/instrument-with-opentelemetry/functions/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "functions", 3 | "description": "Cloud Functions for Firebase", 4 | "scripts": { 5 | "lint": "eslint .", 6 | "serve": "firebase emulators:start --only functions", 7 | "shell": "firebase functions:shell", 8 | "start": "npm run shell", 9 | "deploy": "firebase deploy --only functions", 10 | "logs": "firebase functions:log" 11 | }, 12 | "engines": { 13 | "node": "22" 14 | }, 15 | "dependencies": { 16 | "@google-cloud/opentelemetry-cloud-trace-exporter": "^1.1.0", 17 | "@google-cloud/opentelemetry-cloud-trace-propagator": "^0.14.0", 18 | "@opentelemetry/api": "^1.2.0", 19 | "@opentelemetry/instrumentation": "^0.33.0", 20 | "@opentelemetry/instrumentation-grpc": "^0.33.0", 21 | "@opentelemetry/instrumentation-http": "^0.33.0", 22 | "@opentelemetry/resource-detector-gcp": "^0.27.3", 23 | "@opentelemetry/sdk-node": "^0.33.0", 24 | "firebase-admin": "^13.0.2", 25 | "firebase-functions": "^6.3.0", 26 | "opentelemetry-instrumentation-express": "^0.29.0" 27 | }, 28 | "private": true, 29 | "devDependencies": { 30 | "eslint": "^8.57.1", 31 | "eslint-config-google": "^0.14.0" 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /Node/instrument-with-opentelemetry/functions/timer.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2023 Google LLC 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | exports.Timer = class { 18 | /** 19 | * 20 | */ 21 | constructor() { 22 | this.start = process.hrtime.bigint(); 23 | } 24 | 25 | /** 26 | * Get the time since this timer was constructed 27 | * @return {string} 28 | */ 29 | measureMs() { 30 | const duration = process.hrtime.bigint() - this.start; 31 | return (duration / 1000000).toString(); 32 | } 33 | }; 34 | -------------------------------------------------------------------------------- /Node/pnpm-workspace.yaml: -------------------------------------------------------------------------------- 1 | packages: 2 | - "./**" -------------------------------------------------------------------------------- /Node/quickstarts/auth-blocking-functions/README.md: -------------------------------------------------------------------------------- 1 | # Firebase SDK for Cloud Functions 2nd Gen Quickstart - Auth Blocking Functions 2 | ================================================ 3 | 4 | The Auth Blocking functions Quickstart demonstrates how to block account sign in and creation when using Firebase Auth or Google Cloud Identity Platform in a Firebase App. 5 | 6 | 7 | - [Read more about auth blocking functions](https://firebase.google.com/docs/auth/extend-with-blocking-functions) 8 | - [Read more about Cloud Functions for Firebase](https://firebase.google.com/docs/functions/) 9 | 10 | 11 | Getting Started 12 | --------------- 13 | 14 | To try this sample, you need a test app with Firebase Auth and Cloud Firestore enabled. Don't use a live app with real users! 15 | 16 | 1. Install dependencies with `npm install` 17 | 2. Deploy the functions with `firebase deploy --only functions` 18 | 3. Try to create an account using an email address with a domain _other than_ `@acme.com`. It should fail. 19 | 4. Add an existing user's email address to the `banned` collection in Cloud Firestore. Then, try to sign in as that user. It should fail. 20 | 21 | 22 | License 23 | ------- 24 | 25 | © Google, 2022. Licensed under an [Apache-2](../../../LICENSE) license. 26 | -------------------------------------------------------------------------------- /Node/quickstarts/auth-blocking-functions/firebase.json: -------------------------------------------------------------------------------- 1 | { 2 | "functions": { 3 | "codebase": "auth-blocking-functions", 4 | "predeploy": [ 5 | "npm --prefix \"$RESOURCE_DIR\" run lint" 6 | ] 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /Node/quickstarts/auth-blocking-functions/functions/.eslintrc.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2023 Google LLC 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | module.exports = { 18 | root: true, 19 | env: { 20 | es2020: true, 21 | node: true, 22 | }, 23 | extends: [ 24 | "eslint:recommended", 25 | "google", 26 | ], 27 | rules: { 28 | quotes: ["error", "double"], 29 | }, 30 | }; 31 | -------------------------------------------------------------------------------- /Node/quickstarts/auth-blocking-functions/functions/.gitignore: -------------------------------------------------------------------------------- 1 | node_modules/ -------------------------------------------------------------------------------- /Node/quickstarts/auth-blocking-functions/functions/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "functions", 3 | "description": "Cloud Functions for Firebase", 4 | "scripts": { 5 | "lint": "eslint .", 6 | "serve": "firebase emulators:start --only functions", 7 | "shell": "firebase functions:shell", 8 | "start": "npm run shell", 9 | "deploy": "firebase deploy --only functions", 10 | "logs": "firebase functions:log" 11 | }, 12 | "engines": { 13 | "node": "22" 14 | }, 15 | "main": "index.js", 16 | "dependencies": { 17 | "firebase-admin": "^13.0.2", 18 | "firebase-functions": "^6.3.0" 19 | }, 20 | "devDependencies": { 21 | "eslint": "^8.57.1", 22 | "eslint-config-google": "^0.14.0", 23 | "firebase-functions-test": "^3.4.0" 24 | }, 25 | "private": true 26 | } 27 | -------------------------------------------------------------------------------- /Node/quickstarts/callable-functions-streaming/README.md: -------------------------------------------------------------------------------- 1 | Firebase HTTPS Callable functions streaming quickstart 2 | ================================================ 3 | 4 | This quickstart demonstrates how to send requests to a server-side function and _stream_ a response to a client SDK. 5 | 6 | [Read more about Cloud Functions for Firebase](https://firebase.google.com/docs/functions/) 7 | 8 | 9 | Getting Started 10 | --------------- 11 | 12 | 1. Install dependencies with `npm install` 13 | 1. Start the hosting and functions emulators with `firebase emulators:start --only functions,hosting` 14 | 1. Visit the url of the emulated Hosting site, and click "Get forecasts" 15 | 16 | License 17 | ------- 18 | 19 | © Google, 2025. Licensed under an [Apache-2](../../../LICENSE) license. 20 | -------------------------------------------------------------------------------- /Node/quickstarts/callable-functions-streaming/firebase.json: -------------------------------------------------------------------------------- 1 | { 2 | "functions": { 3 | "codebase": "callable-functions", 4 | "predeploy": [ 5 | "npm --prefix \"$RESOURCE_DIR\" run lint" 6 | ] 7 | }, 8 | "hosting": { 9 | "public": "website" 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /Node/quickstarts/callable-functions-streaming/functions/.eslintrc.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2023 Google LLC 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | module.exports = { 18 | root: true, 19 | env: { 20 | es2020: true, 21 | node: true, 22 | }, 23 | extends: [ 24 | "eslint:recommended", 25 | "google", 26 | ], 27 | rules: { 28 | quotes: ["error", "double"], 29 | }, 30 | }; 31 | -------------------------------------------------------------------------------- /Node/quickstarts/callable-functions-streaming/functions/.gitignore: -------------------------------------------------------------------------------- 1 | node_modules/ -------------------------------------------------------------------------------- /Node/quickstarts/callable-functions-streaming/functions/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "callable-functions-streaming", 3 | "description": "Cloud Functions for Firebase", 4 | "scripts": { 5 | "lint": "eslint .", 6 | "lintfix": "eslint . --fix", 7 | "serve": "firebase emulators:start --only functions", 8 | "shell": "firebase functions:shell", 9 | "start": "npm run shell", 10 | "deploy": "firebase deploy --only functions", 11 | "logs": "firebase functions:log", 12 | "compile": "cp ../../../../tsconfig.template.json ./tsconfig-compile.json && tsc --project tsconfig-compile.json" 13 | }, 14 | "engines": { 15 | "node": "22" 16 | }, 17 | "main": "index.js", 18 | "dependencies": { 19 | "firebase-admin": "^13.0.2", 20 | "firebase-functions": "^6.3.1" 21 | }, 22 | "devDependencies": { 23 | "eslint": "^8.57.1", 24 | "eslint-config-google": "^0.14.0", 25 | "firebase-functions-test": "^3.4.0" 26 | }, 27 | "private": true 28 | } 29 | -------------------------------------------------------------------------------- /Node/quickstarts/callable-functions/README.md: -------------------------------------------------------------------------------- 1 | Firebase HTTPS Callable functions Quickstart 2 | ================================================ 3 | 4 | The HTTPS Callable functions Quickstart demonstrates how to send requests to a server-side function and get a response back using one of the Client SDKs. It interoperates with the Web, iOS and Android quickstarts. 5 | 6 | 7 | [Read more about Cloud Functions for Firebase](https://firebase.google.com/docs/functions/) 8 | 9 | 10 | Getting Started 11 | --------------- 12 | 13 | 1. Install dependencies with `npm install` and deploy with `firebase deploy --only functions` 14 | 1. Set up a client (import the functions client SDK, initializeApp, init the functions sdk) 15 | 2. Call the function 16 | 17 | 18 | License 19 | ------- 20 | 21 | © Google, 2022. Licensed under an [Apache-2](../../../LICENSE) license. 22 | -------------------------------------------------------------------------------- /Node/quickstarts/callable-functions/firebase.json: -------------------------------------------------------------------------------- 1 | { 2 | "functions": { 3 | "codebase": "callable-functions", 4 | "predeploy": [ 5 | "npm --prefix \"$RESOURCE_DIR\" run lint" 6 | ] 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /Node/quickstarts/callable-functions/functions/.eslintrc.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2023 Google LLC 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | module.exports = { 18 | root: true, 19 | env: { 20 | es2020: true, 21 | node: true, 22 | }, 23 | extends: [ 24 | "eslint:recommended", 25 | "google", 26 | ], 27 | rules: { 28 | quotes: ["error", "double"], 29 | }, 30 | }; 31 | -------------------------------------------------------------------------------- /Node/quickstarts/callable-functions/functions/.gitignore: -------------------------------------------------------------------------------- 1 | node_modules/ -------------------------------------------------------------------------------- /Node/quickstarts/callable-functions/functions/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "functions", 3 | "description": "Cloud Functions for Firebase", 4 | "scripts": { 5 | "lint": "eslint .", 6 | "lintfix": "eslint . --fix", 7 | "serve": "firebase emulators:start --only functions", 8 | "shell": "firebase functions:shell", 9 | "start": "npm run shell", 10 | "deploy": "firebase deploy --only functions", 11 | "logs": "firebase functions:log", 12 | "compile": "cp ../../../../tsconfig.template.json ./tsconfig-compile.json && tsc --project tsconfig-compile.json" 13 | }, 14 | "engines": { 15 | "node": "22" 16 | }, 17 | "main": "index.js", 18 | "dependencies": { 19 | "bad-words": "^3.0.4", 20 | "capitalize-sentence": "^0.1.5", 21 | "firebase-admin": "^13.0.2", 22 | "firebase-functions": "^6.3.0" 23 | }, 24 | "devDependencies": { 25 | "eslint": "^8.57.1", 26 | "eslint-config-google": "^0.14.0", 27 | "firebase-functions-test": "^3.4.0" 28 | }, 29 | "private": true 30 | } 31 | -------------------------------------------------------------------------------- /Node/quickstarts/custom-events/ README.md: -------------------------------------------------------------------------------- 1 | Firebase Custom Events sample 2 | ================================================ 3 | 4 | A custom event trigger function that handles `firebase.extensions.storage-resize-images.v1.complete` and adds custom workflow. 5 | 6 | 7 | Getting Started 8 | --------------- 9 | 10 | 1. Install the [Resize Images 11 | ](https://firebase.google.com/products/extensions/firebase-storage-resize-images) 12 | 1. Install dependencies with `npm install` and deploy with `firebase deploy --only functions` 13 | 1. Upload a test image to the storage bucket configured for the extension. 14 | 15 | License 16 | ------- 17 | 18 | © Google, 2022. Licensed under an [Apache-2](../../../LICENSE) license. -------------------------------------------------------------------------------- /Node/quickstarts/custom-events/firebase.json: -------------------------------------------------------------------------------- 1 | { 2 | "functions": { 3 | "codebase": "custom-events", 4 | "predeploy": [ 5 | "npm --prefix \"$RESOURCE_DIR\" run lint" 6 | ] 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /Node/quickstarts/custom-events/functions/.eslintrc.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2023 Google LLC 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | module.exports = { 18 | root: true, 19 | env: { 20 | es2020: true, 21 | node: true, 22 | }, 23 | extends: [ 24 | "eslint:recommended", 25 | "google", 26 | ], 27 | rules: { 28 | quotes: ["error", "double"], 29 | }, 30 | }; 31 | -------------------------------------------------------------------------------- /Node/quickstarts/custom-events/functions/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "functions-custom-events", 3 | "description": "Custom event handler for Image Resizer extension.", 4 | "scripts": { 5 | "lint": "eslint .", 6 | "lint:fix": "eslint . --fix", 7 | "serve": "firebase emulators:start --only functions", 8 | "shell": "firebase functions:shell", 9 | "start": "npm run shell", 10 | "deploy": "firebase deploy --only functions", 11 | "logs": "firebase functions:log", 12 | "compile": "cp ../../../../tsconfig.template.json ./tsconfig-compile.json && tsc --project tsconfig-compile.json" 13 | }, 14 | "engines": { 15 | "node": "22" 16 | }, 17 | "main": "index.js", 18 | "dependencies": { 19 | "firebase-admin": "^13.0.2", 20 | "firebase-functions": "^6.3.0" 21 | }, 22 | "devDependencies": { 23 | "eslint": "^8.57.1", 24 | "eslint-config-google": "^0.14.0" 25 | }, 26 | "private": true 27 | } 28 | -------------------------------------------------------------------------------- /Node/quickstarts/firestore-sync-auth/firebase.json: -------------------------------------------------------------------------------- 1 | { 2 | "functions": { 3 | "codebase": "firestore-sync-auth" 4 | }, 5 | "firestore": { 6 | "rules": "firestore.rules", 7 | "indexes": "firestore.indexes.json" 8 | }, 9 | "emulators": { 10 | "functions": { 11 | "port": 5001 12 | }, 13 | "firestore": { 14 | "port": 8080 15 | }, 16 | "ui": { 17 | "enabled": true 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /Node/quickstarts/firestore-sync-auth/firestore.indexes.json: -------------------------------------------------------------------------------- 1 | { 2 | "indexes": [], 3 | "fieldOverrides": [] 4 | } 5 | -------------------------------------------------------------------------------- /Node/quickstarts/firestore-sync-auth/firestore.rules: -------------------------------------------------------------------------------- 1 | service cloud.firestore { 2 | match /databases/{database}/documents { 3 | match /comments/{comment} { 4 | // Allow authenticated users to read/write the comments collection 5 | allow read, write: if request.auth != null; 6 | } 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /Node/quickstarts/firestore-sync-auth/functions/.eslintrc.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2023 Google LLC 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | module.exports = { 18 | root: true, 19 | env: { 20 | es2020: true, 21 | node: true, 22 | }, 23 | extends: [ 24 | "eslint:recommended", 25 | "google", 26 | ], 27 | rules: { 28 | quotes: ["error", "double"], 29 | }, 30 | }; 31 | -------------------------------------------------------------------------------- /Node/quickstarts/firestore-sync-auth/functions/.gitignore: -------------------------------------------------------------------------------- 1 | node_modules/ -------------------------------------------------------------------------------- /Node/quickstarts/firestore-sync-auth/functions/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "firestore-sync-auth", 3 | "description": "Cloud Functions for Firebase", 4 | "dependencies": { 5 | "firebase-admin": "^13.0.2", 6 | "firebase-functions": "^6.3.0" 7 | }, 8 | "devDependencies": { 9 | "chai": "^4.3.6", 10 | "chai-as-promised": "^7.1.1", 11 | "eslint": "^8.57.1", 12 | "eslint-config-google": "^0.14.0", 13 | "mocha": "^7.2.0", 14 | "sinon": "^9.2.4" 15 | }, 16 | "scripts": { 17 | "lint": "./node_modules/.bin/eslint --max-warnings=0 .", 18 | "serve": "firebase emulators:start --only functions", 19 | "shell": "firebase functions:shell", 20 | "start": "npm run shell", 21 | "deploy": "firebase deploy --only functions", 22 | "logs": "firebase functions:log", 23 | "compile": "cp ../../../../tsconfig.template.json ./tsconfig-compile.json && tsc --project tsconfig-compile.json" 24 | }, 25 | "engines": { 26 | "node": "22" 27 | }, 28 | "private": true 29 | } 30 | -------------------------------------------------------------------------------- /Node/quickstarts/genkit-helloworld/README.md: -------------------------------------------------------------------------------- 1 | Genkit quickstart 2 | ================================================ 3 | 4 | This quickstart demonstrates how to initialize a [Genkit flow](https://firebase.google.com/docs/genkit/flows) and serve it with Cloud Functions for Firebase. 5 | 6 | [Read more about Cloud Functions for Firebase](https://firebase.google.com/docs/functions/) 7 | 8 | 9 | Getting Started 10 | --------------- 11 | 12 | 1. Install dependencies with `npm install` 13 | 1. Start the functions emulator with `firebase emulators:start --only functions` 14 | 1. The emulator will output the function URL. It is usually of the form: 15 | 16 | ``` 17 | https://127.0.0.1:5001/{$PROJECT}/us-central1/tellJoke 18 | ``` 19 | 20 | 1. Call the function from a terminal, replacing the `url` argument with your function's URL: 21 | 22 | ```bash 23 | $ curl -X POST \ 24 | --url https://127.0.0.1:5001/{$PROJECT}/us-central1/tellJoke \ 25 | --header "Content-Type: application/json" \ 26 | --header "Accept: text/event-stream" \ 27 | --data '{"data": "Observational comedy"}' 28 | ``` 29 | 30 | License 31 | ------- 32 | 33 | © Google, 2025. Licensed under an [Apache-2](../../../LICENSE) license. -------------------------------------------------------------------------------- /Node/quickstarts/genkit-helloworld/firebase.json: -------------------------------------------------------------------------------- 1 | { 2 | "functions": { 3 | "codebase": "oncallgenkit-helloworld", 4 | "predeploy": [ 5 | "npm --prefix \"$RESOURCE_DIR\" run lint" 6 | ] 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /Node/quickstarts/genkit-helloworld/functions/.eslintrc.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2025 Google LLC 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | module.exports = { 18 | root: true, 19 | env: { 20 | es2020: true, 21 | node: true, 22 | }, 23 | extends: [ 24 | "eslint:recommended", 25 | "google", 26 | ], 27 | rules: { 28 | quotes: ["error", "double"], 29 | }, 30 | }; 31 | -------------------------------------------------------------------------------- /Node/quickstarts/genkit-helloworld/functions/.gitignore: -------------------------------------------------------------------------------- 1 | node_modules/ -------------------------------------------------------------------------------- /Node/quickstarts/genkit-helloworld/functions/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "functions", 3 | "description": "Cloud Functions for Firebase", 4 | "scripts": { 5 | "lint": "eslint .", 6 | "lintfix": "eslint . --fix", 7 | "serve": "firebase emulators:start --only functions", 8 | "shell": "firebase functions:shell", 9 | "start": "npm run shell", 10 | "deploy": "firebase deploy --only functions", 11 | "logs": "firebase functions:log", 12 | "compile": "cp ../../../../tsconfig.template.json ./tsconfig-compile.json && tsc --project tsconfig-compile.json" 13 | }, 14 | "engines": { 15 | "node": "22" 16 | }, 17 | "main": "index.js", 18 | "dependencies": { 19 | "@genkit-ai/googleai": "1.0.0-rc.12", 20 | "firebase-admin": "^13.0.2", 21 | "firebase-functions": "^6.3.0", 22 | "genkit": "1.0.0-rc.12" 23 | }, 24 | "devDependencies": { 25 | "eslint": "^8.57.1", 26 | "eslint-config-google": "^0.14.0", 27 | "firebase-functions-test": "^3.4.0" 28 | }, 29 | "private": true 30 | } -------------------------------------------------------------------------------- /Node/quickstarts/https-time-server/firebase.json: -------------------------------------------------------------------------------- 1 | { 2 | "functions": { 3 | "codebase": "https-time-server", 4 | "predeploy": [ 5 | "npm --prefix \"$RESOURCE_DIR\" run lint" 6 | ] 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /Node/quickstarts/https-time-server/functions/.eslintrc.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2023 Google LLC 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | module.exports = { 18 | root: true, 19 | env: { 20 | es2020: true, 21 | node: true, 22 | }, 23 | extends: [ 24 | "eslint:recommended", 25 | "google", 26 | ], 27 | rules: { 28 | quotes: ["error", "double"], 29 | }, 30 | }; 31 | -------------------------------------------------------------------------------- /Node/quickstarts/https-time-server/functions/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "time-server-functions", 3 | "description": "A simple time server using HTTPS Cloud Function", 4 | "dependencies": { 5 | "firebase-admin": "^13.0.2", 6 | "firebase-functions": "^6.3.0", 7 | "moment": "^2.29.4" 8 | }, 9 | "devDependencies": { 10 | "eslint": "^8.57.1", 11 | "eslint-config-google": "^0.14.0" 12 | }, 13 | "scripts": { 14 | "lint": "./node_modules/.bin/eslint --max-warnings=0 .", 15 | "serve": "firebase emulators:start --only functions", 16 | "shell": "firebase functions:shell", 17 | "start": "npm run shell", 18 | "deploy": "firebase deploy --only functions", 19 | "logs": "firebase functions:log", 20 | "compile": "cp ../../../../tsconfig.template.json ./tsconfig-compile.json && tsc --project tsconfig-compile.json" 21 | }, 22 | "engines": { 23 | "node": "22" 24 | }, 25 | "private": true 26 | } 27 | -------------------------------------------------------------------------------- /Node/quickstarts/monitor-cloud-logging/README.md: -------------------------------------------------------------------------------- 1 | # Firebase SDK for Cloud Functions Quickstart - Structured Logs 2 | 3 | This quickstart demonstrates using the **`logger`** subpackage to write structured logs to Cloud Logging. 4 | 5 | Learn more about logging in Cloud Functions for Firebase [in the docs](https://firebase.google.com/docs/functions/writing-and-viewing-logs). 6 | 7 | ## License 8 | 9 | © Google, 2023. Licensed under an [Apache-2](../../../LICENSE) license. -------------------------------------------------------------------------------- /Node/quickstarts/monitor-cloud-logging/firebase.json: -------------------------------------------------------------------------------- 1 | { 2 | "functions": [ 3 | { 4 | "source": "functions", 5 | "codebase": "monitor-cloud-logging", 6 | "ignore": [ 7 | "node_modules", 8 | ".git", 9 | "firebase-debug.log", 10 | "firebase-debug.*.log" 11 | ], 12 | "predeploy": [ 13 | "npm --prefix \"$RESOURCE_DIR\" run lint" 14 | ] 15 | } 16 | ] 17 | } 18 | -------------------------------------------------------------------------------- /Node/quickstarts/monitor-cloud-logging/functions/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "functions", 3 | "description": "Cloud Functions for Firebase", 4 | "scripts": { 5 | "lint": "eslint .", 6 | "serve": "firebase emulators:start --only functions", 7 | "shell": "firebase functions:shell", 8 | "start": "npm run shell", 9 | "deploy": "firebase deploy --only functions", 10 | "logs": "firebase functions:log", 11 | "compile": "cp ../../../../tsconfig.template.json ./tsconfig-compile.json && tsc --project tsconfig-compile.json" 12 | }, 13 | "engines": { 14 | "node": "22" 15 | }, 16 | "main": "index.js", 17 | "dependencies": { 18 | "firebase-admin": "^13.0.2", 19 | "firebase-functions": "^6.3.0" 20 | }, 21 | "devDependencies": { 22 | "eslint": "^8.57.1", 23 | "eslint-config-google": "^0.14.0", 24 | "firebase-functions-test": "^3.4.0" 25 | }, 26 | "private": true 27 | } 28 | -------------------------------------------------------------------------------- /Node/quickstarts/pubsub-helloworld/firebase.json: -------------------------------------------------------------------------------- 1 | { 2 | "functions": { 3 | "codebase": "pubsub-helloworld", 4 | "predeploy": [ 5 | "npm --prefix \"$RESOURCE_DIR\" run lint" 6 | ] 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /Node/quickstarts/pubsub-helloworld/functions/.eslintrc.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2023 Google LLC 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | module.exports = { 18 | root: true, 19 | env: { 20 | es2020: true, 21 | node: true, 22 | }, 23 | extends: [ 24 | "eslint:recommended", 25 | "google", 26 | ], 27 | rules: { 28 | quotes: ["error", "double"], 29 | }, 30 | }; 31 | -------------------------------------------------------------------------------- /Node/quickstarts/pubsub-helloworld/functions/.gitignore: -------------------------------------------------------------------------------- 1 | node_modules/ -------------------------------------------------------------------------------- /Node/quickstarts/pubsub-helloworld/functions/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "functions", 3 | "description": "Cloud Functions for Firebase", 4 | "scripts": { 5 | "lint": "eslint .", 6 | "serve": "firebase emulators:start --only functions", 7 | "shell": "firebase functions:shell", 8 | "start": "npm run shell", 9 | "deploy": "firebase deploy --only functions", 10 | "logs": "firebase functions:log" 11 | }, 12 | "engines": { 13 | "node": "22" 14 | }, 15 | "main": "index.js", 16 | "dependencies": { 17 | "firebase-admin": "^13.0.2", 18 | "firebase-functions": "^6.3.0" 19 | }, 20 | "devDependencies": { 21 | "eslint": "^8.57.1", 22 | "eslint-config-google": "^0.14.0", 23 | "firebase-functions-test": "^3.4.0" 24 | }, 25 | "private": true 26 | } 27 | -------------------------------------------------------------------------------- /Node/quickstarts/testlab-matrix-completed/firebase.json: -------------------------------------------------------------------------------- 1 | { 2 | "functions": { 3 | "codebase": "testlab-matrix-completed" 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /Node/quickstarts/testlab-matrix-completed/functions/.eslintrc.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2023 Google LLC 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | module.exports = { 18 | root: true, 19 | env: { 20 | es2020: true, 21 | node: true, 22 | }, 23 | extends: [ 24 | "eslint:recommended", 25 | "google", 26 | ], 27 | rules: { 28 | quotes: ["error", "double"], 29 | }, 30 | }; 31 | -------------------------------------------------------------------------------- /Node/quickstarts/testlab-matrix-completed/functions/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "functions", 3 | "description": "Cloud Functions for Firebase", 4 | "scripts": { 5 | "lint": "eslint .", 6 | "serve": "firebase emulators:start --only functions", 7 | "shell": "firebase functions:shell", 8 | "start": "npm run shell", 9 | "deploy": "firebase deploy --only functions", 10 | "logs": "firebase functions:log", 11 | "compile": "cp ../../../../tsconfig.template.json ./tsconfig-compile.json && tsc --project tsconfig-compile.json" 12 | }, 13 | "engines": { 14 | "node": "22" 15 | }, 16 | "dependencies": { 17 | "firebase-admin": "^13.0.2", 18 | "firebase-functions": "^6.3.0" 19 | }, 20 | "devDependencies": { 21 | "eslint": "^8.57.1", 22 | "eslint-config-google": "^0.14.0", 23 | "firebase-functions-test": "^3.4.0" 24 | }, 25 | "private": true 26 | } 27 | -------------------------------------------------------------------------------- /Node/quickstarts/thumbnails/firebase.json: -------------------------------------------------------------------------------- 1 | { 2 | "functions": { 3 | "codebase": "thumbnails", 4 | "predeploy": [ 5 | "npm --prefix \"$RESOURCE_DIR\" run lint" 6 | ] 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /Node/quickstarts/thumbnails/functions/.eslintrc.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2023 Google LLC 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | module.exports = { 18 | root: true, 19 | env: { 20 | es2017: true, 21 | node: true, 22 | }, 23 | extends: [ 24 | "eslint:recommended", 25 | "google", 26 | ], 27 | rules: { 28 | quotes: ["error", "double"], 29 | }, 30 | }; 31 | -------------------------------------------------------------------------------- /Node/quickstarts/thumbnails/functions/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "generate-thumbnail-functions-quickstart", 3 | "description": "Generate Thumbnail Firebase Functions sample", 4 | "dependencies": { 5 | "firebase-admin": "^13.0.2", 6 | "firebase-functions": "^6.3.0", 7 | "sharp": "^0.32.1" 8 | }, 9 | "devDependencies": { 10 | "eslint": "^8.57.1", 11 | "eslint-config-google": "^0.14.0" 12 | }, 13 | "scripts": { 14 | "lint": "./node_modules/.bin/eslint --max-warnings=0 .", 15 | "serve": "firebase emulators:start --only functions", 16 | "shell": "firebase functions:shell", 17 | "start": "npm run shell", 18 | "deploy": "firebase deploy --only functions", 19 | "logs": "firebase functions:log", 20 | "compile": "cp ../../../../tsconfig.template.json ./tsconfig-compile.json && tsc --project tsconfig-compile.json" 21 | }, 22 | "engines": { 23 | "node": "22" 24 | }, 25 | "private": true 26 | } 27 | -------------------------------------------------------------------------------- /Node/quickstarts/uppercase-firestore/firebase.json: -------------------------------------------------------------------------------- 1 | { 2 | "functions": { 3 | "codebase": "uppercase-firestore" 4 | }, 5 | "firestore": { 6 | "rules": "firestore.rules", 7 | "indexes": "firestore.indexes.json" 8 | }, 9 | "emulators": { 10 | "functions": { 11 | "port": 5001 12 | }, 13 | "firestore": { 14 | "port": 8080 15 | }, 16 | "ui": { 17 | "enabled": true 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /Node/quickstarts/uppercase-firestore/firestore.indexes.json: -------------------------------------------------------------------------------- 1 | { 2 | "indexes": [], 3 | "fieldOverrides": [] 4 | } 5 | -------------------------------------------------------------------------------- /Node/quickstarts/uppercase-firestore/firestore.rules: -------------------------------------------------------------------------------- 1 | service cloud.firestore { 2 | match /databases/{database}/documents { 3 | match /messages/{message} { 4 | // Allow authenticated users to read/write the messages collection 5 | allow read, write: if request.auth != null; 6 | } 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /Node/quickstarts/uppercase-firestore/functions/.eslintrc.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2023 Google LLC 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | module.exports = { 18 | root: true, 19 | env: { 20 | es2020: true, 21 | node: true, 22 | }, 23 | extends: [ 24 | "eslint:recommended", 25 | "google", 26 | ], 27 | rules: { 28 | quotes: ["error", "double"], 29 | }, 30 | }; 31 | -------------------------------------------------------------------------------- /Node/quickstarts/uppercase-firestore/functions/.gitignore: -------------------------------------------------------------------------------- 1 | node_modules/ -------------------------------------------------------------------------------- /Node/quickstarts/uppercase-firestore/functions/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "functions", 3 | "description": "Cloud Functions for Firebase", 4 | "dependencies": { 5 | "firebase-admin": "^13.0.2", 6 | "firebase-functions": "^6.3.0" 7 | }, 8 | "devDependencies": { 9 | "chai": "^4.3.6", 10 | "chai-as-promised": "^7.1.1", 11 | "eslint": "^8.57.1", 12 | "eslint-config-google": "^0.14.0", 13 | "mocha": "^7.2.0", 14 | "sinon": "^9.2.4" 15 | }, 16 | "scripts": { 17 | "lint": "./node_modules/.bin/eslint --max-warnings=0 .", 18 | "serve": "firebase emulators:start --only functions", 19 | "shell": "firebase functions:shell", 20 | "start": "npm run shell", 21 | "deploy": "firebase deploy --only functions", 22 | "logs": "firebase functions:log", 23 | "compile": "cp ../../../../tsconfig.template.json ./tsconfig-compile.json && tsc --project tsconfig-compile.json" 24 | }, 25 | "engines": { 26 | "node": "22" 27 | }, 28 | "private": true 29 | } 30 | -------------------------------------------------------------------------------- /Node/quickstarts/uppercase-rtdb/database.rules.json: -------------------------------------------------------------------------------- 1 | { 2 | "rules": { 3 | ".read": true, 4 | ".write": true 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /Node/quickstarts/uppercase-rtdb/firebase.json: -------------------------------------------------------------------------------- 1 | { 2 | "functions": { 3 | "codebase": "uppercase-rtdb" 4 | }, 5 | "rulesFile": "database.rules.json", 6 | "emulators": { 7 | "functions": { 8 | "port": 5001 9 | }, 10 | "database": { 11 | "port": 9000 12 | }, 13 | "ui": { 14 | "enabled": true 15 | } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /Node/quickstarts/uppercase-rtdb/functions/.eslintrc.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2023 Google LLC 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | module.exports = { 18 | root: true, 19 | env: { 20 | es2020: true, 21 | node: true, 22 | }, 23 | extends: [ 24 | "eslint:recommended", 25 | "google", 26 | ], 27 | rules: { 28 | quotes: ["error", "double"], 29 | }, 30 | }; 31 | -------------------------------------------------------------------------------- /Node/quickstarts/uppercase-rtdb/functions/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "functions", 3 | "description": "Cloud Functions for Firebase", 4 | "scripts": { 5 | "lint": "eslint .", 6 | "serve": "firebase emulators:start --only functions", 7 | "shell": "firebase functions:shell", 8 | "start": "npm run shell", 9 | "deploy": "firebase deploy --only functions", 10 | "logs": "firebase functions:log" 11 | }, 12 | "engines": { 13 | "node": "22" 14 | }, 15 | "main": "index.js", 16 | "dependencies": { 17 | "firebase-admin": "^13.0.2", 18 | "firebase-functions": "^6.3.0" 19 | }, 20 | "devDependencies": { 21 | "eslint": "^8.57.1", 22 | "eslint-config-google": "^0.14.0", 23 | "firebase-functions-test": "^3.4.0" 24 | }, 25 | "private": true 26 | } 27 | -------------------------------------------------------------------------------- /Node/remote-config-diff/README.md: -------------------------------------------------------------------------------- 1 | ## Get the difference between the previous and current Remote Config templates. 2 | 3 | Use the Firebase Remote Config Cloud Function trigger to take action when your template is updated. 4 | 5 | This sample demonstrates how to use the Remote Config Cloud Function trigger to log the difference between the previous and current Remote Config templates. 6 | 7 | * See [eBay's real world implementation](https://github.com/eBay/firebase-remote-config-monitor). 8 | 9 | * See the [docs](https://firebase.google.com/docs/functions/rc-events) for more on Remote Config Triggers. 10 | -------------------------------------------------------------------------------- /Node/remote-config-diff/firebase.json: -------------------------------------------------------------------------------- 1 | { 2 | "functions": { 3 | "codebase": "remote-config-diff" 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /Node/remote-config-diff/functions/.eslintrc.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2023 Google LLC 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | module.exports = { 18 | root: true, 19 | env: { 20 | es2020: true, 21 | node: true, 22 | }, 23 | extends: [ 24 | "eslint:recommended", 25 | "google", 26 | ], 27 | rules: { 28 | quotes: ["error", "double"], 29 | }, 30 | }; 31 | -------------------------------------------------------------------------------- /Node/remote-config-diff/functions/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "remote-config-diff", 3 | "description": "Get the difference between the previous and current Remote Config template", 4 | "scripts": { 5 | "lint": "eslint .", 6 | "serve": "firebase emulators:start --only functions", 7 | "shell": "firebase functions:shell", 8 | "start": "npm run shell", 9 | "deploy": "firebase deploy --only functions", 10 | "logs": "firebase functions:log", 11 | "compile": "cp ../../../tsconfig.template.json ./tsconfig-compile.json && tsc --project tsconfig-compile.json" 12 | }, 13 | "dependencies": { 14 | "firebase-admin": "^13.0.2", 15 | "firebase-functions": "^6.3.0", 16 | "json-diff": "^0.5.5", 17 | "node-fetch": "^2.6.7" 18 | }, 19 | "devDependencies": { 20 | "eslint": "^8.57.1", 21 | "eslint-config-google": "^0.14.0" 22 | }, 23 | "engines": { 24 | "node": "22" 25 | }, 26 | "private": true 27 | } 28 | -------------------------------------------------------------------------------- /Node/remote-config-server-with-vertex/firebase.json: -------------------------------------------------------------------------------- 1 | { 2 | "functions": { 3 | "codebase": "remote-config-server-with-vertex" 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /Node/remote-config-server-with-vertex/functions/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "remote-config-server-with-vertex", 3 | "description": "Cloud Functions for Firebase", 4 | "scripts": { 5 | "serve": "firebase emulators:start --only functions", 6 | "shell": "firebase functions:shell", 7 | "start": "npm run shell", 8 | "deploy": "firebase deploy --only functions", 9 | "logs": "firebase functions:log" 10 | }, 11 | "engines": { 12 | "node": "22" 13 | }, 14 | "main": "index.js", 15 | "dependencies": { 16 | "@google-cloud/vertexai": "^1.1.0", 17 | "eslint": "8", 18 | "firebase-admin": "^13.0.2", 19 | "firebase-functions": "^6.3.0" 20 | }, 21 | "devDependencies": { 22 | "eslint-config-google": "^0.14.0", 23 | "firebase-functions-test": "^3.4.0" 24 | }, 25 | "private": true 26 | } 27 | -------------------------------------------------------------------------------- /Node/taskqueues-backup-images/firebase.json: -------------------------------------------------------------------------------- 1 | { 2 | "functions": { 3 | "codebase": "taskqueues-backup-images" 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /Node/taskqueues-backup-images/functions/.eslintrc.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2023 Google LLC 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | module.exports = { 18 | root: true, 19 | env: { 20 | es2022: true, 21 | node: true, 22 | }, 23 | extends: [ 24 | "eslint:recommended", 25 | "google", 26 | ], 27 | rules: { 28 | quotes: ["error", "double"], 29 | }, 30 | }; 31 | -------------------------------------------------------------------------------- /Node/taskqueues-backup-images/functions/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "functions-taskqueues-backup-images", 3 | "description": "Back up images from NASA's Astronomy Picture of the Day using Cloud Tasks.", 4 | "scripts": { 5 | "lint": "eslint .", 6 | "lint:fix": "eslint . --fix", 7 | "serve": "firebase emulators:start --only functions", 8 | "shell": "firebase functions:shell", 9 | "start": "npm run shell", 10 | "deploy": "firebase deploy --only functions", 11 | "logs": "firebase functions:log", 12 | "compile": "cp ../../../tsconfig.template.json ./tsconfig-compile.json && tsc --project tsconfig-compile.json" 13 | }, 14 | "engines": { 15 | "node": "22" 16 | }, 17 | "main": "index.js", 18 | "dependencies": { 19 | "firebase-admin": "^13.0.2", 20 | "firebase-functions": "^6.3.0", 21 | "google-auth-library": "^8.6.0", 22 | "node-fetch": "^2.6.7" 23 | }, 24 | "devDependencies": { 25 | "eslint": "^8.57.1", 26 | "eslint-config-google": "^0.14.0" 27 | }, 28 | "private": true 29 | } 30 | -------------------------------------------------------------------------------- /Node/test-functions-jest-ts/README.md: -------------------------------------------------------------------------------- 1 | # Firebase Functions Test (with jest-ts) - Quickstart 2 | 3 | This quickstart demonstrates how to run unit tests on gen-2 functions. 4 | 5 | ## Setting up the sample 6 | 7 | 1. Clone or download this repo and open the `2nd-gen/test-functions-jest-ts` 8 | directory. 9 | 1. Install Cloud Functions dependencies locally by running: 10 | `cd functions; npm install; cd -` 11 | 12 | ## Test 13 | 14 | 1. Run your unit test with `npm test`. 15 | 16 | ## Next Steps 17 | 18 | Write your own functions using a testing-framework that best fits your use case. 19 | -------------------------------------------------------------------------------- /Node/test-functions-jest-ts/firebase.json: -------------------------------------------------------------------------------- 1 | { 2 | "functions": { 3 | "codebase": "test-functions-jest-ts", 4 | "predeploy": [ 5 | "npm --prefix \"$RESOURCE_DIR\" run lint", 6 | "npm --prefix \"$RESOURCE_DIR\" run build" 7 | ] 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /Node/test-functions-jest-ts/functions/.gitignore: -------------------------------------------------------------------------------- 1 | # Compiled JavaScript files 2 | lib/**/*.js 3 | lib/**/*.js.map 4 | 5 | # TypeScript v1 declaration files 6 | typings/ 7 | 8 | # Node.js dependency directory 9 | node_modules/ 10 | -------------------------------------------------------------------------------- /Node/test-functions-jest-ts/functions/jest.config.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2023 Google LLC 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | /** @type {import('ts-jest/dist/types').InitialOptionsTsJest} */ 18 | module.exports = { 19 | preset: 'ts-jest', 20 | testEnvironment: 'node', 21 | }; -------------------------------------------------------------------------------- /Node/test-functions-jest-ts/functions/src/index.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2023 Google LLC 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | import {logger} from "firebase-functions"; 18 | import {onObjectFinalized} from "firebase-functions/v2/storage"; 19 | 20 | export const logstore = onObjectFinalized("my-bucket", (cloudEvent) => { 21 | logger.log(cloudEvent); 22 | }); 23 | -------------------------------------------------------------------------------- /Node/test-functions-jest-ts/functions/tsconfig.dev.json: -------------------------------------------------------------------------------- 1 | { 2 | "include": [ 3 | ".eslintrc.js" 4 | ] 5 | } 6 | -------------------------------------------------------------------------------- /Node/test-functions-jest-ts/functions/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "module": "commonjs", 4 | "esModuleInterop": true, 5 | "noImplicitReturns": true, 6 | "noUnusedLocals": true, 7 | "outDir": "lib", 8 | "sourceMap": true, 9 | "strict": true, 10 | "target": "es2017" 11 | }, 12 | "compileOnSave": true, 13 | "include": [ 14 | "src" 15 | ] 16 | } 17 | -------------------------------------------------------------------------------- /Node/test-functions-jest/README.md: -------------------------------------------------------------------------------- 1 | # Firebase Functions Test (with jest) - Quickstart 2 | 3 | This quickstart demonstrates how to run unit tests on gen-2 functions. 4 | 5 | ## Setting up the sample 6 | 7 | 1. Clone or download this repo and open the `2nd-gen/test-functions-jest` 8 | directory. 9 | 1. Install Cloud Functions dependencies locally by running: 10 | `cd functions; npm install; cd -` 11 | 12 | ## Test 13 | 14 | 1. Run your unit test with `npm test`. 15 | 16 | ## Next Steps 17 | 18 | Write your own functions using a testing-framework that best fits your use case. 19 | -------------------------------------------------------------------------------- /Node/test-functions-jest/firebase.json: -------------------------------------------------------------------------------- 1 | { 2 | "functions": { 3 | "codebase": "test-functions-jest", 4 | "predeploy": [ 5 | "npm --prefix \"$RESOURCE_DIR\" run lint" 6 | ], 7 | "source": "functions" 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /Node/test-functions-jest/functions/.eslintrc.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2023 Google LLC 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | module.exports = { 18 | root: true, 19 | env: { 20 | es2017: true, 21 | node: true, 22 | jest: true, 23 | }, 24 | extends: [ 25 | "eslint:recommended", 26 | "google", 27 | ], 28 | rules: { 29 | quotes: ["error", "double"], 30 | }, 31 | }; 32 | -------------------------------------------------------------------------------- /Node/test-functions-jest/functions/.gitignore: -------------------------------------------------------------------------------- 1 | node_modules/ -------------------------------------------------------------------------------- /Node/test-functions-jest/functions/index.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2023 Google LLC 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | const {logger} = require("firebase-functions"); 18 | const {onObjectFinalized} = require("firebase-functions/v2/storage"); 19 | 20 | exports.logstore = onObjectFinalized("my-bucket", (cloudEvent) => { 21 | logger.log(cloudEvent); 22 | }); 23 | -------------------------------------------------------------------------------- /Node/test-functions-jest/functions/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "test-functions", 3 | "scripts": { 4 | "lint": "eslint --ext .js,.ts .", 5 | "build": "tsc", 6 | "serve": "npm run build && firebase emulators:start --only functions", 7 | "shell": "npm run build && firebase functions:shell", 8 | "start": "npm run shell", 9 | "test": "jest", 10 | "deploy": "firebase deploy --only functions", 11 | "logs": "firebase functions:log", 12 | "compile": "cp ../../../tsconfig.template.json ./tsconfig-compile.json && tsc --project tsconfig-compile.json" 13 | }, 14 | "engines": { 15 | "node": "22" 16 | }, 17 | "main": "index.js", 18 | "dependencies": { 19 | "firebase-admin": "^13.0.2", 20 | "firebase-functions": "^6.3.0" 21 | }, 22 | "devDependencies": { 23 | "@types/jest": "^27.5.2", 24 | "eslint": "^8.57.1", 25 | "eslint-config-google": "^0.14.0", 26 | "firebase-functions-test": "^3.4.0", 27 | "jest": "^28.1.3" 28 | }, 29 | "private": true 30 | } 31 | -------------------------------------------------------------------------------- /Node/test-functions-mocha/README.md: -------------------------------------------------------------------------------- 1 | # Firebase Functions Test (with mocha) - Quickstart 2 | 3 | This quickstart demonstrates how to run unit tests on Cloud Functions (2nd gen). 4 | 5 | ## Setting up the sample 6 | 7 | 1. Clone or download this repo and open the `2nd-gen/test-functions-mocha` 8 | directory. 9 | 1. Install Cloud Functions dependencies locally by running: 10 | `cd functions; npm install; cd -` 11 | 12 | ## Test 13 | 14 | 1. Run your unit test with `npm test`. 15 | 16 | ## Next Steps 17 | 18 | Write your own functions using a testing-framework that best fits your use case. 19 | -------------------------------------------------------------------------------- /Node/test-functions-mocha/firebase.json: -------------------------------------------------------------------------------- 1 | { 2 | "functions": { 3 | "codebase": "test-functions-mocha", 4 | "predeploy": [ 5 | "npm --prefix \"$RESOURCE_DIR\" run lint" 6 | ], 7 | "source": "functions" 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /Node/test-functions-mocha/functions/.eslintrc.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2023 Google LLC 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | module.exports = { 18 | root: true, 19 | env: { 20 | es2017: true, 21 | node: true, 22 | jest: true, 23 | }, 24 | extends: [ 25 | "eslint:recommended", 26 | "google", 27 | ], 28 | rules: { 29 | quotes: ["error", "double"], 30 | }, 31 | }; 32 | -------------------------------------------------------------------------------- /Node/test-functions-mocha/functions/.gitignore: -------------------------------------------------------------------------------- 1 | node_modules/ -------------------------------------------------------------------------------- /Node/test-functions-mocha/functions/index.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2023 Google LLC 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | const {logger} = require("firebase-functions"); 18 | const {onObjectFinalized} = require("firebase-functions/v2/storage"); 19 | 20 | exports.logstore = onObjectFinalized("my-bucket", (cloudEvent) => { 21 | logger.log(cloudEvent); 22 | }); 23 | -------------------------------------------------------------------------------- /Node/test-functions-mocha/functions/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "functions", 3 | "scripts": { 4 | "lint": "eslint --ext .js,.ts .", 5 | "build": "", 6 | "serve": "npm run build && firebase emulators:start --only functions", 7 | "shell": "npm run build && firebase functions:shell", 8 | "start": "npm run shell", 9 | "test": "mocha *.test.js", 10 | "deploy": "firebase deploy --only functions", 11 | "logs": "firebase functions:log", 12 | "compile": "cp ../../../tsconfig.template.json ./tsconfig-compile.json && tsc --project tsconfig-compile.json" 13 | }, 14 | "engines": { 15 | "node": "22" 16 | }, 17 | "main": "index.js", 18 | "dependencies": { 19 | "firebase-admin": "^13.0.2", 20 | "firebase-functions": "^6.3.0" 21 | }, 22 | "devDependencies": { 23 | "@types/mocha": "^9.1.1", 24 | "chai": "^4.3.6", 25 | "eslint": "^8.57.1", 26 | "eslint-config-google": "^0.14.0", 27 | "eslint-plugin-import": "^2.26.0", 28 | "firebase-functions-test": "^3.4.0", 29 | "mocha": "^10.1.0", 30 | "sinon": "^13.0.2" 31 | }, 32 | "private": true 33 | } 34 | -------------------------------------------------------------------------------- /Node/testlab-to-slack/firebase.json: -------------------------------------------------------------------------------- 1 | { 2 | "functions": { 3 | "codebase": "testlab-to-slack" 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /Node/testlab-to-slack/functions/.eslintrc.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2023 Google LLC 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | module.exports = { 18 | root: true, 19 | env: { 20 | es2020: true, 21 | node: true, 22 | }, 23 | extends: [ 24 | "eslint:recommended", 25 | "google", 26 | ], 27 | rules: { 28 | quotes: ["error", "double"], 29 | }, 30 | }; 31 | -------------------------------------------------------------------------------- /Node/testlab-to-slack/functions/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "functions", 3 | "description": "Cloud Functions for Firebase", 4 | "scripts": { 5 | "lint": "eslint .", 6 | "serve": "firebase emulators:start --only functions", 7 | "shell": "firebase functions:shell", 8 | "start": "npm run shell", 9 | "deploy": "firebase deploy --only functions", 10 | "logs": "firebase functions:log", 11 | "compile": "cp ../../../tsconfig.template.json ./tsconfig-compile.json && tsc --project tsconfig-compile.json" 12 | }, 13 | "engines": { 14 | "node": "22" 15 | }, 16 | "dependencies": { 17 | "firebase-admin": "^13.0.2", 18 | "firebase-functions": "^6.3.0", 19 | "node-fetch": "^2.0.0" 20 | }, 21 | "devDependencies": { 22 | "eslint": "^8.57.1", 23 | "eslint-config-google": "^0.14.0", 24 | "firebase-functions-test": "^3.4.0" 25 | }, 26 | "private": true 27 | } 28 | -------------------------------------------------------------------------------- /Python/.gitignore: -------------------------------------------------------------------------------- 1 | venv -------------------------------------------------------------------------------- /Python/README.md: -------------------------------------------------------------------------------- 1 | # Python (2nd gen) samples 2 | 3 | > Note: Python support in Cloud Functions for Firebase is a public preview. This means that the functionality might change in backward-incompatible ways. A preview release is not subject to any SLA or deprecation policy and may receive limited or no support. 4 | 5 | This folder contains examples for Python functions. See a description of all samples in this folder in the [root README](../README.md). -------------------------------------------------------------------------------- /Python/alerts-to-discord/README.md: -------------------------------------------------------------------------------- 1 | # alerts-to-discord 2 | -------------------------------------------------------------------------------- /Python/alerts-to-discord/firebase.json: -------------------------------------------------------------------------------- 1 | { 2 | "functions": { 3 | "codebase": "alerts-to-discord" 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /Python/alerts-to-discord/functions/requirements.txt: -------------------------------------------------------------------------------- 1 | firebase-functions 2 | requests 3 | -------------------------------------------------------------------------------- /Python/delete-unused-accounts-cron/README.md: -------------------------------------------------------------------------------- 1 | # delete-unused-accounts-cron 2 | -------------------------------------------------------------------------------- /Python/delete-unused-accounts-cron/firebase.json: -------------------------------------------------------------------------------- 1 | { 2 | "functions": { 3 | "codebase": "delete-unused-accounts-cron" 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /Python/delete-unused-accounts-cron/functions/requirements.txt: -------------------------------------------------------------------------------- 1 | firebase-functions 2 | firebase-admin 3 | -------------------------------------------------------------------------------- /Python/fcm-notifications/database.rules.json: -------------------------------------------------------------------------------- 1 | { 2 | "rules": { 3 | "users": { 4 | ".read": true, 5 | "$uid": { 6 | ".write": "auth.uid === $uid" 7 | } 8 | }, 9 | "followers": { 10 | "$followedUid": { 11 | "$followerUid": { 12 | ".read": "auth.uid === $followerUid", 13 | ".write": "auth.uid === $followerUid" 14 | } 15 | } 16 | } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /Python/fcm-notifications/firebase.json: -------------------------------------------------------------------------------- 1 | { 2 | "database": { 3 | "rules": "database.rules.json" 4 | }, 5 | "hosting": { 6 | "public": "public" 7 | }, 8 | "functions": [ 9 | { 10 | "source": "functions", 11 | "codebase": "fcm-notifications", 12 | "ignore": [ 13 | "venv", 14 | ".git", 15 | "firebase-debug.log", 16 | "firebase-debug.*.log" 17 | ] 18 | } 19 | ] 20 | } 21 | -------------------------------------------------------------------------------- /Python/fcm-notifications/functions/.gitignore: -------------------------------------------------------------------------------- 1 | __pycache__ 2 | venv -------------------------------------------------------------------------------- /Python/fcm-notifications/functions/requirements.txt: -------------------------------------------------------------------------------- 1 | firebase_functions~=0.1.0 -------------------------------------------------------------------------------- /Python/fcm-notifications/public/firebase-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/firebase/functions-samples/c4fde45b65fab584715e786ce3264a6932d996ec/Python/fcm-notifications/public/firebase-logo.png -------------------------------------------------------------------------------- /Python/fcm-notifications/public/firebase-messaging-sw.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2023 Google LLC 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | // Import and configure the Firebase SDK 18 | // These scripts are made available when the app is served or deployed on Firebase Hosting 19 | // If you do not serve/host your project using Firebase Hosting see https://firebase.google.com/docs/web/setup 20 | importScripts('/__/firebase/10.0.0/firebase-app-compat.js'); 21 | importScripts('/__/firebase/10.0.0/firebase-messaging-compat.js'); 22 | importScripts('/__/firebase/init.js'); 23 | 24 | firebase.messaging(); 25 | -------------------------------------------------------------------------------- /Python/http-flask/README.md: -------------------------------------------------------------------------------- 1 | # http-flask 2 | -------------------------------------------------------------------------------- /Python/http-flask/firebase.json: -------------------------------------------------------------------------------- 1 | { 2 | "functions": { 3 | "codebase": "http-flask" 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /Python/http-flask/functions/requirements.txt: -------------------------------------------------------------------------------- 1 | firebase-admin 2 | firebase-functions 3 | flask 4 | -------------------------------------------------------------------------------- /Python/post-signup-event/README.md: -------------------------------------------------------------------------------- 1 | # post-signup-event 2 | -------------------------------------------------------------------------------- /Python/post-signup-event/firebase.json: -------------------------------------------------------------------------------- 1 | { 2 | "functions": { 3 | "codebase": "post-signup-event" 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /Python/post-signup-event/functions/requirements.txt: -------------------------------------------------------------------------------- 1 | firebase-functions 2 | firebase-admin 3 | google-auth 4 | google-api-python-client 5 | google-cloud-tasks 6 | -------------------------------------------------------------------------------- /Python/pyproject.toml: -------------------------------------------------------------------------------- 1 | # Copyright 2023 Google Inc. All Rights Reserved. 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | [project] 16 | name = "functions_samples" 17 | version = "1.0.0" 18 | [tool.yapf] 19 | based_on_style = "google" 20 | column_limit = 100 21 | [tool.mypy] 22 | python_version = "3.10" -------------------------------------------------------------------------------- /Python/quickstarts/auth-blocking-functions/README.md: -------------------------------------------------------------------------------- 1 | # auth-blocking-functions 2 | -------------------------------------------------------------------------------- /Python/quickstarts/auth-blocking-functions/firebase.json: -------------------------------------------------------------------------------- 1 | { 2 | "functions": { 3 | "codebase": "auth-blocking-functions" 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /Python/quickstarts/auth-blocking-functions/functions/requirements.txt: -------------------------------------------------------------------------------- 1 | firebase-functions 2 | firebase-admin 3 | -------------------------------------------------------------------------------- /Python/quickstarts/callable-functions/README.md: -------------------------------------------------------------------------------- 1 | # callable-functions 2 | -------------------------------------------------------------------------------- /Python/quickstarts/callable-functions/firebase.json: -------------------------------------------------------------------------------- 1 | { 2 | "functions": { 3 | "codebase": "callable-functions" 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /Python/quickstarts/callable-functions/functions/requirements.txt: -------------------------------------------------------------------------------- 1 | firebase-functions 2 | firebase-admin 3 | -------------------------------------------------------------------------------- /Python/quickstarts/custom-events/README.md: -------------------------------------------------------------------------------- 1 | # custom-events 2 | -------------------------------------------------------------------------------- /Python/quickstarts/custom-events/firebase.json: -------------------------------------------------------------------------------- 1 | { 2 | "functions": { 3 | "codebase": "custom-events" 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /Python/quickstarts/custom-events/functions/requirements.txt: -------------------------------------------------------------------------------- 1 | firebase-functions 2 | firebase-admin 3 | -------------------------------------------------------------------------------- /Python/quickstarts/firestore-sync-auth/README.md: -------------------------------------------------------------------------------- 1 | # uppercase-firestore 2 | -------------------------------------------------------------------------------- /Python/quickstarts/firestore-sync-auth/firebase.json: -------------------------------------------------------------------------------- 1 | { 2 | "functions": { 3 | "codebase": "firestore-sync-auth" 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /Python/quickstarts/firestore-sync-auth/functions/requirements.txt: -------------------------------------------------------------------------------- 1 | firebase-functions 2 | firebase-admin 3 | -------------------------------------------------------------------------------- /Python/quickstarts/https-time-server/README.md: -------------------------------------------------------------------------------- 1 | # https-time-server 2 | -------------------------------------------------------------------------------- /Python/quickstarts/https-time-server/firebase.json: -------------------------------------------------------------------------------- 1 | { 2 | "functions": { 3 | "codebase": "https-time-server" 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /Python/quickstarts/https-time-server/functions/requirements.txt: -------------------------------------------------------------------------------- 1 | firebase-functions 2 | -------------------------------------------------------------------------------- /Python/quickstarts/monitor-cloud-logging/firebase.json: -------------------------------------------------------------------------------- 1 | { 2 | "functions": [ 3 | { 4 | "source": "functions", 5 | "codebase": "monitor-cloud-logging", 6 | "ignore": [ 7 | "venv", 8 | ".git", 9 | "firebase-debug.log", 10 | "firebase-debug.*.log" 11 | ] 12 | } 13 | ] 14 | } 15 | -------------------------------------------------------------------------------- /Python/quickstarts/monitor-cloud-logging/functions/requirements.txt: -------------------------------------------------------------------------------- 1 | firebase_functions~=0.1.2 -------------------------------------------------------------------------------- /Python/quickstarts/pubsub-helloworld/README.md: -------------------------------------------------------------------------------- 1 | # pubsub-helloworld 2 | -------------------------------------------------------------------------------- /Python/quickstarts/pubsub-helloworld/firebase.json: -------------------------------------------------------------------------------- 1 | { 2 | "functions": { 3 | "codebase": "pubsub-helloworld" 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /Python/quickstarts/pubsub-helloworld/functions/requirements.txt: -------------------------------------------------------------------------------- 1 | firebase-functions 2 | -------------------------------------------------------------------------------- /Python/quickstarts/uppercase-firestore/README.md: -------------------------------------------------------------------------------- 1 | # uppercase-firestore 2 | -------------------------------------------------------------------------------- /Python/quickstarts/uppercase-firestore/firebase.json: -------------------------------------------------------------------------------- 1 | { 2 | "functions": { 3 | "codebase": "uppercase-firestore" 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /Python/quickstarts/uppercase-firestore/functions/requirements.txt: -------------------------------------------------------------------------------- 1 | firebase-functions 2 | firebase-admin 3 | -------------------------------------------------------------------------------- /Python/quickstarts/uppercase-rtdb/README.md: -------------------------------------------------------------------------------- 1 | # uppercase-rtdb 2 | -------------------------------------------------------------------------------- /Python/quickstarts/uppercase-rtdb/firebase.json: -------------------------------------------------------------------------------- 1 | { 2 | "functions": { 3 | "codebase": "uppercase-rtdb" 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /Python/quickstarts/uppercase-rtdb/functions/requirements.txt: -------------------------------------------------------------------------------- 1 | firebase-functions 2 | firebase-admin 3 | -------------------------------------------------------------------------------- /Python/remote-config-diff/README.md: -------------------------------------------------------------------------------- 1 | # remote-config-diff 2 | -------------------------------------------------------------------------------- /Python/remote-config-diff/firebase.json: -------------------------------------------------------------------------------- 1 | { 2 | "functions": { 3 | "codebase": "remote-config-diff" 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /Python/remote-config-diff/functions/requirements.txt: -------------------------------------------------------------------------------- 1 | firebase-functions 2 | firebase-admin 3 | deepdiff 4 | requests 5 | -------------------------------------------------------------------------------- /Python/requirements.txt: -------------------------------------------------------------------------------- 1 | yapf~=0.40.2 2 | -------------------------------------------------------------------------------- /Python/taskqueues-backup-images/README.md: -------------------------------------------------------------------------------- 1 | # taskqueues-backup-images 2 | -------------------------------------------------------------------------------- /Python/taskqueues-backup-images/firebase.json: -------------------------------------------------------------------------------- 1 | { 2 | "functions": { 3 | "codebase": "taskqueues-backup-images" 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /Python/taskqueues-backup-images/functions/requirements.txt: -------------------------------------------------------------------------------- 1 | firebase-functions 2 | firebase-admin 3 | google-auth 4 | google-cloud-tasks 5 | requests 6 | -------------------------------------------------------------------------------- /Python/testlab-to-slack/README.md: -------------------------------------------------------------------------------- 1 | # testlab-to-slack 2 | -------------------------------------------------------------------------------- /Python/testlab-to-slack/firebase.json: -------------------------------------------------------------------------------- 1 | { 2 | "functions": { 3 | "codebase": "testlab-to-slack" 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /Python/testlab-to-slack/functions/requirements.txt: -------------------------------------------------------------------------------- 1 | firebase-functions 2 | requests 3 | -------------------------------------------------------------------------------- /Python/thumbnails/README.md: -------------------------------------------------------------------------------- 1 | # thumbnails 2 | -------------------------------------------------------------------------------- /Python/thumbnails/firebase.json: -------------------------------------------------------------------------------- 1 | { 2 | "functions": { 3 | "codebase": "thumbnails" 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /Python/thumbnails/functions/requirements.txt: -------------------------------------------------------------------------------- 1 | firebase-functions 2 | firebase-admin 3 | pillow 4 | -------------------------------------------------------------------------------- /community.md: -------------------------------------------------------------------------------- 1 | # Community Samples 2 | 3 | Check out these awesome samples built by the Firebase Community! 4 | 5 | To add your own, use the following template: 6 | 7 | ```md 8 | ### [Emoji replacer](https://link-to-sample-source-code.com) 9 | 10 | Use Cloud Functions to replace common words with emojis! 11 | 12 | **Author:** @jhuleatt 13 | ``` 14 | --------------------------------------------------------------------------------