firebase
**Firebase**
- Google's App Development Platform
**Overview**
Firebase is a Backend-as-a-Service (BaaS) platform by Google. It provides a comprehensive suite of tools (Database, Auth, Storage, hosting) that scale automatically, allowing developers to build apps without managing servers.
**Core Products**
**1. Authentication**
Drop-in support for Google, Facebook, Apple, and Email login. Handles sessions and security tokens.
**2. Firestore (NoSQL Database)**
Real-time, scalable document database.
- **Real-time listeners**: Clients receive updates instantly when data changes.
- **Offline support**: Apps work without internet and sync later.
**3. Cloud Functions**
Serverless backend code.
- Trigger on DB write: "When a user is created, send a welcome email."
- HTTP triggers: Build an API.
**4. Hosting**
Fast, secure hosting for web apps (global CDN).
**Code Example (Web)**
```javascript
import { initializeApp } from "firebase/app";
import { getFirestore, collection, addDoc } from "firebase/firestore";
const app = initializeApp(firebaseConfig);
const db = getFirestore(app);
// Add data
await addDoc(collection(db, "users"), {
first: "Ada",
last: "Lovelace",
born: 1815
});
```
**Vendor Lock-in**
The main downside of Firebase is that it is proprietary. Migrating *away* from Firebase (especially Firestore/Auth) is difficult compared to open standards like SQL.