Skip to main content

Deploying to Firebase

Backend API Server

Deploy it to Firebase Cloud Functions.

~/fullstack $ firebase deploy --only functions

Output of deployment.

=== Deploying to '<YOUR PROJECT UNIQUE ID>'...

i deploying functions
Running command: npm --prefix "$RESOURCE_DIR" run lint

> lint
> eslint --ext .js,.ts .

Running command: npm --prefix "$RESOURCE_DIR" run build

> build
> tsc

✔ functions: Finished running predeploy script.
i functions: preparing codebase default for deployment
i functions: ensuring required API cloudfunctions.googleapis.com is enabled...
i functions: ensuring required API cloudbuild.googleapis.com is enabled...
i artifactregistry: ensuring required API artifactregistry.googleapis.com is enabled...
✔ functions: required API cloudfunctions.googleapis.com is enabled
✔ artifactregistry: required API artifactregistry.googleapis.com is enabled
✔ functions: required API cloudbuild.googleapis.com is enabled
i functions: Loading and analyzing source code for codebase default to determine what to deploy
Serving at port 8188

i functions: Loaded environment variables from .env.
i functions: preparing functions directory for uploading...
i functions: packaged /home/user/fullstack1/function (195.16 KB) for uploading
✔ functions: functions folder uploaded successfully
i functions: updating Node.js 18 (1st Gen) function api(us-central1)...
✔ functions[api(us-central1)] Successful update operation.
Function URL (api(us-central1)): https://us-central1-<YOUR_PROJECT_UNIQUE_ID>.cloudfunctions.net/api
i functions: cleaning up build files...

✔ Deploy complete!

Project Console: https://console.firebase.google.com/project/<YOUR PROJECT UNIQUE ID>/overview

Frontend Client

Deploy it to Firebase hosting.

~/fullstack $ firebase deploy --only hosting:production

Output of deployment.


=== Deploying to '<YOUR PROJECT UNIQUE ID>'...

i deploying hosting
i hosting[<YOUR PROJECT UNIQUE ID>]: beginning deploy...
i hosting[<YOUR PROJECT UNIQUE ID>]: found 3 files in frontend/prod
✔ hosting[<YOUR PROJECT UNIQUE ID>]: file upload complete
i hosting[<YOUR PROJECT UNIQUE ID>]: finalizing version...
✔ hosting[<YOUR PROJECT UNIQUE ID>]: version finalized
i hosting[<YOUR PROJECT UNIQUE ID>]: releasing new version...
✔ hosting[<YOUR PROJECT UNIQUE ID>]: release complete

✔ Deploy complete!

Project Console: https://console.firebase.google.com/project/<YOUR PROJECT UNIQUE ID>/overview
Hosting URL: https://<YOUR PROJECT UNIQUE ID>.web.app

~/fullstack $

Seeding the data for mock login

curl https://<YOUR PROJECT UNIQUE ID>.web.app/api/dbseed

Output after dbseed.

Done!
~/fullstack $

Check the Firestore console to confirm seeding was successful.

Screenshot of firestore with seeded data

We can now browse to the https://<YOUR PROJECT UNIQUE ID>.web.app to see our deployed application.

Note that the current environment configuration uses Mock login.

Screenshot of remote frontend using mock login