Deploying Sanity Studio to Google App Engine - app.yaml example

25 replies
Last updated: Jan 28, 2026
Anyone know where I can find a tutorial or even just an example app.yaml for deploying sanity studio to google app engine?
AI Update

While there isn't an official Sanity guide specifically for Google App Engine deployment, I can help you piece together what you need. Sanity Studio is a React Single Page Application (SPA) that builds to static files, so deploying it to App Engine is definitely possible.

First, you'll need to build your Studio. Run sanity build (or npm run build) in your Studio directory, which creates a dist folder containing your static files.

Here's an example app.yaml for deploying Sanity Studio to Google App Engine standard environment:

runtime: nodejs20  # or nodejs22 if supported
service: default

handlers:
  # Serve static files from the dist directory
  - url: /static
    static_dir: dist/static
    secure: always

  # Serve other static assets
  - url: /(.*\.(js|css|png|jpg|jpeg|gif|svg|ico|woff|woff2|ttf|eot))$
    static_files: dist/\1
    upload: dist/.*\.(js|css|png|jpg|jpeg|gif|svg|ico|woff|woff2|ttf|eot)$
    secure: always

  # Catch-all handler for SPA routing - serve index.html
  - url: /.*
    static_files: dist/index.html
    upload: dist/index.html
    secure: always

The key here is the catch-all handler at the end, which ensures that all routes serve index.html - this is essential for SPA routing to work correctly.

Important considerations:

  1. CORS Configuration: After deploying, you'll need to add your App Engine URL to your Sanity project's CORS origins. Go to manage.sanity.io, select your project, navigate to API settings, and add your appspot.com URL.

  2. Alternative: Use sanity deploy: The recommended approach is actually to use sanity deploy, which hosts your Studio on Sanity's infrastructure at your-hostname.sanity.studio. This includes automatic SSL, schema deployment for AI features, and no CORS configuration needed.

  3. Build output: Make sure your dist folder exists before deploying. The build command generates this directory with all your Studio's compiled assets.

If you're set on App Engine for specific infrastructure reasons, the app.yaml above should work. Just make sure to test the deployment and verify that client-side routing works correctly by navigating to different Studio paths directly.

Show original thread
25 replies

Sanity – Build the way you think, not the way your CMS thinks

Sanity is the developer-first content operating system that gives you complete control. Schema-as-code, GROQ queries, and real-time APIs mean no more workarounds or waiting for deployments. Free to start, scale as you grow.

Was this answer helpful?