The options for running Google Cloud Storage on your machine for development and tests: fake-gcs-server with STORAGE_EMULATOR_HOST, the Firebase Storage emulator, a real dev bucket, and a bucket declared in code that runs locally and deploys to GCS.

Code that writes to Google Cloud Storage is awkward to run on a laptop, because Google ships emulators for Pub/Sub, Firestore and Spanner but not for Cloud Storage. Teams end up sharing a dev bucket, where tests collide and need credentials, or mocking the client, which hides real behavior.
This guide covers the options that do work locally and what each one catches before code reaches a real bucket.
The gcloud emulators reference lists Bigtable, Datastore, Firestore, Pub/Sub and Spanner, which is why every Cloud Storage option here is a third-party server, a different product or a real bucket.
fake-gcs-server implements the parts of the GCS JSON API that application code uses, including buckets, uploads, downloads, listing and metadata. It defaults to HTTPS on port 4443, so pass -scheme http for local work, and -backend memory keeps every run clean:
The official clients read STORAGE_EMULATOR_HOST and send requests there with no authentication, as the Go storage package docs describe, so a test needs no fake interfaces. This test passed against fake-gcs-server 1.56.1 with cloud.google.com/go/storage 1.71.0:
// storage/upload_test.go
package storage_test
import (
"context"
"errors"
"io"
"testing"
"cloud.google.com/go/storage"
)
func TestUploadRoundTrip(t *testing.T) {
t.Setenv("STORAGE_EMULATOR_HOST", "localhost:4443")
ctx := context.Background()
client, err := storage.NewClient(ctx)
if err != nil {
t.Fatal(err)
}
defer client.Close()
bkt := client.Bucket("test-uploads")
if err := bkt.Create(ctx, "test-project", nil); err != nil {
t.Fatal(err)
}
w := bkt.Object("invoices/1.txt").NewWriter(ctx)
w.ContentType = "text/plain"
if _, err := io.WriteString(w, "hello"); err != nil {
t.Fatal(err)
}
if err := w.Close(); err != nil {
t.Fatal(err)
}
r, err := bkt.Object("invoices/1.txt").NewReader(ctx)
if err != nil {
t.Fatal(err)
}
defer r.Close()
got, err := io.ReadAll(r)
if err != nil {
t.Fatal(err)
}
if string(got) != "hello" {
t.Fatalf("got %q", got)
}
if _, err := bkt.Object("missing.txt").Attrs(ctx); !errors.Is(err, storage.ErrObjectNotExist) {
t.Fatalf("want ErrObjectNotExist, got %v", err)
}
}
fake-gcs-server does not check signatures on signed URLs, and those URLs point at storage.googleapis.com, so per its README you rewrite the host and set -public-host before a browser can use them. IAM conditions, uniform bucket-level access and CORS rules are not enforced the way GCS enforces them, so keep a short check against a real dev bucket for those.
The Firebase Local Emulator Suite includes a Storage emulator that evaluates Firebase security rules, which makes it the right local target for apps that upload from the browser or a mobile app through the Firebase SDKs. For a backend that talks to GCS through the server-side client libraries, fake-gcs-server is the closer match.
Encore brings infrastructure from code, so instead of pointing a client at an emulator you declare the bucket in the service and Encore supplies the backend that fits where the code runs. Per the object storage docs, encore run stores objects on the local filesystem and tests use an in-memory backend, and on GCP the same bucket is provisioned in Cloud Storage, as the GCP infrastructure docs describe.

Run in your terminal to get started locally.
A service that stores invoice PDFs, and a test that runs without Docker, an emulator or GCP credentials:
// invoices/invoices.go
package invoices
import (
"context"
"encore.dev/storage/objects"
)
// Cloud Storage on GCP, S3 on AWS, the local filesystem under `encore run`.
var PDFs = objects.NewBucket("invoice-pdfs", objects.BucketConfig{Versioned: false})
type StoreParams struct {
PDF []byte
}
//encore:api private method=PUT path=/invoices/:id/pdf
func StorePDF(ctx context.Context, id string, p *StoreParams) error {
w := PDFs.Upload(ctx, "invoices/"+id+".pdf", objects.WithUploadAttrs(objects.UploadAttrs{
ContentType: "application/pdf",
}))
if _, err := w.Write(p.PDF); err != nil {
w.Abort(err)
return err
}
return w.Close()
}
type HasPDFResponse struct {
Exists bool
}
//encore:api private method=GET path=/invoices/:id/pdf/exists
func HasPDF(ctx context.Context, id string) (*HasPDFResponse, error) {
ok, err := PDFs.Exists(ctx, "invoices/"+id+".pdf")
if err != nil {
return nil, err
}
return &HasPDFResponse{Exists: ok}, nil
}
// invoices/invoices_test.go
package invoices
import (
"context"
"io"
"testing"
)
func TestStorePDF(t *testing.T) {
ctx := context.Background()
if err := StorePDF(ctx, "42", &StoreParams{PDF: []byte("%PDF-1.7")}); err != nil {
t.Fatal(err)
}
r := PDFs.Download(ctx, "invoices/42.pdf")
defer r.Close()
got, err := io.ReadAll(r)
if err != nil {
t.Fatal(err)
}
if string(got) != "%PDF-1.7" {
t.Fatalf("got %q", got)
}
res, err := HasPDF(ctx, "missing")
if err != nil {
t.Fatal(err)
}
if res.Exists {
t.Fatal("expected no PDF for an unknown invoice")
}
}
encore test ./... runs this against the in-memory backend, with the rest of the test setup covered in the testing docs, and encore run serves the same endpoints against files on disk, so there is no emulator to start, no port to configure and no difference in client code between local and cloud. On GCP, Encore provisions a service account for the service with access to the bucket, and signed upload and download URLs work against the Cloud Storage bucket once deployed. To deploy, connect your GCP account as described in Connect your cloud account and push.
A coding agent that adds a second bucket for thumbnails declares it next to the first, runs encore test and gets a passing or failing result in seconds, without asking anyone for bucket credentials.
Best fit: Teams that want Cloud Storage code to run and test locally with no emulator setup and deploy unchanged to their own GCP account.
Use fake-gcs-server when you have existing code on the official clients and want integration tests against a real HTTP API, and the Firebase emulator when uploads go through Firebase SDKs and security rules. Keep a real dev bucket for IAM, CORS and signed URL checks, and declare the bucket in code with Encore when you want local runs and tests to need nothing extra at all.
No. The gcloud emulators command covers Bigtable, Datastore, Firestore, Pub/Sub and Spanner, but not Cloud Storage. The most common local option is fake-gcs-server, an open source server that implements the GCS JSON API.
Set the STORAGE_EMULATOR_HOST environment variable to the emulator address, for example localhost:4443, before creating the client. The official client libraries then send requests to that address instead of storage.googleapis.com and skip authentication.
Only partly. It does not validate signatures, and the URLs your code signs point at storage.googleapis.com, so you have to rewrite the host and start the server with -public-host for a browser upload or download to reach it.
With Encore you declare the bucket with objects.NewBucket in the service, and encore run stores objects on the local filesystem while encore test uses an in-memory backend. Deploying to GCP provisions the bucket in Cloud Storage with access granted to the services that use it.
Deploy to your cloud on AWS and Google Cloud
without managing infrastructure
Encore lets developers and agents define application infrastructure directly in code, then automatically provisions it from local development to production in your AWS or GCP account.