---
title: Firebase Storage
description: Firebase Cloud Storage via the official firebase-admin SDK. Underlying client is @google-cloud/storage, so V4 signed URLs and POST policy uploads come for free.
related:
  - /guides/firebase-storage-authenticated-uploads
---

## Installation

`firebase-admin` is an optional peer dependency of `files-sdk` - install alongside the SDK so the adapter's imports resolve at runtime.

```package-install
files-sdk firebase-admin
```

## Usage

Firebase Cloud Storage via the official `firebase-admin` SDK. The Admin SDK's `getStorage().bucket()` returns a `@google-cloud/storage` `Bucket` under the hood, so every primitive (server-side copy, V4 signed URLs, POST policy uploads) maps onto the GCS surface - with Firebase-flavoured credential conventions and a default bucket name derived from your project ID.

```ts lineNumbers
import { Files } from "files-sdk";
import { firebaseStorage } from "files-sdk/firebase-storage";

const files = new Files({
  adapter: firebaseStorage({
    bucket: "my-project.firebasestorage.app",
    // Credentials, first match wins: `app` (an existing firebase-admin
    // App or @google-cloud/storage Bucket), `serviceAccountPath`,
    // `credentials`, GOOGLE_APPLICATION_CREDENTIALS (any ADC file:
    // service account, workload identity, authorized_user),
    // FIREBASE_CLIENT_EMAIL + FIREBASE_PRIVATE_KEY, then ambient
    // Application Default Credentials (gcloud auth, GCE metadata).
    // The project comes from `projectId` or FIREBASE_PROJECT_ID.
  }),
});
```

`upload` reports true byte-level [progress](/docs/api/upload#progress-tracking) via `onProgress`. As with GCS, passing `onProgress` switches the upload to a **resumable** request (the only path that emits progress), which adds one round trip.

## Options

<AutoTypeTable
  path="../../packages/files-sdk/src/firebase-storage/index.ts"
  name="FirebaseStorageAdapterOptions"
/>

## Limitations

Firebase's `?alt=media&token=...` download-token URL form is out of scope for v1 - `url()` always returns either a V4 signed read URL or your configured `publicBaseUrl`. Reach for `adapter.raw` (the underlying `@google-cloud/storage` `Bucket`) if you need to mint Firebase download tokens or use any GCS-side feature that isn't in the unified API. A stream upload without `onProgress` or `multipart` goes out as a single streaming request; pass `multipart` (or `onProgress`) for a chunked resumable upload, or `control` for a [pause-able upload](/docs/api/upload#pause-and-resume) whose session can be resumed later.

## Compatibility

| Method | Status | Notes |
| --- | :-: | --- |
| `upload` | ✅ |  |
| `download` | ✅ |  |
| `delete` | ✅ |  |
| `list` | ✅ |  |
| `search` | ✅ |  |
| `head` | ✅ |  |
| `exists` | ✅ |  |
| `copy` | ✅ |  |
| `url` | ✅ | V4 signed URL, or your `publicBaseUrl` (no expiry). V4 signing caps `expiresIn` at 7 days (604800 seconds), so a longer one (or `defaultUrlExpiresIn`) throws `Invalid` before any request; `capabilities.signedUrl.maxExpiresIn` reports the cap, and the gateway clamps to it. |
| `signedUploadUrl` | ✅ | V4 signed PUT URL, or a V4 POST policy when `maxSize` is set - same 7-day `expiresIn` cap. |
