docs: add UI dev instructions and configurable API proxy target
Some checks failed
CI / build (push) Failing after 38s
CI / cleanup-branch (push) Has been skipped
CI / docker (push) Has been skipped
CI / deploy (push) Has been skipped
CI / deploy-feature (push) Has been skipped

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
hsiegeln
2026-03-19 17:42:17 +01:00
parent 2b111c603c
commit 9613bddc60
2 changed files with 31 additions and 67 deletions

View File

@@ -1,73 +1,32 @@
# React + TypeScript + Vite # Cameleer3 UI
This template provides a minimal setup to get React working in Vite with HMR and some ESLint rules. React SPA built with [@cameleer/design-system](https://gitea.siegeln.net/cameleer/design-system), TanStack Query, and Zustand.
Currently, two official plugins are available: ## Development
- [@vitejs/plugin-react](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react) uses [Oxc](https://oxc.rs) ```bash
- [@vitejs/plugin-react-swc](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react-swc) uses [SWC](https://swc.rs/) npm install
npm run dev
## React Compiler
The React Compiler is not enabled on this template because of its impact on dev & build performances. To add it, see [this documentation](https://react.dev/learn/react-compiler/installation).
## Expanding the ESLint configuration
If you are developing a production application, we recommend updating the configuration to enable type-aware lint rules:
```js
export default defineConfig([
globalIgnores(['dist']),
{
files: ['**/*.{ts,tsx}'],
extends: [
// Other configs...
// 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,
// Other configs...
],
languageOptions: {
parserOptions: {
project: ['./tsconfig.node.json', './tsconfig.app.json'],
tsconfigRootDir: import.meta.dirname,
},
// other options...
},
},
])
``` ```
You can also install [eslint-plugin-react-x](https://github.com/Rel1cx/eslint-react/tree/main/packages/plugins/eslint-plugin-react-x) and [eslint-plugin-react-dom](https://github.com/Rel1cx/eslint-react/tree/main/packages/plugins/eslint-plugin-react-dom) for React-specific lint rules: By default the dev server proxies `/api/*` to `http://localhost:8081`. To proxy to a remote server instead:
```js ```bash
// eslint.config.js VITE_API_TARGET=http://192.168.50.86:30090 npm run dev
import reactX from 'eslint-plugin-react-x' ```
import reactDom from 'eslint-plugin-react-dom'
No CORS issues — Vite's proxy makes API calls server-side.
export default defineConfig([
globalIgnores(['dist']), ## Build
{
files: ['**/*.{ts,tsx}'], ```bash
extends: [ npm run build
// Other configs... ```
// Enable lint rules for React
reactX.configs['recommended-typescript'], ## API Types
// Enable lint rules for React DOM
reactDom.configs.recommended, Regenerate TypeScript types from a running backend:
],
languageOptions: { ```bash
parserOptions: { npm run generate-api:live
project: ['./tsconfig.node.json', './tsconfig.app.json'],
tsconfigRootDir: import.meta.dirname,
},
// other options...
},
},
])
``` ```

View File

@@ -1,13 +1,18 @@
import { defineConfig } from 'vite'; import { defineConfig } from 'vite';
import react from '@vitejs/plugin-react'; import react from '@vitejs/plugin-react';
// Use VITE_API_TARGET to proxy to a remote server, e.g.:
// VITE_API_TARGET=https://api.cameleer.siegeln.net npm run dev
const apiTarget = process.env.VITE_API_TARGET || 'http://localhost:8081';
export default defineConfig({ export default defineConfig({
plugins: [react()], plugins: [react()],
server: { server: {
proxy: { proxy: {
'/api': { '/api': {
target: 'http://localhost:8081', target: apiTarget,
changeOrigin: true, changeOrigin: true,
secure: false,
}, },
}, },
}, },