The app reads a simple stage flag to choose API/WebSocket endpoints. See src/config.ts:
- local (default):
- API_BASE_URL:
http://localhost:8080/api/v1 - WS_URL:
ws://localhost:8080/api/v1/ws
- API_BASE_URL:
- dev:
- API_BASE_URL:
/api/v1 - WS_URL:
ws://dev.example.com/api/v1/ws
- API_BASE_URL:
- prod:
- API_BASE_URL:
/api/v1 - WS_URL:
ws://example.com/api/v1/ws
- API_BASE_URL:
The stage is selected by the Vite env variable VITE_STAGE. If it is not set, local is used by default.
Run locally (backend at http://localhost:8080)
Use one of the following:
- pnpm:
pnpm dev:local - npm:
npm run dev:local - yarn:
yarn dev:local
Alternatively, you can run the default dev server (which also uses local because VITE_STAGE is unset):
- pnpm:
pnpm dev - npm:
npm run dev - yarn:
yarn dev
- Local:
pnpm build:local(ornpm run build:local) - Dev:
pnpm build:dev - Prod:
pnpm build:prod
These scripts simply export VITE_STAGE for the build so src/config.ts can pick the correct endpoints at compile time.
- When running locally, the frontend expects a backend available at
http://localhost:8080that provides:- Session endpoints:
/api/v1/auth/login,/api/v1/auth/logout,/api/v1/users/me - OIDC config endpoint:
/api/v1/configreturningoidc_client_idandoidc_authority_url
- Session endpoints:
- Click the "Log in with" button on the login page to start the OIDC redirect flow.
The sections below are the default Vite template notes.
This template provides a minimal setup to get React working in Vite with HMR and some ESLint rules.
Currently, two official plugins are available:
- @vitejs/plugin-react uses Babel for Fast Refresh
- @vitejs/plugin-react-swc uses SWC for Fast Refresh
If you are developing a production application, we recommend updating the configuration to enable type-aware lint rules:
export default tseslint.config({
extends: [
// Remove ...tseslint.configs.recommended and replace with this
...tseslint.configs.recommendedTypeChecked,
// Alternatively, use this for stricter rules
...tseslint.configs.strictTypeChecked,
// Optionally, add this for stylistic rules
...tseslint.configs.stylisticTypeChecked,
],
languageOptions: {
// other options...
parserOptions: {
project: ['./tsconfig.node.json', './tsconfig.app.json'],
tsconfigRootDir: import.meta.dirname,
},
},
})You can also install eslint-plugin-react-x and eslint-plugin-react-dom for React-specific lint rules:
// eslint.config.js
import reactX from 'eslint-plugin-react-x'
import reactDom from 'eslint-plugin-react-dom'
export default tseslint.config({
plugins: {
// Add the react-x and react-dom plugins
'react-x': reactX,
'react-dom': reactDom,
},
rules: {
// other rules...
// Enable its recommended typescript rules
...reactX.configs['recommended-typescript'].rules,
...reactDom.configs.recommended.rules,
},
})