astro-app/.env for local development. Copy the example file to get started:
.env file is not deployed.
Sanity configuration
These variables connect the Astro app and Sanity Studio to your Sanity project.PUBLIC_SANITY_STUDIO_PROJECT_ID
Required. Your Sanity project ID.
- Go to sanity.io/manage.
- Select your project.
- The project ID appears in the URL and on the project overview page.
This variable used to be
PUBLIC_SANITY_PROJECT_ID in older versions of the project. Both names are supported in astro.config.mjs, but prefer the PUBLIC_SANITY_STUDIO_PROJECT_ID form as shown in .env.example.PUBLIC_SANITY_DATASET
Required. The Sanity dataset to query. Defaults to production.
| Dataset | Site | Theme |
|---|---|---|
production | YWCC Capstone (default) | Red |
rwc | RWC US or RWC International | Blue / Green |
SANITY_API_READ_TOKEN
Required for Visual Editing. A Sanity API token with Viewer permissions, used to fetch draft content in the Presentation tool.
- Go to sanity.io/manage and select your project.
- Navigate to Settings → API → Tokens.
- Click Add API token, give it a name (e.g.,
local-visual-editing), and set the role to Viewer. - Copy the token — it is only shown once.
Multi-site configuration
The platform supports multiple sites from a single codebase. These variables control which site context and theme are active at build time.PUBLIC_SITE_ID
Identifies the active site. Controls dataset selection, navigation, and theme.
PUBLIC_SITE_THEME
Sets the color theme for the active site. Must be one of red, blue, or green.
If an invalid theme is provided, the build falls back to
red and logs a warning in the console.Visual Editing
PUBLIC_SANITY_VISUAL_EDITING_ENABLED
Enables or disables Sanity’s Visual Editing overlay (stega encoding + Presentation tool).
true, the Sanity client bypasses the CDN and fetches live draft content. This is automatically enabled on the preview branch in Cloudflare Pages.
PUBLIC_SANITY_LIVE_CONTENT_ENABLED
Enables client-side live content subscriptions via the Live Content API. Allows content updates to appear in the browser without a full page reload.
URLs and routing
PUBLIC_SANITY_STUDIO_URL
The base URL of your Sanity Studio. Used by the Visual Editing stega overlay to generate “Edit in Studio” links.
PUBLIC_SITE_URL
The canonical URL of the deployed site. Used for generating canonical <link> tags and the sitemap.
Analytics and integrations
PUBLIC_GTM_ID
Google Tag Manager container ID. Leave empty to disable tracking.
PUBLIC_TURNSTILE_SITE_KEY
Cloudflare Turnstile site key for bot protection on forms. Obtain from the Cloudflare dashboard under Turnstile.
Server-side secrets
The following secrets are server-side only and must never have thePUBLIC_ prefix. For local development, set them in astro-app/.dev.vars (for Wrangler) or your .env file. For production, use wrangler secret put <NAME> or the Cloudflare Pages dashboard.
| Variable | Source | Purpose |
|---|---|---|
TURNSTILE_SECRET_KEY | Cloudflare Turnstile dashboard | Validates Turnstile tokens server-side |
DISCORD_WEBHOOK_URL | Discord channel → Integrations → Webhooks | Posts release notifications |
SANITY_API_WRITE_TOKEN | manage.sanity.io → Settings → API → Tokens (Editor role) | Writes form submissions to Sanity |
GOOGLE_CLIENT_ID | Google Cloud Console OAuth app | Google OAuth login |
GOOGLE_CLIENT_SECRET | Google Cloud Console OAuth app | Google OAuth login |
GITHUB_CLIENT_ID | GitHub OAuth App settings | GitHub OAuth login |
GITHUB_CLIENT_SECRET | GitHub OAuth App settings | GitHub OAuth login |
BETTER_AUTH_SECRET | Generate a random 32+ character string | Signs session tokens |
BETTER_AUTH_URL | Your deployment URL | Absolute URL for auth redirects |
RESEND_API_KEY | resend.com dashboard | Sends magic link emails |
RESEND_FROM_EMAIL | Your verified sender address | From address for magic link emails |
Complete .env.example
For reference, here is the full .env.example file from the repository: