> ## Documentation Index
> Fetch the complete documentation index at: https://docs.deploybaseline.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Official emulators

> Run Firebase, Azure Blob Storage, and Google Cloud Pub/Sub through their vendors' local emulators next to Baseline

Some services already ship an official local emulator that their SDKs know how to reach. Baseline does not reimplement those. Run the vendor's emulator next to Baseline instead: you get the vendor's own fidelity, and Baseline covers the services that have no local option.

| Service | Official emulator | How the SDK finds it |
| - | - | - |
| Firebase Auth, Firestore, Storage | [Firebase Local Emulator Suite](https://firebase.google.com/docs/emulator-suite) | `FIREBASE_AUTH_EMULATOR_HOST`, `FIRESTORE_EMULATOR_HOST`, `FIREBASE_STORAGE_EMULATOR_HOST` |
| Azure Blob Storage | [Azurite](https://github.com/Azure/Azurite) | Connection string `UseDevelopmentStorage=true` |
| Google Cloud Pub/Sub | [Pub/Sub emulator](https://cloud.google.com/pubsub/docs/emulator) in the gcloud CLI | `PUBSUB_EMULATOR_HOST` |

Google Cloud Storage has no official emulator, so it is on Baseline's own roadmap. For gRPC services in general, see [WebSockets](/websockets.md#other-transports).

## Firebase

The Emulator Suite needs the Firebase CLI and a Java runtime (see Firebase's install guide for the minimum JDK version). Initialize the emulators you want once:

```bash theme={null}
npx firebase-tools init emulators
```

Then point the Admin SDK at them. The Admin SDK reads these variables and skips real credentials when they are set:

```bash theme={null}
FIREBASE_AUTH_EMULATOR_HOST=127.0.0.1:9099
FIRESTORE_EMULATOR_HOST=127.0.0.1:8080
FIREBASE_STORAGE_EMULATOR_HOST=127.0.0.1:9199
GCLOUD_PROJECT=demo-baseline
```

A project id starting with `demo-` tells the Firebase tools that no real project exists, so nothing can reach production. In the browser SDK, call `connectAuthEmulator`, `connectFirestoreEmulator`, and `connectStorageEmulator` instead.

## Azure Blob Storage

Azurite is an npm package, so it needs nothing but Node:

```bash theme={null}
npx azurite --silent --location .azurite
```

Blob storage listens on port 10000 (queues on 10001, tables on 10002). `@azure/storage-blob` connects with the well known development connection string:

```ts theme={null}
import { BlobServiceClient } from "@azure/storage-blob";

const blobs = BlobServiceClient.fromConnectionString(
  process.env.AZURE_STORAGE_CONNECTION_STRING ?? "UseDevelopmentStorage=true",
);
```

## Google Cloud Pub/Sub

The Pub/Sub emulator ships with the gcloud CLI (`gcloud components install pubsub-emulator`) and also needs Java:

```bash theme={null}
gcloud beta emulators pubsub start --project=demo-baseline --host-port=127.0.0.1:8085
```

`@google-cloud/pubsub` connects to it when `PUBSUB_EMULATOR_HOST` is set:

```bash theme={null}
PUBSUB_EMULATOR_HOST=127.0.0.1:8085
PUBSUB_PROJECT_ID=demo-baseline
```

The emulator keeps topics and subscriptions in memory only, so create them at the start of each test run.

## Running them together

Start everything from one `package.json` script with `concurrently`. Baseline serves the providers in `baseline.config.json`, and each official emulator serves its own:

```json baseline.config.json theme={null}
{
  "github": {},
  "google": {},
  "stripe": {}
}
```

```json theme={null}
{
  "scripts": {
    "emulators": "concurrently -n baseline,firebase,azurite,pubsub \"baseline start\" \"firebase emulators:start --project demo-baseline\" \"azurite --silent --location .azurite\" \"gcloud beta emulators pubsub start --project=demo-baseline --host-port=127.0.0.1:8085\""
  }
}
```

Keep the variables in one `.env.test` so your app sees Baseline's URLs and the official emulators' hosts together:

```bash theme={null}
# Baseline providers (default ports; the variable names are whatever your app reads)
GITHUB_API_URL=http://localhost:4001
GOOGLE_API_URL=http://localhost:4002
STRIPE_API_URL=http://localhost:4009

# Official emulators
FIREBASE_AUTH_EMULATOR_HOST=127.0.0.1:9099
FIRESTORE_EMULATOR_HOST=127.0.0.1:8080
FIREBASE_STORAGE_EMULATOR_HOST=127.0.0.1:9199
AZURE_STORAGE_CONNECTION_STRING=UseDevelopmentStorage=true
PUBSUB_EMULATOR_HOST=127.0.0.1:8085
GCLOUD_PROJECT=demo-baseline
```

Baseline's `--state` and snapshots cover Baseline's services only. The Firebase Emulator Suite has its own `--import` and `--export-on-exit`, and Azurite keeps its data in the `--location` folder.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.