t3-code-android-nightly/.repos/alchemy-effect/examples/gcp-website-astro
Julius Marminge 6f9cea00ae
chore(refs): sync Effect and Alchemy references to 4.0.1 and beta.80 (#16170)
Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-05 13:22:30 -07:00
..
public chore(refs): sync Effect and Alchemy references to 4.0.1 and beta.80 (#16170) 2026-10-05 13:22:30 -07:00
src chore(refs): sync Effect and Alchemy references to 4.0.1 and beta.80 (#16170) 2026-10-05 13:22:30 -07:00
test chore(refs): sync Effect and Alchemy references to 4.0.1 and beta.80 (#16170) 2026-10-05 13:22:30 -07:00
alchemy.run.ts chore(refs): sync Effect and Alchemy references to 4.0.1 and beta.80 (#16170) 2026-10-05 13:22:30 -07:00
astro.config.ts chore(refs): sync Effect and Alchemy references to 4.0.1 and beta.80 (#16170) 2026-10-05 13:22:30 -07:00
package.json chore(refs): sync Effect and Alchemy references to 4.0.1 and beta.80 (#16170) 2026-10-05 13:22:30 -07:00
README.md chore(refs): sync Effect and Alchemy references to 4.0.1 and beta.80 (#16170) 2026-10-05 13:22:30 -07:00
tsconfig.json chore(refs): sync Effect and Alchemy references to 4.0.1 and beta.80 (#16170) 2026-10-05 13:22:30 -07:00

GCP Website: Astro

Deploys an Astro site to Google Cloud with GCP.Website.Astro. You don't need an astro.config.* adapter or a Dockerfile. Alchemy builds the site with Astro's Node target and bakes the server plus the client assets into a Node image. It pushes the image to Artifact Registry and runs it on a public Cloud Run service.

  • src/pages/index.astro is server-rendered in the Cloud Run container on every request and reads the GREETING environment value declared in alchemy.run.ts.
  • src/pages/about.astro opts into prerendering (export const prerender = true) and is served as a static file.
  • Everything under public/ is served as static assets.

The integration package must be installed in the project (it is loaded dynamically at deploy time):

bun add -d @alchemy.run/frontend-frameworks

Deploy

Credentials come from your alchemy profile: run alchemy profile once and pick GCP (Service account JSON for a key file, or Stored for an access token or key kept in ~/.alchemy/credentials, plus a default region), then deploy with --profile <name>. The service runs in the profile's region.

Docker must be running, because the image is built locally.

From the repository root:

pnpm install
cd examples/gcp-website-astro
pnpm deploy --profile <name>

The url output is the Cloud Run service URL (https://….run.app). Unchanged sources skip the Astro build and the image push on later deploys, because the input files are content-hashed (scoped by memo.include).

Local development

pnpm dev --profile <name>

alchemy dev runs Astro's own dev server with hot reload. It creates no Cloud Run service or image.

Live test

ALCHEMY_PROFILE=<name> bun test test/integ.test.ts --timeout 1200000

The test deploys the stack and checks the server-rendered home page, the prerendered page, the Tailwind build, and a file from public/. At the end it destroys the stack.

Destroy

pnpm destroy --profile <name>

This deletes the Cloud Run service, its Artifact Registry image repository, and the service account Alchemy minted for it.