Environment Variables
All environment variables required and optional for running PageBridge.
Required variables
All environment variables can be overridden via CLI flags. See the sync command for details.
GOOGLE_SERVICE_ACCOUNT
A JSON string containing your Google Cloud service account credentials. This service account must have access to the Google Search Console properties you want to sync.
GOOGLE_SERVICE_ACCOUNT='{"type":"service_account","project_id":"my-project","private_key_id":"...","private_key":"-----BEGIN PRIVATE KEY-----\n...\n-----END PRIVATE KEY-----\n","client_email":"pagebridge@my-project.iam.gserviceaccount.com","client_id":"...","auth_uri":"https://accounts.google.com/o/oauth2/auth","token_uri":"https://oauth2.googleapis.com/token"}'See Google Service Account for creating these credentials.
DATABASE_URL
PostgreSQL connection string for storing search analytics data.
# Local development
DATABASE_URL='postgresql://postgres:postgres@localhost:5432/pagebridge'
# Hosted (e.g., Neon, Supabase, Railway)
DATABASE_URL='postgresql://user:password@host:5432/dbname?sslmode=require'SANITY_PROJECT_ID
Your Sanity project ID, found in the Sanity management dashboard.
SANITY_PROJECT_ID='abc123xy'SANITY_DATASET
The Sanity dataset to sync snapshots and tasks to. Usually production.
SANITY_DATASET='production'SANITY_TOKEN
A Sanity API token with Editor or Admin permissions. PageBridge needs write access to create snapshots and refresh tasks.
SANITY_TOKEN='skRxyz...'Generate a token in your Sanity management dashboard under API > Tokens.
SITE_URL
The base URL of your website. Used for URL matching between GSC data and Sanity documents.
SITE_URL='https://your-site.com'Example .env file
GOOGLE_SERVICE_ACCOUNT='{"type":"service_account",...}'
DATABASE_URL='postgresql://postgres:postgres@localhost:5432/pagebridge'
SANITY_PROJECT_ID='your-project-id'
SANITY_DATASET='production'
SANITY_TOKEN='sk...'
SITE_URL='https://your-site.com'Security notes
- Never commit
.envfiles to version control - Use secrets management in CI/CD environments (GitHub Secrets, Vercel env vars, etc.)
- The
SANITY_TOKENshould have the minimum required permissions — Editor is sufficient - Rotate the Google service account key periodically through the Google Cloud Console