Discussion on deploying Sanity Studio to Google App Engine
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: alwaysThe 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:
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.comURL.Alternative: Use
sanity deploy: The recommended approach is actually to usesanity deploy, which hosts your Studio on Sanity's infrastructure atyour-hostname.sanity.studio. This includes automatic SSL, schema deployment for AI features, and no CORS configuration needed.Build output: Make sure your
distfolder 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.
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.