MVFC.Aspire.Helpers.GcpFirestore
10.1.0
dotnet add package MVFC.Aspire.Helpers.GcpFirestore --version 10.1.0
NuGet\Install-Package MVFC.Aspire.Helpers.GcpFirestore -Version 10.1.0
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="MVFC.Aspire.Helpers.GcpFirestore" Version="10.1.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="MVFC.Aspire.Helpers.GcpFirestore" Version="10.1.0" />
<PackageReference Include="MVFC.Aspire.Helpers.GcpFirestore" />
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add MVFC.Aspire.Helpers.GcpFirestore --version 10.1.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: MVFC.Aspire.Helpers.GcpFirestore, 10.1.0"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package MVFC.Aspire.Helpers.GcpFirestore@10.1.0
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=MVFC.Aspire.Helpers.GcpFirestore&version=10.1.0
#tool nuget:?package=MVFC.Aspire.Helpers.GcpFirestore&version=10.1.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
MVFC.Aspire.Helpers.GcpFirestore
Helpers for integrating with Google Cloud Firestore in .NET Aspire projects, including support for the emulator.
Motivation
Working with Google Cloud Firestore locally usually means:
- Spinning up an emulator container by hand.
- Remembering ports, project IDs and environment variables.
- Manually configuring readiness checks for the emulator.
With .NET Aspire you can define containers, but you still need to:
- Configure the emulator image and its ports.
- Keep emulator environment variables in sync across projects.
- Define project configurations in a consistent way before the application runs.
MVFC.Aspire.Helpers.GcpFirestore provides:
AddGcpFirestore(...)to start the emulator.WithFirestoreConfigs(...)to describe project configurations in code.WithReference(...)to wire projects to the emulator and inject connection configurations automatically.
Overview
This project facilitates the configuration and integration of Google Cloud Firestore in distributed .NET Aspire applications, providing extension methods to:
- Add the Google Cloud Firestore emulator.
- Configure project IDs automatically upon startup.
- Properly inject the emulator host connection string for automatic detection by Firestore clients.
Firestore emulator advantages
- Simulates Firestore databases locally for development and testing.
- Allows testing data operations without depending on Google Cloud infrastructure.
- Facilitates development of robust data storage implementations.
Compatible Images
- Emulator:
mtlynch/firestore-emulator(Default in Aspire helper)
Project Structure
MVFC.Aspire.Helpers.GcpFirestore: Helpers and extensions library for Firestore.
Features
- Adds the Google Cloud Firestore emulator.
- Configures project IDs according to configuration.
- Native TCP port health checks ensure the emulator is fully ready before projects start consuming it.
- Extension methods to facilitate AppHost configuration.
Installation
dotnet add package MVFC.Aspire.Helpers.GcpFirestore
Quick Aspire usage (AppHost)
using Aspire.Hosting;
using MVFC.Aspire.Helpers.GcpFirestore;
using MVFC.Aspire.Helpers.GcpFirestore.Models;
var builder = DistributedApplication.CreateBuilder(args);
var firestoreConfig = new FirestoreConfig(
projectId: "test-project");
var firestore = builder.AddGcpFirestore("gcp-firestore")
.WithFirestoreConfigs(firestoreConfig);
builder.AddProject<Projects.MVFC_Aspire_Helpers_Playground_Api>("api-example")
.WithReference(firestore)
.WaitFor(firestore);
await builder.Build().RunAsync();
Emulated Resources Configuration
FirestoreConfig
| Parameter | Type | Default | Description |
|---|---|---|---|
projectId |
string | — | GCP project ID used by Firestore. |
Ports
- HTTP Port:
8084(mapped to internal port8080in the container)
Provisioning diagram
sequenceDiagram
participant Aspire as .NET Aspire
participant Container as Firestore Emulator Container
participant Configurator as Config Processor
Aspire->>Container: Start container (mtlynch/firestore-emulator)
Container-->>Aspire: Ready (HTTP port 8084 available)
Aspire->>Configurator: Trigger OnResourceReady
Configurator-->>Aspire: Provisioning Completed
Aspire->>App: Start App with FIRESTORE_EMULATOR_HOST
Public methods
AddGcpFirestore– adds the emulator container.WithFirestoreConfigs– configures project IDs.WithDockerImage– replaces the Docker image used by the resource.WithReference– wires projects to the emulator and sets theFIRESTORE_EMULATOR_HOSTenvironment variable automatically.
Requirements
- .NET 9+
- Aspire.Hosting >= 13.5.3
- Docker running locally
- Google.Cloud.Firestore >= 4.4.0
License
Apache-2.0
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net9.0 is compatible. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
net10.0
- Aspire.Hosting (>= 13.5.3)
- Google.Cloud.Firestore (>= 4.4.0)
- Microsoft.Extensions.Diagnostics.HealthChecks (>= 10.0.11)
-
net9.0
- Aspire.Hosting (>= 13.5.3)
- Google.Cloud.Firestore (>= 4.4.0)
- Microsoft.Extensions.Diagnostics.HealthChecks (>= 10.0.11)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.