docs(env): document VITE_API_URL must include /api suffix

This commit is contained in:
Arthur Bassi 2026-06-17 09:32:43 -03:00
parent 06d0a8ecf4
commit 503aefa09a
2 changed files with 15 additions and 7 deletions

View file

@ -1,11 +1,12 @@
# API Configuration
# Copy this file to .env and update with your actual values
# Backend API base URL (Vite proxy uses /api in development)
# Backend API base URL (Ky prefixUrl). API route paths do NOT include /api — it comes from here.
# Development: use /api (Vite proxies /api to VITE_API_TARGET)
#VITE_API_URL=/api
# For production, update to your production API URL
VITE_API_URL=https://api.seahavenindustries.com
# Production: absolute URLs MUST include the /api path segment
VITE_API_URL=https://api.seahavenindustries.com/api
# Development proxy target (used by vite.config.ts)
#VITE_API_TARGET=http://localhost:5141

View file

@ -16,10 +16,17 @@ cp .env.example .env
### Environment variables
| Variable | Description | Default |
| ----------------- | ------------------------------------------------------ | ----------------------- |
| `VITE_API_URL` | Backend API base URL (baked into the production build) | `/api` |
| `VITE_API_TARGET` | Dev proxy target for `/api` (Vite only) | `http://localhost:5141` |
| Variable | Description | Default |
| ----------------- | ----------------------------------------------- | ----------------------- |
| `VITE_API_URL` | Ky API prefix (baked into the production build) | `/api` |
| `VITE_API_TARGET` | Dev proxy target for `/api` (Vite only) | `http://localhost:5141` |
`VITE_API_URL` is the full API base prefix. Route paths in `API_PATHS` do **not** include `/api` — only this variable supplies it.
- **Development:** use `VITE_API_URL=/api`. The Vite dev server proxies `/api` to `VITE_API_TARGET`.
- **Production:** use an absolute URL that **ends with `/api`** (e.g. `https://api.example.com/api`). Absolute URLs without `/api` will produce broken API requests.
See [`.env.example`](.env.example) and [`.env.production`](.env.production) for reference values.
## Scripts