sailfork / t3code-github / .repos/ alchemy-effect/ website/ src/ content/ docs/ gcp/ index.mdx

An Alchemy app on Google Cloud is one runtime, usually a Cloud Run service, plus the resources it uses: databases, buckets, topics, secrets. You connect them with typed bindings. Call GCP.Firestore.ReadWriteDatabase(db) in your code and Alchemy gives the service its own service account with exactly that role on that database. The code is the IAM policy.

// src/Api.ts
import * as GCP from "@alchemy.run/gcp";
import * as Effect from "effect/Effect";
import * as HttpServerResponse from "effect/http/HttpServerResponse";

export default class Api extends GCP.Function<Api>()(
  "Api",
  { main: import.meta.url, invokerIamDisabled: true },
  Effect.gen(function* () {
    const links = yield* GCP.Firestore.Database("Links", {
      type: "FIRESTORE_NATIVE",
    });
    const db = yield* GCP.Firestore.ReadWriteDatabase(links);

    return {
      fetch: Effect.gen(function* () {
        yield* db.set("links/demo", { url: "https://alchemy.run" });
        const link = yield* db.get("links/demo");
        return yield* HttpServerResponse.json(link?.fields ?? {});
      }).pipe(Effect.orDie),
    };
  }).pipe(Effect.provide(GCP.Firestore.ReadWriteDatabaseHttp)),
) {}

New here? Set up credentials, then start the tutorial.

Pick your runtime

  • Cloud Run — HTTP services that scale to zero. The default, and what every page here builds on.
  • Cloud Run jobs — batch work that runs to completion.
  • Worker pools — always-on queue consumers with no URL.
  • Cloud Functions — the same program, built by Google, no local Docker.
  • GKE — Kubernetes Deployments and Jobs on Autopilot.

Not sure? See Choosing a runtime.

Data

  • Firestore — documents as plain objects, no instance to size.
  • Cloud Storage — buckets with read and write clients and signed URLs.
  • Cloud SQL — Postgres over the Cloud SQL socket, with Drizzle.
  • BigQuery — stream rows in, query with parameters.
  • Memorystore — Redis on a private IP.

Messaging & events

  • Pub/Sub — publish, then consume by push or pull, with filters and dead letters.
  • Cloud Scheduler — cron handlers on your service.
  • Storage events — run code when an object lands.
  • Eventarc — react to Firestore changes and other Google events.

Frontend & APIs

AI, security, and operations

What are you building?

You're buildingReach for
An HTTP APICloud Run + Firestore
A typed APIEffect HTTP on Cloud Run
A Postgres-backed appCloud SQL
A websiteWebsites
A static siteStatic sites
Background jobsPub/Sub + a worker pool
An analytics pipelinePub/Sub → BigQuery
Scheduled workCloud Scheduler or a scheduled job
Upload processingStorage events
A chat endpointVertex AI
Kubernetes workloadsGKE

Out of scope

Alchemy manages infrastructure, not end-user content. APIs whose objects are a person's data are not modelled as resources: Gmail, Forms, Calendar, Drive, Classroom, Chat, Tasks, Keep, People, Blogger, YouTube, Fitness, Apps Script, Street View, Fact Check, and Business Profile. Neither is prodtt-sasportal, a test copy of the SAS Portal API.

The advertising and marketing APIs (Analytics Admin, Display & Video 360, Tag Manager, Workspace Reseller, AdSense, AdSense Platform, Ad Exchange Buyer II, Campaign Manager 360, and DoubleClick Bid Manager) need a user's OAuth consent, which a service account can't hold. The Content API for Shopping and Apigee Registry are retired by Google.

Where next

  • Setup — connect your project.
  • Tutorial — from an empty folder to CI/CD in five parts.
  • Providers reference — generated docs for every GCP resource, well beyond the services covered here.