CHAPTER 26
Beginner
Angular with Firebase
Updated: May 18, 2026
5 min read
# CHAPTER 26
Angular with Firebase
1. Chapter Introduction
Firebase is Google's Backend-as-a-Service (BaaS) platform that provides authentication, a real-time NoSQL database (Firestore), cloud functions, and hosting — all without writing a single line of backend code. Combined with Angular, it allows a solo developer or small team to build full-stack, production-ready apps incredibly fast.2. Learning Objectives
- Set up a Firebase project and install AngularFire.
- Implement Firebase Authentication (email/password, Google Sign-In).
- Perform CRUD operations with Firestore.
- Deploy an Angular app to Firebase Hosting.
- Build a Firebase-powered Todo App.
3. Firebase Setup
bash
app.config.ts
4. Firebase Authentication
auth.service.ts
html
5. Firestore CRUD Operations
todo.service.ts
todo.component.ts
html
6. Firebase Hosting Deployment
bash
Your app will be live at https://YOURPROJECTID.web.app!
7. Common Mistakes
- Exposing Firebase config in public repos: The Firebase config IS safe to expose (it's not secret), but always configure Firebase Security Rules in the Firebase Console to restrict who can read/write your database.
- Not configuring Firestore Security Rules: By default, after 30 days, new Firestore databases require authentication. Always configure rules before going to production.
8. MCQs with Answers
Question 1
What is Firebase?
Question 2
What is the AngularFire library?
Question 3
What type of database is Firestore?
Question 4
What does collectionData() return?
Question 5
What function adds a new document to a Firestore collection?
Question 6
What function deletes a Firestore document?
Question 7
What function partially updates a Firestore document?
Question 8
What CLI tool is used to deploy an Angular app to Firebase Hosting?
Question 9
After running firebase init, what Angular command must you run before firebase deploy?
Question 10
Is the Firebase firebaseConfig object (with apiKey) safe to expose in client-side code?
9. Interview Questions
- Q: What is the difference between Firebase Authentication and Firestore?
- Q: How does Firestore's real-time Observable work? How is it different from a standard HTTP GET request?