The application uses the following environment variables:
VITE_API_BASE_URL: Base URL of your API (default:http://localhost:8989)VITE_USE_MOCK_DATA: Use static data instead of the API (true/false)
- Copy
.env.exampleto.env.local:
cp .env.example .env.local- Edit
.env.localwith your settings:
VITE_API_BASE_URL=http://votre-api-server:port
VITE_USE_MOCK_DATA=false # true for static data, false for the real API
To develop the frontend without an active API server:
- Option 1 - Environment variable:
# In .env.local
VITE_USE_MOCK_DATA=true- Option 2 - Vite configuration:
// In vite.config.ts
const USE_MOCK_DATA = true;With this configuration:
- ✅ All dashboard data will be served via static data on the client side
- ✅ The user will be automatically logged in (no authentication required)
- ✅ A “Development Mode” indicator will appear in the header
- ✅ Logout works, but the user will be reconnected upon refresh
Set the VITE_API_BASE_URL environment variable during the build:
VITE_API_BASE_URL=https://domain-api.com npm run buildThe application expects these endpoints on your API server:
POST /dashdata/login: Authentication with{ username, password }- Returns:
{ token, user: { id, email, name? } } GET /dashdata/data: Dashboard data (requires Bearer authentication)- Returns:
{ totalPublications, totalUsers, licensesLast12Months, licensesLastWeek, oldestLicenseDate, totalLicensesSinceStart } GET /dashdata/overshared: Overshared licenses (requires Bearer authentication)PUT /dashdata/revoke: A revoke command sent through the dashboard (requires Bearer authentication)
The vite.config.ts file is configured with a proxy to redirect /dashdata/* requests to your API server during development. This avoids CORS issues during this phase.
src/lib/api.ts: Endpoint and helper configurationsrc/lib/apiService.ts: HTTP service with error handlingsrc/contexts/AuthContext.tsx: Authentication contextsrc/hooks/useDashboardData.ts: Hook to retrieve dashboard data