Astro Env

Astro frontend environment variables.

Required variables

PUBLIC_API_BASE_URL=http://127.0.0.1:8000
PUBLIC_SITE_URL=http://localhost:4321
PRODUCTION_BASE_URL=https://your-domain.example
PUBLIC_PRODUCTION_BASE_URL=https://your-domain.example
ENVIRONMENT=DEVELOPMENT
PUBLIC_CLERK_PUBLISHABLE_KEY=pk_test_xxx
CLERK_SECRET_KEY=sk_test_xxx
PUBLIC_CLERK_SIGN_IN_URL=/login
PUBLIC_CLERK_SIGN_UP_URL=/login
PUBLIC_CLERK_AFTER_SIGN_IN_URL=/dashboard
PUBLIC_CLERK_AFTER_SIGN_UP_URL=/dashboard
WHITEPAPPER_API_KEY=wp_xxx

Expected outcome

Astro can render public pages and authenticated flows, and can call backend endpoints.

Common errors

ErrorCauseFix
401 on server-side callsInvalid WHITEPAPPER_API_KEYRegenerate key and update env
Redirect loops in authWrong Clerk route env valuesMatch sign-in/sign-up redirect values
Broken API callsIncorrect PUBLIC_API_BASE_URLPoint to backend base URL

Related pages

Whitepapper

Whitepapper is an API first CMS engine for devs who publish content.

Antk i n