You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

firestore-cli

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

firestore-cli

A lightweight command-line interface for interacting with Google Firestore, Firebase, and Google Cloud APIs. Streamline document management, queries, and administrative tasks directly from your terminal. **Note** This project is currently in its infancy!

1.0.8
latest
npmnpm
Version published
Maintainers
1
Created
Source

Firestore CLI (Still In Development) - README

A lightweight command-line interface for interacting with Google Firestore, Firebase, and Google Cloud APIs. Streamline document management, queries, and administrative tasks directly from your terminal. Note This project is currently in its infancy! Expect things not to work or breaking changes. I am open to suggestions and feedback, thank you.

🔑 Authentication Setup

This tool requires a Service Account Key for API access. Here’s how to obtain credentials:

Method 1: Google Cloud Console (Web UI)

  • Go to Google Cloud Console.
  • Select your project → Navigate to IAM & AdminService Accounts.
  • Create a Service Account:
    • Click + Create Service Account.
    • Name it (e.g., firestore-cli), assign Firestore Admin/Editor roles.
  • Generate Key:
    • Under Actions (⋮), click Manage KeysAdd KeyCreate New Key.
    • Choose JSON → Download the file (e.g., service-account.json).

Method 2: Firebase Console

  • Go to Firebase Console.
  • Select your project → Click ⚙️ (Settings) → Project settings.
  • Navigate to Service Accounts:
    • Go to Service accounts tab.
  • Generate Key:
    • Click Generate new private key → Confirm → Download JSON file.
    • (Uses default Firebase service account with Editor permissions)

Method 3: Google Cloud CLI (gcloud)

  • Install the Google Cloud SDK.

  • Authenticate and configure:

    gcloud auth login
    gcloud config set project YOUR_PROJECT_ID
    
  • Create Service Account and Key:

    gcloud iam service-accounts create firestore-cli \
      --display-name="Firestore CLI Service Account"
    
    gcloud projects add-iam-policy-binding YOUR_PROJECT_ID \
      --member="serviceAccount:firestore-cli@YOUR_PROJECT_ID.iam.gserviceaccount.com" \
      --role="roles/datastore.user"
    
    gcloud iam service-accounts keys create service-account.json \
      --iam-account=firestore-cli@YOUR_PROJECT_ID.iam.gserviceaccount.com
    

Configure the CLI

Set your environment variable to point to the key:

export GOOGLE_APPLICATION_CREDENTIALS="/path/to/service-account.json"

(Add this to your shell profile (e.g., .bashrc, .zshrc) for persistence)

🚀 Installation

npm install -g firestore-cli  # Requires Node.js v16+

💻 Basic Usage

firestore-cli [command] [options]

Commands

CommandDescriptionExample
get <doc-path>Fetch a documentfirestore-cli get users/alice
set <doc-path>Create/update a document (JSON)firestore-cli set products/laptop '{price: 999}'
query <collection>Run a Firestore queryfirestore-cli query orders --where "status==='shipped'"
delete <doc-path>Delete a documentfirestore-cli delete inventory/old-item
export <path>Export data to JSONfirestore-cli export backups/ --all-collections

Options

  • --project <id>: Specify a Google Cloud project ID.
  • --emulator: Connect to a local Firestore emulator (default port: 8080).
  • --debug: Enable verbose logging.

🔒 Security Notes

  • Never commit service-account.json to version control! Add it to .gitignore.
  • Use least-privilege roles (e.g., roles/datastore.user instead of roles/owner).
  • For production, leverage secret managers (e.g., GCP Secret Manager).

🛠️ Development

Contribute or extend functionality:

git clone https://github.com/your-repo/firestore-cli.git
cd firestore-cli
npm install
npm link  # Test locally

Need Help?
Run firestore-cli --help or open an issue.

Built with ❤️ by Daniel Nyong | MIT License.

FAQs

Package last updated on 16 Jun 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts