Environment variables
All runtime configuration is supplied through a.env file located at red-dashboard/.env. Vite exposes any variable prefixed with VITE_ to the browser bundle at build time.
Sample .env file
Variable reference
| Variable | Required | Default | Description |
|---|---|---|---|
VITE_API_BASE_URL | Yes | http://127.0.0.1:8000/api | Base URL of the backend REST API, including the /api path segment |
In production, set
VITE_API_BASE_URL to the full /api path of your production host — for example https://misidev.space/api. The value is embedded into the compiled bundle at build time, so you must rebuild the app after changing it.HTTP client settings
All API calls go through a single Axios instance defined insrc/shared/api/http.ts. The instance is configured with the following options:
baseURL
The Axios instance uses a relative baseURL of /api rather than reading VITE_API_BASE_URL directly. In development, Vite’s dev server proxy forwards /api/* requests to http://127.0.0.1:8000:
https://misidev.space), so relative /api paths resolve correctly without the proxy.
timeout
Requests are cancelled after 10,000 ms (10 seconds). If the backend does not respond within this window, Axios will reject the promise with a timeout error.
withCredentials
Set to true to allow the browser to include cookies and other credentials in cross-origin requests. This supports cookie-based session authentication if the backend uses it alongside (or instead of) Bearer tokens.
Request interceptor — Bearer token
Before every request, the interceptor reads the access token fromlocalStorage and attaches it as an Authorization header:
Response interceptor — automatic logout on 401
If the backend returns a401 Unauthorized response, the interceptor clears the stored token and redirects the browser to /login:
Token storage
The access token returned by the login endpoint is persisted tolocalStorage under the key access_token.