Google Cloud Storage Adapter

Connect Igniter Storage to Google Cloud Storage buckets with public delivery.

Credentials and Environment

Use a service account JSON (file path or base64) plus bucket details. Set env vars or pass credentials directly.

Prop

Type

Minimal Setup

import { IgniterStorage } from "@igniter-js/storage";

export const storage = IgniterStorage.create()
  .withAdapter("google", {
    bucket: process.env.IGNITER_STORAGE_GOOGLE_BUCKET!,
    region: process.env.IGNITER_STORAGE_GOOGLE_REGION,
    endpoint: process.env.IGNITER_STORAGE_GOOGLE_ENDPOINT,
    credentialsJson: process.env.IGNITER_STORAGE_GOOGLE_CREDENTIALS_JSON,
    credentialsJsonBase64:
      process.env.IGNITER_STORAGE_GOOGLE_CREDENTIALS_JSON_BASE64,
  })
  .withUrl(process.env.IGNITER_STORAGE_URL || "https://cdn.example.com")
  .build();

Public access

Ensure the bucket policy/IAM allows public reads if you rely on CDN-style URLs. Otherwise, pair this adapter with signed URLs at your CDN or edge layer.

Emulator and Multi-env

Point IGNITER_STORAGE_GOOGLE_ENDPOINT to a local emulator for tests. Use .withPath('/staging') to isolate environments in the same bucket while keeping URLs stable (https://cdn.example.com/staging/...).

Next: harden uploads with Policies & Validation or explore lifecycle flows in Architecture.