# Firebase CLI
> Deploy and manage Firebase projects from the terminal

## Summary
Deploy and manage Firebase projects from the terminal. Deploy to Hosting, manage Cloud Functions, configure Firestore rules, and run the full Firebase Emulator Suite for local development.

## Capabilities
- Deploy static sites and web apps to Firebase Hosting
- Deploy and manage Cloud Functions for Firebase
- Configure and deploy Firestore security rules and indexes
- Run the Firebase Emulator Suite for local development and testing
- Manage Firebase project settings and service accounts
- Initialize new Firebase projects with guided setup

## When to Use
- Deploying web apps or static sites to Firebase Hosting
- Developing and deploying Cloud Functions
- Testing Firebase services locally with emulators
- Managing Firestore security rules and indexes
- Need a complete BaaS local development environment

## When NOT to Use
- Not using Firebase or Google Cloud (use Supabase, AWS Amplify, etc.)
- Need custom server infrastructure (use flyctl, Heroku, or cloud provider CLIs)
- Managing non-Firebase GCP resources (use gcloud instead)

## Key Flags
- `deploy`: Deploy the project to Firebase (Hosting, Functions, Rules, etc.)
- `emulators:start`: Start the Firebase Emulator Suite for local development
- `init`: Initialize a new Firebase project in the current directory
- `serve`: Start a local server for Firebase Hosting content
- `deploy --only functions`: Deploy only Cloud Functions, skipping other services

## Usage Patterns
### Initialize a Firebase project
```
firebase init hosting functions firestore
```
Sets up Hosting, Functions, and Firestore in the current directory

### Deploy everything
```
firebase deploy
```
Deploys Hosting, Functions, Firestore rules, and all configured services

### Start local emulators
```
firebase emulators:start
```
Starts local emulators for Auth, Firestore, Functions, and Hosting

### Deploy only functions
```
firebase deploy --only functions:myFunction
```
Deploys a single Cloud Function without touching other services

## Input / Output
- **stdin**: Not typically used
- **stdout**: Deployment URLs, emulator status, and project information

## Installation
- **npm**: `npm i -g firebase-tools`

## Related Tools
- [supabase](/tools/supabase) (alternative): Supabase is an open-source Firebase alternative with Postgres
- [gcloud](/tools/gcloud) (complementary): gcloud manages broader GCP resources; firebase focuses on Firebase services
- [vercel](/tools/vercel) (alternative): Vercel for frontend deployments; Firebase for full BaaS with hosting

---
Source: https://littlescripts.sh/tools/firebase-cli
