Setup Google/Firebase Cloud Functions Using Node

Feb 14, 2020

Create Firebase Project

Setup Node.js Environment

NOTE: This tutorials setup Firebase Functions without Firebase Hosting. If you wanted both, refer to Setup Firebase Hosting and Functions (Node).

Install Firebase CLI

npm install -g firebase-tools

Setup Firebase CLI

firebase login

Create project directory.


Setup Cloud Functions

firebase init functions
What language would you like to use to write Cloud Functions? JavaScript
? Do you want to use ESLint to catch probable bugs and enforce style? No
✔  Wrote functions/package.json
✔  Wrote functions/index.js
✔  Wrote functions/.gitignore
? Do you want to install dependencies with npm now? Yes

Create Cloud Functions

cd functions

Edit index.js.

const functions = require('firebase-functions');exports.hello = functions.https.onRequest(async (request, response) => {  const name =;  response.send(`Hello ${name}`)})

Test Local Development

npm run serve

Access: http://localhost:5000/PROJECT/us-central1/hello?name=Desmond


npm run deploy


firebase deploy --only functions

Deploy specific functions only

firebase deploy --only functions:hello


❤️ Is this article helpful?

Buy me a coffee ☕ or support my work via PayPal to keep this space 🖖 and ad-free.

Do send some 💖 to @d_luaz or share this article.

✨ By Desmond Lua

A dream boy who enjoys making apps, travelling and making youtube videos. Follow me on @d_luaz

👶 Apps I built

Travelopy - discover travel places in Malaysia, Singapore, Taiwan, Japan.