Environment Variables
FTo ensure correct communication between the frontend and backend (especially within the Docker network), you must configure the .env file in the root directory of your starter kit.
The .env.local File
Section titled “The .env.local File”Create a .env file and add the following keys:
# Internal API address for Server-Side Rendering (SSR) - Docker service nameINTERNAL_API_URL=http://pyxis-admin:8000
# Public API address accessible by the browser (Client-side)PUBLIC_API_URL=http://localhost:8000
# Laravel App Key (required for preview signature verification)LARAVEL_APP_KEY=base64:your-laravel-app-key...
# Secure cache revalidation token (must match Laravel's token)REVALIDATE_TOKEN=your-secret-revalidate-tokenOpis zmiennych
Section titled “Opis zmiennych”| Zmienna | Przykładowa Wartość | Opis |
|---|---|---|
| INTERNAL_API_URL | http://pyxis-admin:8000 | Used by the server (Node/Astro) for data fetching via the Docker network. |
| PUBLIC_API_URL | http://localhost:8000 | Used when the request is sent directly from the user’s browser. |
| LARAVEL_APP_KEY | base64:... | The backend APP_KEY. Essential for decrypting preview tokens. |
| REVALIDATE_TOKEN | secret123 | A shared key between backend and frontend to authorize cache clearing. |
⚠️ IMPORTANT: Why pyxis-admin? Inside Docker, containers do not recognize each other as localhost. You must use the service name defined in docker-compose.yml.