Skip to content

Firebase and Serverless

Serverless doesn’t mean there are no servers - it means you don’t have to manage them. Instead of provisioning, scaling, and maintaining servers yourself, cloud providers handle all of that for you.

Benefits of Serverless:

  • No server management - Focus on code, not infrastructure
  • Auto-scaling - Automatically scales up/down based on demand
  • Pay per use - Only pay for actual execution time
  • Faster deployment - Deploy functions in seconds

Firebase is Google’s Backend-as-a-Service (BaaS) platform. It provides a suite of tools for building web and mobile applications:

ServiceDescription
Cloud FunctionsServerless functions that run your backend code
FirestoreNoSQL document database
HostingFast, secure static hosting
AuthenticationUser authentication service
StorageFile storage for user-generated content

You can see all video playlist for Week 3 here: https://screenpal.com/channels/c0fvXvVYvQ

Learn how to set up a Firebase project and understand the Firebase Console.

Key concepts covered:

  • Creating a Firebase project
  • Navigating the Firebase Console
  • Understanding project settings and configurations

Cloud Functions for Firebase lets you run backend code in response to events triggered by Firebase features and HTTPS requests. Your code is stored in Google’s cloud and runs in a managed environment.

Key concepts covered:

  • Setting up Firebase CLI
  • Writing your first Cloud Function
  • Deploying functions to Firebase
  • Understanding function triggers (HTTP, Firestore, Pub/Sub)

Learn how to integrate the KoaJS framework you learned in Week 1 with Firebase Cloud Functions. This allows you to use familiar routing patterns and middleware in a serverless environment.

Key concepts covered:

  • Wrapping KoaJS app in a Firebase Function
  • Using koa-router with Cloud Functions
  • Handling middleware in serverless context

Firebase Hosting provides fast and secure hosting for your web app, static and dynamic content. It’s where we deploy our React applications.

Key concepts covered:

  • Deploying static files to Firebase Hosting
  • Configuring firebase.json for hosting
  • Setting up custom domains
  • Understanding CDN and caching

Cloud Firestore is a flexible, scalable NoSQL cloud database. Unlike traditional SQL databases, Firestore stores data in documents organized into collections.

Key concepts covered:

  • Documents and Collections structure
  • CRUD operations (Create, Read, Update, Delete)
  • Querying data with where, orderBy, limit
  • Real-time listeners
  • Understanding NoSQL data modeling

After this Firestore lesson, your exercise would be to change the repository of the todo app we have been working on so far to Firestore instead of saving and loading data from file.

Requirements:

  1. Create a Firestore collection called todos
  2. Migrate all CRUD operations from file-based storage to Firestore
  3. Each todo should be a document with fields: id, title, completed, createdAt
  4. Test all API endpoints still work correctly