firestore-cli-rust

Crates.iofirestore-cli-rust
lib.rsfirestore-cli-rust
version0.2.0
created_at2025-11-13 22:36:19.926762+00
updated_at2025-12-07 16:47:33.421864+00
descriptionBasic Rust local CLI tool to Firestore
homepage
repositoryhttps://github.com/xbill9/gemini-cli-codeassist
max_upload_size
id1931964
size101,428
xbill (xbill9)

documentation

README

Firestore Client Rust

This is a Rust command-line interface (CLI) application designed for basic interaction with Google Cloud Firestore. It provides a simple way to manage product data within a Firestore collection named "inventory".

Features

  • Seed Database: Populate your Firestore "inventory" collection with sample product data.
  • List Products: Retrieve and display all products currently stored in the "inventory" collection.
  • Get Product by ID: Fetch a specific product from the "inventory" collection using its unique ID.

Technologies Used

  • Rust: The programming language.
  • Google Cloud Firestore: NoSQL document database.
  • firestore crate: Rust client library for Firestore.
  • tokio: Asynchronous runtime for Rust.
  • serde: Serialization and deserialization framework.
  • clap: Command-line argument parser.
  • anyhow: Flexible error handling.
  • dotenv: Loads environment variables from a .env file.
  • tracing: Application-level tracing for observability.

Setup and Usage

Prerequisites

  • Rust and Cargo installed.
  • Google Cloud Project with Firestore enabled.
  • Service Account Key for Firestore authentication (usually handled by gcloud auth application-default login or GOOGLE_APPLICATION_CREDENTIALS environment variable).

Environment Variables

Create a .env file in the project root with your Google Cloud Project ID:

PROJECT_ID=your-gcp-project-id

Building the Application

cargo build --release

Running Commands

Seed the database

cargo run --release seed

List all products

cargo run --release list

Get a product by ID

Replace <product_id> with the actual ID of a product.

cargo run --release get <product_id>

Project Structure

  • src/main.rs: Contains the main application logic, including product data structures, Firestore interaction functions, and CLI command handling.
  • Cargo.toml: Defines project dependencies and metadata.
  • Cargo.lock: Records the exact versions of dependencies.

License

This project is licensed under the MIT OR Apache-2.0 License. See the Cargo.toml file for more details.

Commit count: 0

cargo fmt